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
Messages: 24
Registered: July 2008
Junior Member

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


[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: 65085
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Boolean datatype is not known from SQL.

Re: fuction in my where condition [message #356443 is a reply to message #356410] Thu, 30 October 2008 13:44 Go to previous message
Messages: 21127
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.

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

Current Time: Sun Jul 23 16:11:04 CDT 2017

Total time taken to generate the page: 0.09408 seconds