DECLARE
…
BEGIN
…
EXCEPTION
…
END;
Stored Program Units
--------Prozedur --------
CREATE PROCEDURE <procedure_name>
(p_parameter1 IN <typ>, p_parameter2 OUT <typ>, p_parameter2 IN OUT <typ>)
IS/AS
<Deklarationen>
BEGIN
…
EXCEPTION
…
END <procedure_name>;
--------Funktion --------
CREATE FUNCTION <function_name> (p_parameter1 IN <typ>, p_parameter2 OUT <typ>, p_parameter2 IN OUT <typ>)
RETURN <typ>
IS/AS
<Deklarationen>
BEGIN
…
RETURN <ausdruck>
EXCEPTION
…
END <function_name>;
--------Aufrufe --------
VARIABLE v_<name> <TYP>
EXECUTE :v_<name> := <function_name>(<value>)
DECLARE v_<name> <TYP>;
BEGIN
v_<name> := <function_name>(<value>)
END;
EXECUTE dbms_output.put_line(<function_name>(<value>));
SELECT <function_name>(<value>)
FROM <tabelle>;
select mytools.get_Value(5) from dual;
Beispiel:
select mytools.get_Value(5) from dual;