CREATE OR REPLACE PACKAGE PACK1
IS
FUNCTION SUMA(V1 NUMBER, V2 NUMBER)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY PACK1
IS
FUNCTION SUMA(V1 NUMBER, V2 NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN V1 + V2;
END SUMA;
END PACK1;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
DECLARE
x NUMBER;
Y NUMBER;
RESULTADO NUMBER;
BEGIN
x:=3;
y:=6;
RESULTADO := PACK1.SUMA(x,y);
dbms_output.put_line('Suma: '||TO_CHAR(RESULTADO));
END;
/
DROP PACKAGE pack1;
SELECT * FROM USER_OBJECTS WHERE OBJECT_TYPE = 'PACKAGE'
AND OBJECT_NAME = 'PACK1';
SELECT text FROM USER_SOURCE WHERE name = 'PACK1'
order by line;
Ejemplo de PACKAGE en PL/SQL
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.