Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 7th, 2005, 03:47 AM
abhit_kumar abhit_kumar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 22 abhit_kumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 3 sec
Reputation Power: 0
prob.. in the increasing of sring values..

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...

BP0101001
BP0101002
BP0101003
BP0101004


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...

Statement stmt=conn.createStatement();

stmt.execute("SELECT max(vou_no) as max_id FROM pay_header ");

results = stmt.getResultSet();

if(results.next())
{
Voucher_No=results.getString("max_id") + 1;
}
conn.setAutoCommit(false);

PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?)"));

pstmt.setString(1,Voucher_No);

pstmt.executeUpdate();

conn.commit();
conn.setAutoCommit(true);

Reply With Quote
  #2  
Old January 27th, 2005, 04:19 PM
solid_snake solid_snake is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 3 solid_snake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 28 sec
Reputation Power: 0
Quote:
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...

BP0101001
BP0101002
BP0101003
BP0101004


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...

Statement stmt=conn.createStatement();

stmt.execute("SELECT max(vou_no) as max_id FROM pay_header ");

results = stmt.getResultSet();

if(results.next())
{
Voucher_No=results.getString("max_id") + 1;
}
conn.setAutoCommit(false);

PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?)"));

pstmt.setString(1,Voucher_No);

pstmt.executeUpdate();

conn.commit();
conn.setAutoCommit(true);


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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > prob.. in the increasing of sring values..


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap