日期:2014-05-17 浏览次数:20978 次
CREATE OR REPLACE FUNCTION id_is_good (i_student_id IN NUMBER) RETURN BOOLEAN AS v_id_cnt NUMBER; BEGIN SELECT COUNT(*) INTO v_id_cnt FROM student WHERE student_id = i_student_id; RETURN 1 = v_id_cnt; EXCEPTION WHEN OTHERS THEN RETURN FALSE; END id_is_good;
1 declare 2 v_local_first_name student.first_name%type; 3 v_local_last_name student.last_name%type; 4 rst BOOLEAN ; 5 begin 6 rst := id_is_good(&sv,v_local_first_name, v_local_last_name); 7 dbms_output.put_line(rst); 8 end;
--如果需要打印,可以这样 if rst then dbms_output.put_line('TRUE'); else dbms_output.put_line('FALSE'); end if;