--返回单条记录单个值 create or replace function get_user_wfl return varchar2 is v_user varchar2(50); begin select name into v_user from test_user_wfl where id='2'; return v_user; end get_user_wfl; --有参函数 CREATE or replace function get_name_wfl(v_id VARCHAR) return VARCHAR is v_name VARCHAR(20); BEGIN SELECT name INTO v_name FROM test_user_wfl where id=v_id; return v_name; EXCEPTION when no_data_found THEN raise_application_error(-20001, '你输入的ID无效!'); END get_name_wfl; --调用 SELECT get_name_wfl(id) from test_user_wfl;