I think you may be rather confused. Although I do not use Sybase or DBD::Sybase I assume sp_helptext is similar in Sybase as to what it is now in SQL Server. Firstly it is a procedure, not a function, secondly it does not return the definition that is used to create an object in multiple rows but a result-set and finally the argument to it is the object you are enquiring about. i.e., you do something like:

prepare(q/exec sp_helptext(?)/); execute('my_object_name'); while(@data = fetchrow_array) { print join(q{,}, @data) . "\n"; }

sp_helptext creates a result-set which you can retrieve by calling fetch (fetchrow/fetchrow_arrayref etc) on the statement handle. However, you should be aware that SQL Server (which I imagine is similar to Sybase) does not return output parameters until the procedure has completed and that means you must have retrieved all result-sets and usually means calling more_results (see http://search.cpan.org/~mewp/DBD-Sybase-1.09/Sybase.pm#Handling_Multiple_Result_Sets and http://search.cpan.org/~mewp/DBD-Sybase-1.09/Sybase.pm#Calling_Stored_Procedures.


In reply to Re: Perl db programming by mje
in thread Perl db programming by rmatil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.