problema com while
gostaria de usar o while pegando um campo da tabela mas deste jeito nao funciona:
WHILE TABELA.CAMPO < 100 LOOP
INSERT INTO TABELA(CAMPO) SELECT MAX(CAMPO) + 1 FROM TABELA;
END LOOP;
ME AJUDEM...!!!
WHILE TABELA.CAMPO < 100 LOOP
INSERT INTO TABELA(CAMPO) SELECT MAX(CAMPO) + 1 FROM TABELA;
END LOOP;
ME AJUDEM...!!!
Stgmta
Curtidas 0
Respostas
Motta
30/03/2007
+- isto
declare vn number; begin select max(campo) + 1 into vn from tabela; -- for i in 1..100 loop insert into tabela (campo) values (vn+1); end loop; end;
GOSTEI 0
Arf
30/03/2007
Mais ou menos assim:
begin
for i in ( select <campo> from <tabela> where <condição>´ ) loop
execute immediate ´insert into <tabela> ´ || i.max(campo)||´+1´;
end loop;
end;
/
PS: Código não testado.
ARF.
begin
for i in ( select <campo> from <tabela> where <condição>´ ) loop
execute immediate ´insert into <tabela> ´ || i.max(campo)||´+1´;
end loop;
end;
/
PS: Código não testado.
ARF.
GOSTEI 0
Motta
30/03/2007
insert into tabela (campo) values (vn+ i );
GOSTEI 0