19-1:建立无参数的函数 CREATE OR REPLACE FUNCTION cur_datetime	RETURN VARCHAR2	IS	BEGIN	RETURN TO_CHAR(sysdate,	'YYYY"年"MM"月"DD"日"HH24"时
19-1:建立无参数的函数
CREATE OR REPLACE FUNCTION cur_datetime
RETURN VARCHAR2
IS
BEGIN
RETURN TO_CHAR(sysdate,
'YYYY"年"MM"月"DD"日"HH24"时"MI"分"SS"秒"');
END;
19-2:建立带有输入参数的函数
CREATE OR REPLACE FUNCTION get_sal(name VARCHAR2)
RETURN NUMBER
AS
v_sal emp.sal%TYPE;
BEGIN
SELECT sal INTO v_sal FROM emp WHERE upper(ename)=upper(name);
RETURN v_sal;
END;
19-3:建立带有输出参数的函数
CREATE OR REPLACE FUNCTION get_info
(eno NUMBER,title OUT VARCHAR2) RETURN VARCHAR2
AS
name emp.ename%TYPE;
BEGIN
SELECT ename,job INTO name,title FROM emp
WHERE empno=eno;
RETURN name;
END;
19-4:建立带有输入输出参数的函数
CREATE OR REPLACE FUNCTION get_upd_info
(eno NUMBER,sal_chg IN OUT NUMBER) RETURN VARCHAR2
AS
name emp.ename%TYPE;
BEGIN
UPDATE emp SET sal=sal+sal_chg WHERE empno=eno
RETURNIN