| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: sql question/procedure
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
![]() |
![]() |