Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Programming Procedure
Stan, try
CREATE PROCEDURE AVGBALANCE (i_state CHAR(22)) <===== name change
RETURNS (AVG_AMOUNT FLOAT)
AAS
BEGIN
SELECT AVG(BALANCE_DUE) FROM CUSTOMER
WHERE STATE = i_state INTO AVG_AMOUNT; <===== name change
SUSPEND;
END;
bind variables are not required in PL*SQL. I changed the name to avoid
confusion (and interesting results) in the where clause.
HTH
James
In article <3703E19A.50845BB1_at_yahoo.com>,
Delphi Dev <delphidev_at_yahoo.com> wrote:
>
> --------------711C4FD334AD3847756E42B7
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> I have the following in an ascii file. I then go into SQL plus and do a
> File Open. Then I do a run. I get an Bind variable "STATE" not
> declared. Is this the proper way of programing procedures into the
> Server?
>
> Thanks, Stan
>
> SET TERM !!;
> CREATE PROCEDURE AVGBALANCE (STATE CHAR(22))
> RETURNS (AVG_AMOUNT FLOAT)
> AAS
> BEGIN
> SELECT AVG(BALANCE_DUE) FROM CUSTOMER
> WHERE STATE = :STATE INTO AVG_AMOUNT;
> SUSPEND;
> END; !!
> SET TERM; !!
>
> --------------711C4FD334AD3847756E42B7
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <HTML>
> I have the following in an ascii file. I then go into SQL plus and
> do a File Open. Then I do a run. I get an <B>Bind variable
> "STATE" not declared. </B>Is this the proper way of programing
procedures
> into the Server?
>
> <P>Thanks, Stan
> <BR>
>
> <P>SET TERM !!;
> <BR>CREATE PROCEDURE AVGBALANCE (STATE CHAR(22))
> <BR>RETURNS (AVG_AMOUNT FLOAT)
> <BR>AAS
> <BR>BEGIN
> <BR> SELECT AVG(BALANCE_DUE) FROM CUSTOMER
> <BR> WHERE STATE = :STATE INTO AVG_AMOUNT;
> <BR> SUSPEND;
> <BR>END; !!
> <BR>SET TERM; !!
> <BR> </HTML>
>
> --------------711C4FD334AD3847756E42B7--
>
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Apr 01 1999 - 16:21:30 CST
![]() |
![]() |