java - How to call a stored procedure with less parameters? -
string foo = "{call mystored(?,?,?,?)}"; callablestatement = dbconnection.preparecall(foo); callablestatement.setint(1, 10); callablestatement.executeupdate();
i have stored procedure 20 parameters. possible set few of parameters? stored procedure returns value. i've tried call mystored(?)
, set callablestatement.setint("colname", 10);
missmatch in numbers of parameters... should return value count parameter, it's 21?
you have bind parameters declare in statement. (for each ? have provide value set* or registeroutparameter) if these parameters have default value (that possible in pl/sql) don't have declare them in statement.
in db:
function get_empname(emp_id number, emp_name varchar2 default 'something') return varchar2
in java:
string statement1= "{? = call get_empname(?)}"; // valid statement string statement2= "{? = call get_empname(?, ?)}"; // valid statement
if have stored function (it returns value) can write statement this
string foo = "{? = call mystored(?)}"; callablestatement = dbconnection.preparecall(foo); callablestatement.registeroutparameter(1, oracle.jdbc.oracletypes.number); callablestatement.setint(2, 10); callablestatement.executeupdate();
Comments
Post a Comment