Re: stored procedure purgatory

From: rich <richard.rubinstein.nospam_at_ihsenergy.com>
Date: Thu, 23 Nov 2000 12:52:33 -0000
Message-ID: <3a1d23c4$1_at_news.star.co.uk>


Firstly, the cursor is a declaration and must appear before opening the BEGIN-END scope. Having moved your cursor declaration, you will, of course, have nothing left between the BEGIN and END statements which will also generate a compile time error. I assume you will be doing something with the data returned by the cursor, and this code will be placed within the BEGIN and END. If you're just doing this to experiment and you just want to try and compile the procedure you could place the statement NULL; in place of any other processing.

ie your procedure would end up as below.

CREATE OR REPLACE PROCEDURE sumCost(passedInPmwrkord_code IN VARCHAR2) AS
CURSOR get_wo_acct_num_cur IS
 SELECT a.pmwrkord_code, a.description, SUM(b.cost)  FROM pmwrkord a, pmtimed b
WHERE a.pmwrkord_code = b.pmwrkord_code
AND a.pmwrkord_code = passedInPmwrkord_code GROUP BY a.pmwrkord_code, a.description;

   BEGIN
     NULL;
   END; HTH Rich

newguysanfran_at_my-deja.com wrote in message <8vhjo1$d5b$1_at_nnrp1.deja.com>...
>Hey all,
>
>
> I can't get this to work. I'm new at PL/SQL so please forgive
>me but what's wrong with this:
>
> CREATE OR REPLACE PROCEDURE sumCost(passedInPmwrkord_code IN
>VARCHAR2) AS
> BEGIN
> CURSOR get_wo_acct_num_cur IS
> SELECT a.pmwrkord_code, a.description, SUM(b.cost)
> FROM pmwrkord a, pmtimed b
> WHERE a.pmwrkord_code = b.pmwrkord_code
> AND a.pmwrkord_code = passedInPmwrkord_code
> GROUP BY a.pmwrkord_code, a.description;
> END;
>
>Toad tells me:
>PLS-00103: Encountered the symbol "GET_WO_ACCT_NUM_CUR" when expecting
>one of the following:
>
> := . ( _at_ % ;
>PLS-00103: Encountered the symbol "END" when expecting one of the
>following:
>
> begin function package pragma procedure subtype type use
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Thu Nov 23 2000 - 13:52:33 CET

Original text of this message