Reputation: 2725
I have a page with a textbox that passed a value through a stored procedure in Oracle. the procedure got changed so, there are now 2 parameters, one for the input value and a second one that returns an integer value back.
Here is the Oracle procedure:
procedure UnoxDataFix(p_shpmt_nbr in pkms.asn_hdr.shpmt_nbr%type, retval out integer) is
begin
retval:=0;
for r in (
-- simple select statement
)
loop
if(r.stat_code = 10 and r.whse_xfer_flag = 'Y')
then
update pkms.asn_dtl ad
-- simple set statement
update pkms.asn_hdr ah
-- simple set statement
where ah.shpmt_nbr = p_shpmt_nbr
RETURNING 1 into retval;
commit;
end if;
end loop;
end;
And here is the core C# code I had:
this.oraServer.ExecuteNonQuery(this.connectionString, CommandType.Text, "begin INTEGRATION.UnoxDataFix('" + input + "'); end;");
The connection string works. It's just the actual procedure that is giving the error. The 'input' value is the actual value that is sent to the procedure. But for returning the 'retval' back to the site, I'm not sure how to. I have tried Googling what I can, but it doesn't help. I'm a little slow, so all comments are most welcome. :)
Upvotes: 3
Views: 1007
Reputation: 2711
Because the procedure now expects 2 parameters, you need to give 2 parameters and not only the input parameter. Also, I prefer to use bind variables to prevent sql injection. (Yes, you can also use a bind variable for the OUT parameter).
begin INTEGRATION.UnoxDataFix(:input, :retval); end;
I am not familiar with the specifics of C#, so I can't help you with the exact methods to use to insert and retrieve the values.
On a side note, what kind of naming convention is this? Are you aiming for unreadability? :)
pkms.asn_hdr.shpmt_nbr
Upvotes: 2