This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to use ? to CallableStatement" Watch "how to use ? to CallableStatement" New topic
Author

how to use ? to CallableStatement

Blood Bigsoon
Greenhorn

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"+
"(cet_sms_sid.nextval,'"+request.getParameter("mobile").trim()+
"',"+request.getParameter("type").trim()+","+
"TEST_ID_R,0,'"+request.getParameter("id").trim()+"',"+
"0,'"+passwd+"',sysdate)"+
"END IF"+
"end;";
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
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"bigsoon",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . 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.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
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
registerOutParameter
Return more recods from stored procedure
Maximum open cursors exceeded