From: haomiao on
Hi
My proc program report a ora1801 error. My code is like this

-----tblPdspTxnMon.h------------
typedef struct
{
char sa_pri_key[ 36 ];
char sa_related_key[ 36 ];
char sa_alt_key[ 36 ];
char sa_lock_ind[ 2 ];
char sa_rout_fwd_id[ 14 ];
char sa_rout_rcv_id[ 14 ];
char sa_slmt_sys_date[ 5 ];
short n_slmt_group;
char sa_slmt_loc_date[ 5 ];
char sa_slmt_fwd_id[ 14 ];
char sa_slmt_rcv_id[ 14 ];
char sa_slmt_mcht_id[ 16 ];
char sa_slmt_term_id[ 9 ];
char sa_slmt_batch_num[ 7 ];
short n_txn_type;
short n_txn_fwd_stat;
short n_txn_rcv_stat;
char sa_slmt_pri_acct[ 24 ];
int sa_txn_amount;
int sa_orig_amount;
char sa_slmt_cur_code[ 4 ];
char sa_auth_rsp_code[ 8 ];
char sa_slmt_fee_type[ 9 ];
char sa_acct[ 24 ];
char sa_rsp_code1[ 3 ];
char sa_rsp_code2[ 3 ];
char sa_rsp_code3[ 3 ];
char sa_cmp_data[ 21 ];
char sa_sav1_data[ 201 ];
char sa_sav2_data[ 51 ];
char sa_rsp_data[ 51 ];
char sa_bak_data[ 81 ];
char sa_comm_data[ 41 ];
int l_total_fee;
int l_fwd_fee_1;
int l_fwd_fee_2;
int l_rcv_fee_1;
int l_rcv_fee_2;
int l_rec_updt_usr_id;
char tm_rec_updt_time[ 30 ];
char tm_rec_crt_time[ 30 ];
char sa_row_id[ 19 ];
} tbl_txn_mon_t;


-----
tbl_pdsp_txn_mon.pc---------------------------------------------------------
int tbl_txn_mon2_fetch_slice(tbl_txn_mon_t *tbl_txn_mon, int
*sql_code)
{
EXEC SQL BEGIN DECLARE SECTION;
tbl_txn_mon_t *db_tbl_txn_mon;
EXEC SQL END DECLARE SECTION;

db_tbl_txn_mon = tbl_txn_mon;

EXEC SQL FETCH
cur_txn_mon2_slice
INTO
:db_tbl_txn_mon->sa_pri_key,
:db_tbl_txn_mon->sa_related_key,
:db_tbl_txn_mon->sa_alt_key,
:db_tbl_txn_mon->sa_lock_ind,
:db_tbl_txn_mon->sa_rout_fwd_id,
:db_tbl_txn_mon->sa_rout_rcv_id,
:db_tbl_txn_mon->sa_slmt_sys_date,
:db_tbl_txn_mon->n_slmt_group,
:db_tbl_txn_mon->sa_slmt_loc_date,
:db_tbl_txn_mon->sa_slmt_fwd_id,
:db_tbl_txn_mon->sa_slmt_rcv_id,
:db_tbl_txn_mon->sa_slmt_mcht_id,
:db_tbl_txn_mon->sa_slmt_term_id,
:db_tbl_txn_mon->sa_slmt_batch_num,
:db_tbl_txn_mon->n_txn_type,
:db_tbl_txn_mon->n_txn_fwd_stat,
:db_tbl_txn_mon->n_txn_rcv_stat,
:db_tbl_txn_mon->sa_slmt_pri_acct,
:db_tbl_txn_mon->sa_txn_amount,
:db_tbl_txn_mon->sa_orig_amount,
:db_tbl_txn_mon->sa_slmt_cur_code,
:db_tbl_txn_mon->sa_auth_rsp_code,
:db_tbl_txn_mon->sa_slmt_fee_type,
:db_tbl_txn_mon->sa_acct,
:db_tbl_txn_mon->sa_rsp_code1,
:db_tbl_txn_mon->sa_rsp_code2,
:db_tbl_txn_mon->sa_rsp_code3,
:db_tbl_txn_mon->sa_cmp_data,
:db_tbl_txn_mon->sa_sav1_data,
:db_tbl_txn_mon->sa_sav2_data,
:db_tbl_txn_mon->sa_rsp_data,
:db_tbl_txn_mon->sa_bak_data,
:db_tbl_txn_mon->sa_comm_data,
:db_tbl_txn_mon->l_total_fee,
:db_tbl_txn_mon->l_fwd_fee_1,
:db_tbl_txn_mon->l_fwd_fee_2,
:db_tbl_txn_mon->l_rcv_fee_1,
:db_tbl_txn_mon->l_rcv_fee_2,
:db_tbl_txn_mon->l_rec_updt_usr_id,
:db_tbl_txn_mon->tm_rec_updt_time,
:db_tbl_txn_mon->tm_rec_crt_time;

if(sqlca.sqlcode) {
DB_TRACE_CA( &sqlca );
*sql_code = sqlca.sqlcode;
return -1;
}

return 0;

}

------------------------------------------------------------
After checking, I find the field "sa_comm_data" defined error, in
database this column
is raw(40), this need the "sa_comm_data" in tbl_txn_mon_t be char[81].

But why oracle report 1801? ther are only two column with type
"date", tm_rec_updt_time and tm_rec_crt_time.

And more, in the first 3 or 4 fetching, there is no error, after
that, 1801 is the most.

And in AIX5.2.0.7 there is no error, oracle version is 9.2.0.7.
In sco unix 7.1.3 , 1801 are reported, oracle version is 8.1.7.0.0.

From: haomiao on
one more question:
when 1801 happens, how can I know which field is error in my code?
From: Ana C. Dent on
haomiao <miaohaoz(a)ustc.edu> wrote in
news:d3d1be5b-540e-4216-a1a8-db1768fa625e(a)v26g2000prm.googlegroups.com:


> And in AIX5.2.0.7 there is no error, oracle version is 9.2.0.7.
> In sco unix 7.1.3 , 1801 are reported, oracle version is 8.1.7.0.0.
>

The two systems could have different NLS_DATE_FORMAT ;
ignoring the fact each piece mentioned above is unsupported.
From: haomiao on
> The two systems could have different NLS_DATE_FORMAT ;
> ignoring the fact each piece mentioned above is unsupported.

the NLS_DATE_FORMAT in both systems is same
YYYYMMSSHH24MISS
both in unix enviroment and oracle session parameter.

If I change the tbl_txn_mon_t.sa_comm_date to 81, ora-1801
disappear. So ora1801 in my sco system should be result of
the wrong length of tbl_txn_mon_t.sa_comm_date.

Why oracle not report 1801, instead of "the sa_comm_date is too
short"?
And why Aix not report 1801?