By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,835 Members | 2,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,835 IT Pros & Developers. It's quick & easy.

Perl with Sybase DBI - having problems in sp_helptext

P: 1
I am writing a perl scipt to get me the SQL text for a given stored procedure in Sybase. I have used the command sp_helptext <spname> to do this but am not able to extract the resultset. I am new to perl and this is my first script.

Code is as below:

Expand|Select|Wrap|Line Numbers
  1. $dbh = DBI->connect("dbi:Sybase:host=<host>;port=<port>", "user", "pwd");
  3.         $dbh->do("use dbname");
  4.         my $sth = $dbh->prepare("exec sp_helptext ?");
  5.         $sth->execute($_[0]) || die ("cannot run sp");
  6.         while(my @data = $sth->fetchrow_array()) {
  7.            print join(q{,}, @data) . "\n".$data[1];
  8.         }
  9.         $sth->finish;
  10.         $sth=undef;
I am getting a number when I print @data and null when I print $data[1]

I have been stuck with this for a while and not able to debug. Could some please help me. Many thanks in advance
Feb 5 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 174
try to print
Expand|Select|Wrap|Line Numbers
  1. $data[0]
Feb 5 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.