Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009

    Unanswered: How to Print the value of variable used in Oracle Procedure


    I am new for oracle.

    I am writing a dynamic query in stored procedure and i am passing a parameter in the query i want to verify the query that how the parameter is getting reflected in the query for that i want to print the query during the execution of procedure.
    Please suggest me how to print the query and i am using TOAD.

    Thanks in advance!

  2. #2
    Join Date
    Jun 2009

    SQL> set serveroutput on format wrap
    SQL> declare
    2 x varchar2(30) := 'My name is neo.';
    3 begin
    4 dbms_output.enable(1000000);
    5 dbms_output.put_line ('The value of variable "x" is: ['||x||']');
    6* end;
    SQL> /
    The value of variable "x" is: [My name is neo.]

    PL/SQL procedure successfully completed.

  3. #3
    Join Date
    Jun 2009
    Thanks for reply.

    But i am working on TOAD and i want to print entire sql statement which i have written in procedure.Is this code will be usefull in toad also?

  4. #4
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    Huh, combination of you being an Oracle newbie + not knowing how to use tool you've chosen (TOAD) + dynamic query in a stored procedure can hardly be taken as a winning combination.

    You might put "dynamic query" into a variable and display it using DBMS_OUTPUT (just as @neonle showed), even in TOAD; no problem, just enable DBMS_OUTPUT. How? It is described in Help.

  5. #5
    Join Date
    Nov 2003
    Provided Answers: 23
    Quote Originally Posted by prasadtiwari
    Is this code will be usefull in toad also?
    Why don't you simply try it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts