File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes initialization of variables type int as null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "initialization of variables type int as null" Watch "initialization of variables type int as null" New topic
Author

initialization of variables type int as null

Yanine Arellano
Greenhorn

Joined: Mar 14, 2007
Posts: 3
hi everyone, i have a store procedure in which one of the IN variables is an int and i have to send it as null, although whether i try this:
int count= null;
or
int count;
gives me error
How should i do it?

int count; --- this is where I initialize the variable and needs to be set as null.

CallableStatement ct = conn.prepareCall("{call fon.pck_mt3.db_mt3_deptran(?,?,?,?,?,?,?,?,?,?,?)}");

ct.setInt(1,count); // 1 count IN NUMBER, -- (15)

Thanks a lot, bye bye.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Try setNull().


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: initialization of variables type int as null
 
Similar Threads
SELECT COUNT
Java Recursion and binary tree searching questions
Database Metadata
Would like help about this excercise in HFJ
How to make combination function generic