January 27th, 2005, 04:19 PM
Join Date: Jan 2005
Time spent in forums: 55 m 28 sec
Reputation Power: 0
Originally Posted by abhit_kumar
i have the following query which insert Voucher No. that is string like that BP0101001..
when i insert voucher no it select maximum voucher no. from database and then increase the voucher no by 1..i.e. its incresing the voucher no..automatically by taking voucher no from the database..
It increases like that...
but its coming error of:
Exception:[Oracle][ODBC][Ora]ORA-01401: inserted value too large for column
as i have already checked the insertion of all the vales size..its with in the size of database..
is there an prob.. in my following query..
plz.. make my query working for me...
stmt.execute("SELECT max(vou_no) as max_id FROM pay_header ");
results = stmt.getResultSet();
Voucher_No=results.getString("max_id") + 1;
PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?)"));
is Voucher_No String data type??
BP0101001 + 1 = BP01010011 (if String) which add character length in data
so maybe your rdbms complaint because you set the max length.
try to substring the number part of voucher no convert it to long (or whatever)
add with one and convert again to String.