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 how to use ? to CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to use ? to CallableStatement" Watch "how to use ? to CallableStatement" New topic

how to use ? to CallableStatement

Blood Bigsoon

Joined: Jun 03, 2001
Posts: 13
can anybody help me with this:
CallableStatement callStmt= null;
String cs="DECLARE TEST_ID_R in VARCHAR2(12),ano in NUMBER(1);"+
"begin "+
"select count(id) into ano"+
"from cet_sms "+
"where MOBILE_NUM='"+request.getParameter("mobile").trim()+"' and TEST_ID=TEST_ID_R; "+
"IF ano<1 THEN"+
"insert into cet_sms(id,MOBILE_NUM,MOBILE_TYPE,TEST_ID, SEND_FLAG,PERSONAL_ID,PAY_WAY,PASSWD,sub_date) values"+
callStmt = conn.prepareCall(cs);
for(int i=1;i<6;i++) {
callStmt.setString(1, request.getParameter("mobile").trim());
but I don't know how to use the ? in callStmt just like in PreparedStatement?
[This message has been edited by bigsoon (edited June 20, 2001).]
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
It is sorta covered in the JavaRanch Style Guide.
subject: how to use ? to CallableStatement
It's not a secret anymore!