Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to check result of boolean function in IF condition

ramya_162Feb 25 2016 — edited Feb 25 2016

Hi ALL,

My below function returns BOLLEAN value.

CREATE OR REPLACE FUNCTION func_chk (

         P_cde        in  NUMBER

        )

         RETURN BOOLEAN IS

t_val   NUMBER := 0;

cursor c_ver IS

    select 1

    from tsertbl

     WHERE cde=P_cde;

    

begin

open c_ver;

FETCH c_ver into t_val;

  if c_ver%NOTFOUND  then

      RETURN false;

      else

      return true;

end if;

close c_ver;

END func_chk;

I am calling that function in a IF concondition of a procedure as

IF( v_val and not func_chk(p_sads))

I am getting some exeception is this correct way?

If the function not returning true then only my if condition should execute.

CREATE OR REPLACE PROCEDURE p1(p_sads NUMBER)

IS

v_val NUMBER;

BEGIN

IF( v_val and not func_chk(p_sads)) THEN

do somthing

END iF;

END;

Please help me.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2016
Added on Feb 25 2016
12 comments
4,264 views