Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

(how to handle) Oracle sqlplus & Multiple Return Paramters

Posted on 2001-08-27
2
Medium Priority
?
1,970 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
mgokman earned 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

721 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