Solved

(how to handle) Oracle sqlplus & Multiple Return Paramters

Posted on 2001-08-27
2
1,924 Views
Last Modified: 2008-03-03
Ok, I am struggling with executing the PL/SQL proc that returns not one but TWO return parameters: see below.. It is a simple syntax problem, but I havent yet found one reference to handling 'multiple' return parameters from a proc...
 
Read on...
 
The PACKAGE (or proc that needs to be called has 2 OUT params, 2 IN params)
 
PROCEDURE populate_load(
                        errbuf     OUT    VARCHAR2,
                        retcode    OUT    NUMBER,
                        p_org_id   IN     NUMBER,
                        element    IN     VARCHAR2)

So I try to execute following SQLPLUS:
 
variable    errbuf       varchar2
variable    retcode    number
 
execute :errbuf :retcode := apps.mrp_i2_erp.populate_load (errbuf,retcode,3,'set_start_date');
 
print :errbuf;
print :retcode;

I get:

Error:
Oracle8 Enterprise Edition Release 8.0.4.4.0 - Production
PL/SQL Release 8.0.4.4.0 - Production
 
begin :errbuf :retcode := apps.mrp_i2_erp.populate_load(errbuf,retcode,3,'set_start_date'); end;
                 *
ERROR at line 1:ORA-06550: line 1, column 15:
PLS-00103: Encountered the symbol "" when expecting one of the following: := . ( @ % ; indicator
The symbol ";" was substituted for "" to continue.
 
There is something wrong with the output param binding assignment in the execute statement I tried all different ways to execute the procedure to no avail, the manuals/google searches do not explain anything about multiple return parameters, one return parameter is easy..
 
Any ideas?
 
Robert.
 
0
Comment
Question by:rhbleeker
2 Comments
 
LVL 3

Accepted Solution

by:
mgokman earned 50 total points
ID: 6429488
At first, I was quite surprised by the syntax you are using. After checking SQLPlus manual, I realized where your confusion comes from. The manual gives an example with one variable and "stored procedure". This is probably an error in the manual. A stored procedure cannot be referenced in any expression. For this you need a stored function. The value assigned to your bind variable is the return value from stored function. So, you can't use this approach for two variables and you can't use stored procedure in an expression.
However, you could just list those two bind variables in your procedure arguments:
variable    errbuf       varchar2
variable    retcode    number
execute apps.mrp_i2_erp.populate_load (:errbuf,:retcode,3,'set_start_date');
print :errbuf;
print :retcode;

This works

0
 

Author Comment

by:rhbleeker
ID: 6429679
Thanks! This works.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now