Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing PL/SQL with SQL Plus

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
I have created a complex PL/SQL procedure which has out parameters as 'return values'. I would like to test it out in SQL Plus. But how do I get/see the values in SQL Plus?
My procedure signature is
PROCEDURE proc_enrich
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
AIDSOURCE VARCHAR2 IN
AIDVal VARCHAR2 IN
ANAID VARCHAR2(20) OUT
ANADESC VARCHAR2(36) OUT
ANACODE CHAR(3) OUT

I tried the obvious, but I think the theory is that I passed in some sort of variables (does it mean I have to 'declare' them first). but my main question really is how do I do the SELECT bits...?
 
If I've understood you, you've made a procedure and want to test it.
OK, you must execute it. For doing it you must declare the vars, yes (at least the OUT ones). And then you will be able to see the results with a dbms_output.put_line call.
Let's see:

declare anaid varchar2(20);
anadesc varchar2(36);
anacode char(3);
begin
proc_enrich('char1','char2',anaid,anadesc,anacode);
dbms_output.put_line('anaid: '||anaid);
dbms_output.put_line('anadesc: '||anadesc);
dbms_output.put_line('anacode: '||anacode);
end;

Be careful. You must execute this statement before that:

set serveroutput on;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top