This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
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
I agree. Here's the link:
subject: how to use ? to CallableStatement
Similar Threads
CallableStatement resultset returns only columns and no data, where data exists.
problem with INSERT query with RETURNING clause
Return more recods from stored procedure
Maximum open cursors exceeded