sybase - How to execute stored procedure in perl? -
how execute sybase stored procedure** "dbo.xyz" in perl script?
my $procedure = "call dbo.getallbooks"; $execproc = $dbh -> prepare($procedure) or die "unable prepare '$procedure'"; $execproc -> execute(); while (@data = $execproc->fetchrow_array) { open (fh, ">>output.csv") or die "could not open file output.csv: $!"; print fh "@data $csv_record .\n";; close (output.csv); }
if you're using dbi , dbd::sybase, stored procedures handled same way executing other sql statement. there 1 difference in return result set return status. can check value of $sth->{ syb_result_type } see if cs_status_result while calling fetch* methods.
dbd::sybase bit weird compared other database drivers however. things may difficult given db-library sybase provides developers don't blame author implementing driver way. dbd::sybase still done though.
you should take time read stored procedure section of documentation in cpan since describe , not do. actually, grab cup of coffee , read of it. i've done amount of work using dbd::sybase , has helped me out.
Comments
Post a Comment