开发者

Display results in output parameter in Toad

开发者 https://www.devze.com 2023-01-12 21:45 出处:网络
I have a stored procedure in Oracle and I\'m using an out 开发者_开发问答parameter in it.. I want to know how to display the output in Toad..You just need to declare a variable to store the value in,

I have a stored procedure in Oracle and I'm using an out 开发者_开发问答parameter in it.. I want to know how to display the output in Toad..


You just need to declare a variable to store the value in, and then do whatever you want with the data afterwards. If you are just wanting to see the output, dbms_output is probably the easiest way to go:

declare
  -- declare variable to store out data in.  Make sure datatype is correct
  v_out VARCHAR2(50);
begin
  -- call procedure, assigning value of out parameter to variable you declared
  my_proc(
    p_in => 3,
    p_out => v_out
  );
  -- display value now in variable
  dbms_output.put_line('Value of p_out: '||v_out);
end;


In the Toad schema browser, click the 'Execute' button, which will generate some test code for calling your procedure, and writing the OUT parameter via dbms_output. Check the output in the dbms_output window (you may need to activate output in the dbms_output window using the two leftmost icons)


In Toad after execution of a query you can see Multiple Options like Data Grid, Auto Trace, DBMS Output etc...

  1. Goto option DBMS Output.
  2. If Output is Turn Off (Red Dot), then click over it to Turn it On (Green).
  3. Now Execute your query with CTRL+Enter
  4. This will show result after Poling Frequency Seconds.

Trial Code :

DECLARE 
    c number(4);
BEGIN
    c := 4;
    dbms_output.put_line(c);
END;
/

Display results in output parameter in Toad

0

精彩评论

暂无评论...
验证码 换一张
取 消