Re: Question? How to Execute an SP through SQLPlus that Returns an Out Value

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 6 Apr 2001 06:53:26 +0200
Message-ID: <tcqiq83t5ma637_at_beta-news.demon.nl>


[Quoted] "Ray Vonhollen" <RVONHOLLEN_at_pacbell.net> wrote in message news:3ACD2488.7B1CFB4B_at_pacbell.net... [Quoted] I have a procedure as follows, and want to know how to execute it through SQL*PLus to return my OUT Value.
[Quoted] I've tried all sort of syntactical representations to no avail! EXEC SP_HIGHTESTVAL(6700,119,10,0);
I keep getting errors: PLS-00363: expression '0' cannot be used as an assignment target.
[Quoted] Any help or reference materials available on this would be greatly appreciated.
R -
CREATE OR REPLACE PROCEDURE SP_HIGHESTVAL

[Quoted] (M_ID IN NUMBER,
 F_ID  IN NUMBER,
 F_E IN NUMBER,

 NEW_VAL OUT NUMBER)
AS
 BEGIN
  NEW_VAL := 0;
 IF F_E = 10 Then

    SELECT (MAX(M.VAL)+1) INTO NEW_VAL

        FROM  MYFILE M
     WHERE ((M.ID= M_ID) AND

(M.FID = F_E));

  END IF;
 IF F_E = 20 Then

    SELECT (MAX(O.VAL)+1)

       FROM  OTHERF O
     WHERE ((O.ID = M_ID) AND

(O.FID = F_E));

   END IF;
END; By design in *any* programming language, the actual parameter to a formal out parameter needs to be a *variable* instead of a *hardcoded literal* (in your case 0)

Could also avoid posting in HTML. Many newsreaders can't read it.

Hth,

Sybrand Bakker, Oracle DBA Received on Fri Apr 06 2001 - 06:53:26 CEST

Original text of this message