marcos j
marcos j

Reputation: 37

PLS-00103: Encountered the symbol "FOR" when expecting one of the following:

**hello I'm trying to do a FOR loop in oracle but it throws the following error

ORA-06550: line 6, column 1: PLS-00103: Encountered the symbol "FOR" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset The symbol ";" was substituted for "FOR" to continue.**

DECLARE
PROV number;
RAN_PRICE NUMBER;

begin
prov := 1
for loop_one in 1..10 
loop

FOR LOOP_two IN 1..5   
LOOP

SELECT (1+ABS(MOD(dbms_random.random,1800)))into RAN_PRICE FROM dual;
INSERT INTO marcos.PRODUCTO
VALUES(SEQ_PRODUCTO.nextval, 'Producto_'||PROV,RAN_PRICE,PROV);
END LOOP ;

PROV := PROV+ 1;
end loop ;

commit; 
EXCEPTION
WHEN OTHERS THEN
      dbms_output.put_line('Se ha producido un error') ;
rollback;               
end;

Upvotes: 1

Views: 5972

Answers (1)

Mureinik
Mureinik

Reputation: 311308

You are missing a semi-colon (;) at the end of prov's initialization:

prov := 1;
-- Here -^

Upvotes: 0

Related Questions