Functions in PL/SQL
function definition
CREATE OR REPLACE FUNCTION larger_date(
iv_number IN DATE,dt IN DATE)
RETURN DATE IS
d date;
BEGIN
IF iv_number > dt THEN d :=iv_number -7;
ELSE
d :=dt;
END IF ;
RETURN d;
END;
How to call in SQL
SELECT larger_date
(sysdate-1,sysdate+1)
FROM DUAL;
No comments:
Post a Comment