java - getting Invalid column index when calling Procedural -
i have procedural takes 2 string arguments , returns integer value database oracle 10g .
when try print out result i'm getting invalid column index .
the code
try { dbconnection newconnect = new dbconnection(); connection con = newconnect.makeconnect(); callablestatement stmt1 = ((connection) con).preparecall("{ call login (?, ?, ?)}"); stmt1.registeroutparameter(1, types.integer); stmt1.setstring(2, "ahmed"); stmt1.setstring(3, "ahmed"); resultset rslt = stmt1.executequery(); if (rslt.next()) { system.out.println( rslt.getint(1)); }
procedural login
create or replace procedure login (p_username teacher.username%type, p_password teacher.password%type) v_teacher_id teacher.teacher_id%type; v_username teacher.username%type ; v_password teacher.password%type ; begin select teacher_id, username , password v_teacher_id , v_username , v_password teacher username = p_username , password =p_password ; dbms_output.put_line (v_teacher_id); end login ;
nice try error exists here.... this... output retrive 100% sure.
create or replace procedure login ( v_teacher_id out teacher.teacher_id%type, p_username in teacher.username%type, p_password in teacher.password%type) ..... (blah blah blah)
tell me onething, if not providing output parameter @ start of procedure , how can expect output in java code ?
now try, output java code
rslt.getint(1)
all best :)... surajit
Comments
Post a Comment