http://www.perlmonks.org?node_id=1012949


in reply to Calling Oracle StoredProc using Win32:ODBC

ranijoseph:

For calling Oracle stored procs (which I do *all the time*), I do it like this:

... my $ST=$DB->prepare("call apps.package_name.proc(?, ?, ?)"); my ($ST_result, $arg1, $arg2); ... $ST->bind_param(1, $arg1); $ST->bind_param(2, $arg2); $ST->bind_param_inout(3, \$ST_result, 0, { ora_type=>ORA_RSET } ); $ST->execute(); while (my $hr = $ST_result.fetchrow_hashref) { ... process data ... }

This is for a stored procedure that looks something like:

procedure proc( arg1 in varchar(32), arg2 in number, result out sys_cursor ) as begin open result for select col1, col2, 'FOO' col3 from tableFoo where col7=arg1 or col8=arg2 ; end;

...roboticus

When your only tool is a hammer, all problems look like your thumb.