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
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply 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://zeroturnaround.com/jrebel/download
 
subject: initialization of variables type int as null
 
Similar Threads
Database Metadata
SELECT COUNT
How to make combination function generic
Would like help about this excercise in HFJ
Java Recursion and binary tree searching questions