Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: function returning boolean in a where clause

Re: function returning boolean in a where clause

From: Tim X <timx_at_spamto.devnul.com>
Date: 18 Jan 2003 10:54:56 +1100
Message-ID: <87ptqvnxgv.fsf@tiger.rapttech.com.au>


>>>>> "Thomas" == Thomas Gaines <Thomas.Gaines_at_noaa.gov> writes:

 Thomas> Ken - You are partially correct. But consider this:

 Thomas> create or replace function foo(c1 in varchar2) return boolean
 Thomas> is begin
 Thomas>   if c1 = '1' then return true; else return false; end if;
 Thomas> end; /

 Thomas> set verify off prompt Enter a value on which to test the  Thomas> function: accept val

 Thomas> set serverout on begin
 Thomas>   if foo('&val') = true then
 Thomas>     dbms_output.put_line('the return from the function is
 Thomas>     true');
 Thomas>   else
 Thomas>     dbms_output.put_line('the return from the function is
 Thomas>     false');
 Thomas>   end if;
 Thomas> end; /

 Thomas> Conclusion: It is possible to do it, but only when the  Thomas> function is used under certain circumstances.

But the OP was asking if a function returning a boolean can be used in a where clause - this would be one of those circumstances where it can't be wouldn't it? Its obvious you can use it with other pl/sql functions/procedures, otherwise, what would be the point of having the boolean as a type (as opposed to just 'true/false' predicates).

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
Received on Fri Jan 17 2003 - 17:54:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US