CREATE OR REPLACE PROCEDURE νλ‘μμ μ΄λ¦
( 맀κ°λ³μ μ΄λ¦1 [ IN / OUT / IN OUT ] λ°μ΄ν° νμ
,
맀κ°λ³μ μ΄λ¦2 [ IN / OUT / IN OUT ] λ°μ΄ν° νμ
, )
IS / AS
λ³μ λ° μμ μ μΈ
BEGIN
μ€ν λ¬Έμ₯
EXCEPTION λ¬Έμ₯
END;
EXECUTE νλ‘μμ μ΄λ¦();
EXEC νλ‘μμ μ΄λ¦();
-> returnκ° μμ
μ¬μ©μκ° λ§λ ν¨μμ΄λ©° μ΄λ€ μ°μ°μ μνν λ€ κ²°κ³Όκ°μ λ°ννλ€.
νμ)
CREATE OR REPLACE FUNCTION ν¨μλͺ
(νλΌλ―Έν°,..)
RETURN 리ν΄ν
IS
λ³μμ μΈ;
BEGIN
μ€νλ¬Έμ₯;
..
RETURN κ°;
END;
/
μ1) μ
λ ₯λ°μ κ°μΌλ‘λΆν° 10%μ μΈμ¨μ ꡬνλ ν¨μ
CREATE OR REPLACE FUNCTION TAX(N NUMBER)
RETURN NUMBER
IS
VAL NUMBER(10,3);
BEGIN
VAL:=N*0.1;
RETURN VAL;
END;
/
SELECT TAX(1000) FROM DUAL;