aspose file tools
The moose likes JDBC and the fly likes how to use ? to CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply 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: 6915
"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.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to use ? to CallableStatement
 
Similar Threads
Maximum open cursors exceeded
problem with INSERT query with RETURNING clause
CallableStatement resultset returns only columns and no data, where data exists.
Return more recods from stored procedure
registerOutParameter