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

From: Matt B. <mcb_at_ds.znet.com>
Date: Sat, 7 Apr 2001 22:47:09 -0700
Message-ID: <tcvuqo5enk8i9b_at_corp.supernews.com>


"Ray Vonhollen" <RVONHOLLEN_at_pacbell.net> wrote in message news:3ACD2488.7B1CFB4B_at_pacbell.net...
> I have a procedure as follows, and want to know how to execute it through
 SQL*PLus to return my OUT Value.
> 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.
>
> Any help or reference materials available on this would be greatly
 appreciated.
>
> R -
>
> CREATE OR REPLACE PROCEDURE SP_HIGHESTVAL
> (M_ID IN NUMBER,
> F_ID IN NUMBER,
> F_E IN NUMBER,
> NEW_VAL OUT NUMBER)
> AS
> BEGIN
>
> NEW_VAL := 0;
That's the problem right there.

NEW_VAL is defined as an OUT and therefore cannot be modified. Either define it as an IN OUT or leave it as an out but do not modify it.

To execute a SP in SQL*Plus and see the value of a variable, write a small block of PL/SQL code that calls your SP and then use DBMS_OUTPUT.PUT_LINE to output the variable's value. Don't forget to turn on serveroutput first.

-Matt Received on Sun Apr 08 2001 - 07:47:09 CEST

Original text of this message