db2 print message within procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dsener
    New Member
    • Mar 2008
    • 3

    db2 print message within procedure

    Hi all :)

    I like to be able to print messages throughout my long procedure statement.

    I can currently use "!echo my message@" outside of my procedure BUT not able to figure out how to do this inside the procedure.

    Any help would be greatly appreciated.

    Deniz
  • sakumar9
    Recognized Expert New Member
    • Jan 2008
    • 127

    #2
    You cannot print directly to standard output device from a stored procedure. However, you can redirect your output to a file. Again, this is possible only if your stored procedure definition is written in a language than SQL/PL.

    You can implement file handling.

    By the way, what do you want to achieve from doing this?

    Regards
    -- Sanjay

    Comment

    • docdiesel
      Recognized Expert Contributor
      • Aug 2007
      • 297

      #3
      Hi,

      Deniz, as far as I can guess you'd like to echo some debug messages, like "stored procedure at point 3", right?

      Now that a direct output isn't possible (Thanks Sanjay, I wouldn't have known), I suggest another approach. Create a separate table "debugtext" with columns (when datestamp, txt varchar(255)) and insert your messages into it while inside the stored procedure:

      Code:
      INSERT INTO
        debugtext
      VALUES
        ( current_datestamp, 'stored proc at point 7' );
      Sanjay, this should be possible, shouldn't it?

      Regards,

      Bernd

      Comment

      • sakumar9
        Recognized Expert New Member
        • Jan 2008
        • 127

        #4
        Yes Bernd, this is possible....... .....

        Regards
        -- Sanjay

        Comment

        Working...