CREATE TABLE TEST1(x number, y number);
INSERT INTO TEST1 VALUES (2,5);
COMMIT;
SELECT * FROM TEST1;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
DECLARE
num1 number;
num2 number;
BEGIN
EXECUTE IMMEDIATE ' SELECT x,y FROM TEST1 ' INTO num1, num2;
dbms_output.put_line('X = '||num1);
dbms_output.put_line('Y = '||num2);
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('No hay registros.');
WHEN OTHERS THEN
dbms_output.put_line('Ha ocurrido una excepcion.');
END;
/
Uso de EXECUTE IMMEDIATE en Oracle
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.