Create and call an oracle function

Submitted by:Jhon Smith

Date added:27 March, 2012

Category:PL SQL

PL/SQL code example to create and call an oracle function

Tags: call function

Code Snippet:

create or replace function "ORACLE_FOO"
(foo_arg1 in NUMBER)
return NUMBER
is
rt NUMBER := 0;
begin
IF foo_arg1 > 1 THEN
SELECT 1 INTO rt;
ELSE
SELECT 2 INTO rt;
END IF;
RETURN (rt);
end;

SELECT ORACLE_FOO(1) FROM dual;
 
 

Comments