calling a function from oracle in C# giving error -
i calling function oracle package return string below
using(oracleconnection con = appconn.connection) { oraclecommand cmd = con.createcommand(); cmd.commandtype = commandtype.storedprocedure; cmd.connection = con; cmd.commandtext = "select p_pkg.found(@p_id) dual"; oracleparameter p_id = new oracleparameter(); p_id.oracledbtype = oracledbtype.int64; p_id.direction = parameterdirection.input; p_id.value = requestheader.approval_id; cmd.parameters.add(p_id); try { con.open(); string found = cmd.executescalar().tostring(); } catch(exception ex) { } { con.close(); } }
but getting below error . can't find problem after lot of search. please help.
ora-06550: line 1, column 51:
pl/sql: ora-00936: missing expression
ora-06550: line 1, column 7:
function signature in oracle
p_pkg.found(p_id in number) return varchar2 //(yes , no)
i run oracle below , got result out error
select p_pkg.found(1053) dual
the problem lies in use of sql server specific prefix parameters / bind variables. oracle uses :
instead of @
. sql parser doesn't understand query now.
use code instead:
select p_pkg.found(:p_id) dual
Comments
Post a Comment