File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes conn.prepareCall Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "conn.prepareCall" Watch "conn.prepareCall" New topic


Swosti Dipan Pal
Ranch Hand

Joined: Sep 23, 2005
Posts: 70

CallableStatement stproc_stmt = conn.prepareCall
("{call procname(?,?,?)}");

In the above statment the question mark corresponds to each column name in the table.

Is it necessary that only three columns should be present in that table ?
If we add another new column to this table, then the above statement will not be valid.


Thanks<br />-Swosti
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
NO. The question marks correspond to the parameters to a stored procedure named "procname". You only need to change the call if you change the parameters to the procedure.

It's not in any way related to tables.
Swosti Dipan Pal
Ranch Hand

Joined: Sep 23, 2005
Posts: 70
Thanks so much !!!

Suppose a table has 4 columns. We are passing those four columns in the procname. We have added another column. Is there any way to access this 5th (new column) inside the procname without updating the pocname definition ?

I mean if a table has (n) columns , is it manadatory to pass (n) parameters in the procname to access these (n) columns. Is it possible to pass (n-1) parameters in the procname and access the n columns inside the procedure.

[ April 15, 2006: Message edited by: Biswamohan Routray ]
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Sure why not. Your question is wrong so it really doesn't matter what answer we give so I'll say yes.

Parameter bindings are for column values not field names but you seem to feel differently. Could you post the code for this procedure so it can be better understood what you are attempting to do here?
I agree. Here's the link:
subject: conn.prepareCall
It's not a secret anymore!