Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Paul Clapham
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Saloon Keepers:
Tim Holloway
Carey Brown
Roland Mueller
Piet Souris
Bartenders:
Forum:
JDBC and Relational Databases
Error Numeric Overflow-oracle
archana gangaiah
Greenhorn
Posts: 15
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm using oracle 10g.
I am trying to get the sum of count of a column based on some collection column which is passed at run time using preparedStatement.
here is my code. The query works fine in sqldeveloper.
public int publishCcollectionCountOfRelationship(List<String> collections) {int temp=0; List<Integer> count= new ArrayList<Integer>(); List<Date> date= new ArrayList<Date>(); List<String> collection1= new ArrayList<String>(); try{ Driver d1 = (Driver)Class.forName(DBDRIVER).newInstance(); DriverManager.registerDriver(d1); Connection conn = DriverManager.getConnection(URI, USER, PASSWORD); ResultSet resultSets =null; PreparedStatement pstmt; String query =" select sum(rel_count) from erd_workflow.PUBLISH_FILE_TRACKER p, erd_workflow.ltc_load_tracker l where p.collection= ? " +" and l.received_date = '01-jun-11' "; System.out.println("query :"+query); for(String collection: collections){ pstmt= conn.prepareStatement(query); pstmt.setString(1 , collection); System.out.println("collction"+collection); resultSets = pstmt.executeQuery(); if(resultSets.next()) { System.out.println("collection1 :"+resultSets.getInt(1) ); count.add(resultSets.getInt(1)); collection1.add(resultSets.getString(2)); System.out.println("collection1 :" ); } } } catch(Exception e){ System.out.println("Error "+ e.getMessage()); } for(int total:count){ temp=total+temp; } System.out.println("RlationShip1 Count basede on document "+ temp); return temp; }
please help me....Thnks in adv
Many Thanks,
archu
archana gangaiah
Greenhorn
Posts: 15
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Actually, I was trying to insert too big value for that column's datatype scale....:-)
Many Thanks,
archu
Jan Cumps
Bartender
Posts: 2662
19
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Can you give us the complete error message?
And this line of code: collection1.add(resultSets.getString(2));
You select field 2 from the query, but the statement returns one field.
OCUP UML fundamental and ITIL foundation
archana gangaiah
Greenhorn
Posts: 15
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I forgot to comment that line while posting ... It is working..... Thanks for pointing out
Many Thanks,
archu
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
collections: why duplicates arent getting eradicated?
Executors in Threads
ejbLoad is not getting called
doubts in setDate(i,date,cal) API of preparedStatement
Collection program not working as expected
More...