Oracle/PL/SQL

15일차 # 2-11

Bohemian life 2012. 4. 24. 22:07

# 2-11 : 이 페이지의 요구사항을 만족시키지 못하는 함수는 SQL 문장에 사용할 수 없다.


  create or replace function uf_sal_check (a number) return boolean

  is

  begin

    if a <= 3000 then

      return true;

    else

      return false;

    end if;

  end;

  /


  select empno, sal, uf_sal_check(sal)    --> ORA-06553: PLS-382: expression is of wrong type

  from emp;

==> boolean은 SQL data type이 아닙니다



  begin

     if uf_sal_check(a => &up_sal) then

       p('Good!');

     else

       p('Bad!');

     end if;

  end;

  /