--orahelp.blogspot.com
-- el lenguaje PL/SQL
trigger y cursores
-- [declare opcional
-declaraciones]
-- begin
-instrucciones
create table t1 (e integer, finteger);
begin
Delete from t1;
insert into t1 values(1, 3);
insert into t2 values();
_______________________________________________________________________________________________________
--sentencia IF
declare
a NUMBER;
b NUMBER;
BEGIN
SELECT e,f INTO a.b FROM t1 WHERE e>1;
IF b=1 THEN
INSERT INTO t1 VALUES(b,a);
ELSE
INSERT INTO t1 VALUES(b+10,a+10);
END IF;
END;
________________________________________________________________________________________________________
-- listar desde el 1 al 50 (ciclo)
declare y integer:= 0;
begin
loop
y:= y+1;
dbms_output.put_line('y = '||y);
exit when y =50;
end loop;
end;
No hay comentarios:
Publicar un comentario