Home » SQL & PL/SQL » SQL & PL/SQL » fuction in my where condition (10g)
fuction in my where condition [message #356410] Thu, 30 October 2008 11:32 Go to next message
georges.choueiry
Messages: 24
Registered: July 2008
Junior Member
hi,

can i use a boolean function un my where condition or it is impossible.

sincerely

[Updated on: Thu, 30 October 2008 11:35]

Report message to a moderator

Re: fuction in my where condition [message #356411 is a reply to message #356410] Thu, 30 October 2008 11:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64106
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Boolean datatype is not known from SQL.

Regards
Michel
Re: fuction in my where condition [message #356443 is a reply to message #356410] Thu, 30 October 2008 13:44 Go to previous message
Littlefoot
Messages: 20892
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why didn't you try?

This is a function which returns Boolean:
SQL> create function fun_test return boolean
  2  is
  3  begin
  4    return (true);
  5  end;
  6  /

Function created.

Your idea: use it in the WHERE clause:
SQL> select * From dept where fun_test;
select * From dept where fun_test
                                *
ERROR at line 1:
ORA-00920: invalid relational operator

Use it in PL/SQL block:
SQL> begin
  2    if fun_test then
  3       dbms_output.put_line('Function returns TRUE');
  4    end if;
  5  end;
  6  /
Function returns TRUE

PL/SQL procedure successfully completed.

Happy?
Previous Topic: What am I doing wrong? Alias ...
Next Topic: Getting ORA-0060 Dead lock error
Goto Forum:
  


Current Time: Mon Dec 05 02:52:02 CST 2016

Total time taken to generate the page: 0.13897 seconds