I am trying to get output of a table from a stored procedure. The select statement
works with fetchall_arrayref, but this is a little different.
The perl code that I have is this:
#!/usr/local/bin/perl
use DBI;
require "/proj/dsa/www/shared/perl/config.ph";
$dbh = DBI->connect($main::DB_DATASOURCE, $main::DB_ROOT,$main::DB_ROOT_PWD,'Oracle');
$cursor = $dbh->prepare("begin sp_Sel_mdsaa11_table.get_token1(
:tok); end;");
print "cursor:$cursor\n";
$cursor->execute();
@array_ref=$cursor->fetchall_arrayref();
print "array_ref:$array_ref\n";
foreach $row (@array_ref) {
print "row:$row\n";
foreach $tok (@{$row}){
print "tok:$tok\n";
}
}
$dbh->disconnect;
The stored procedure is defined as thus:
CREATE OR REPLACE PACKAGE sp_Sel_MDSAA11_table
AS
TYPE token is TABLE of VARCHAR2(100)
INDEX BY BINARY_INTEGER;
PROCEDURE get_token1(t_tok OUT token);
END sp_Sel_MDSAA11_table;
/
PROCEDURE get_token1(t_tok OUT token)
IS
CURSOR token_cur IS
SELECT *
FROM mdsaa11_stusraptkn WHERE DSAA14_USERID_C = 'h-grange';
percount NUMBER DEFAULT 1;
BEGIN
FOR single_token IN token_cur
LOOP
t_tok(percount) := single_token.DSAA02_APPLICATION_C;
percount := percount + 1;
END LOOP;
END;
END;
/
There are only 8 rows of data that should appear, but my output is the disappointing:
cursor:DBI::st=HASH(0x1aa684)
array_ref:
row:ARRAY(0x186e54)
So, it would appear that row is an array, but I can't get at any of the elements.
My colleague has this working in vb, so I know this can be done....
Tim Vorce
[EMAIL PROTECTED]
313-248-7713