Back to Browse

| Oracle Boolean Data type | Function Restriction of Boolean Data type | Oracle Interview Question

1.7K views
Premiered Dec 22, 2019
6:05

In this video we will see the use of Boolean Data type and its use in Function and Restriction of Function during the use of Boolean Data type. Scripts Are Given Below --------------------------------------- Use Of Boolean Datatype in Oracle ----------------------------------------------------------- - Boolean data type can store only two values such are "true"/"false" - If we create a function whose return type is Boolean type, then we can't directly call it in "SELECT" statement. - But we can call it in another Subprogram/Anonymous block CREATE OR REPLACE FUNCTION is_emp_available ( p_empno IN NUMBER ) RETURN BOOLEAN AS v_rec_cnt NUMBER DEFAULT 0; BEGIN SELECT COUNT(1)INTO v_rec_cnt FROM emp WHERE empno = p_empno; IF ( v_rec_cnt = 0 ) THEN RETURN false; ELSE RETURN true; END IF; EXCEPTION WHEN OTHERS THEN RETURN false; END; select is_emp_available(7369) from dual; set serveroutput on; declare v_output boolean; v_empno number; begin v_empno:=7369; v_output:=is_emp_available(v_empno); if(v_output=true) then dbms_output.put_line('Employee no '||v_empno||' is available in the emp table'); elsif(v_output=false) then dbms_output.put_line('Employee no '||v_empno||' is not available in the emp table'); end if; end; / LIKE THE FACEBOOK PAGE - https://www.facebook.com/Oracle-Tutorials-108483330680405/ FOLLOW ON Instagram - https://www.instagram.com/nihar8308/ FOLLOW ON LinkedIn - https://www.linkedin.com/company/oracle-tutorials/?viewAsMember=true FOLLOW ON TWITTER - https://twitter.com/NIHARRA59094760 Email Id: [email protected] Phone No- 8018319781 #Boolean_Datatype #Oracle_Function_Restriction #Oracle_SQL_PLSQL_Feature

Download

0 formats

No download links available.

| Oracle Boolean Data type | Function Restriction of Boolean Data type | Oracle Interview Question | NatokHD