Link to home
Start Free TrialLog in
Avatar of Dmitriy
DmitriyFlag for United States of America

asked on

Printing from stored procedure to perl

I am calling a stored procedure from perl which has a lot of print statements.  However, the statements are not printed in the perl output.  Is there any way to make perl read and display the PRINT statements from the stored procedure?

Thanks in advance,
Dmitriy
Avatar of koppcha
koppcha
Flag of United States of America image

redirect the output to a file and print the file.
Avatar of Dmitriy

ASKER

What output? I don't get any output from the stored procedure.  That's the problem.
from perl in the sense you are using perl connect,preparestatement etc..on in your perl code you are using system or exec or some other utility and runt he ISQL that executes the stored proc.My answer will hold good if you are running it through a ISQL script other can can you please post the perl script part that is calling the stored proc
sorry for the typos
I want to know how you are running the SP
1>using perl connect,preparestatement etc
or
2>using system or exec or some other utility and run the ISQL that executes the stored proc
Avatar of Dmitriy

ASKER

I declared a variable $dbh->new Sybase::DBlib user password server;

then I ran

$dbh->dbcmd("s_update_procedure '$param1', '$param2'");
$dbh->dbsqlexec;
if (($result = $dbh->dbresults) ne SUCCEED)
  {  
    print "Error\n";
    exit(1);
  }
ok try exec s_update_procedure '$param1', '$param2' insted
so your command will be
$dbh->dbcmd("exec s_update_procedure '$param1', '$param2'");
Avatar of Dmitriy

ASKER

Nope, that didn't work.
Avatar of Dmitriy

ASKER

That didn't work.

However, when I added OUTPUT parameter to the stored procedure and used $dbh->dbretdata and stored the returning values into an array, I got the results I wanted!

Thanks for trying koppcha
Great you got it.ok..error is in perl syntax
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial