Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sql question/procedure

Re: sql question/procedure

From: damorgan <damorgan_at_exesolutions.com>
Date: Thu, 21 Mar 2002 22:22:34 GMT
Message-ID: <3C9A5D2B.8AF7994E@exesolutions.com>


Drop the word declare ... it is a stored procedure and is totally unnecessary (but if you insist on using it for some reason it must come after IS not after you've declared some variables.

Daniel Morgan

Erica wrote:

> Hi,
>
> I am trying to do some self education and I am pretty much stuck. TOAD
> is complaining about that the DECLARE is not correct and I am curious
> if someone out there can spot where I have missed out on some syntax.
> I am lost.
>
> Thanks, I appreciate it!
>
> Erica
> CREATE OR REPLACE PROCEDURE test (P_FYLLD IN NUMBER, P_KURS OUT
> VARCHAR2)
> IS
> STUDENTID NUMBER;
> VAL VARCHAR2;
> P_FYLLD BOOLEAN;
>
> DECLARE
> CURSOR stud_cursor IS
> select studentid, val1, val2, val3, total from student;
> stud_rec stud_cursor%ROWTYPE;
> BEGIN
> DELETE from antagen;
> DELETE from reserv;
> DELETE from ej_vald;
> OPEN stud_cursor;
>
> <<first_loop>>
> FOR i in 1..50
> LOOP
> FETCH stud_cursor INTO stud_rec;
> EXIT WHEN stud_cursor%NOTFOUND;
> IF KURS_FYLLD(stud_rec.val1) = TRUE THEN
> INSERT INTO ANTAGEN values (studentid, VAL1);
> ELSE
> INSERT INTO RESERV values (studentid, val1);
> DBMS_OUTPUT.put_line('i = '||i);
> GOTO first_loop;
> END LOOP;
> end;
> /
Received on Thu Mar 21 2002 - 16:22:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US