Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sql question/procedure
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;
> /
>
The CREATE OR REPLACE PROCEDURE test ...
is the declaration.
Get rid of the line with DECLARE and the compile.
Rgds Received on Fri Mar 29 2002 - 10:43:59 CST