Home » SQL & PL/SQL » SQL & PL/SQL » How to use a boolean returned function in a query
icon2.gif  How to use a boolean returned function in a query [message #237630] Tue, 15 May 2007 04:49 Go to next message
manoj_vilayil
Messages: 9
Registered: May 2007
Location: India
Junior Member
Sir,
I have some stored functions which returns boolean.When i use it in a query(case or decode) it will shows some errors.
How can i slove it.Please reply it immediately.
Re: How to use a boolean returned function in a query [message #237631 is a reply to message #237630] Tue, 15 May 2007 04:52 Go to previous messageGo to next message
Michel Cadot
Messages: 64117
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't use BOOLEAN datatype in Oracle SQL as it is not known.
You can only use it in PL/SQL.

Regards
Michel
Re: How to use a boolean returned function in a query [message #237634 is a reply to message #237630] Tue, 15 May 2007 05:00 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
manoj_vilayil wrote on Tue, 15 May 2007 11:49
Please reply it immediately.

Please don't do that.
If you want immediate answers, or priority over other users, start paying us.

As Michel said, you cannot use booleans in sql, but you can write a wrapper function that returns a string value of your boolean.
eg
create or replace function your_bool
( p_param1 in number
) return boolean
is 
  l_var1 number;
begin
  return p_param1 > l_var1;
end your_bool;
/

create or replace function your_bool_for_sql
( p_param1 in number
) return varchar2
is
begin
  return case when your_bool(x) then 'TRUE'
              when not your_bool(x) then 'FALSE'
              else 'NULL'
         end;
end your_bool_for_sql;
/
Previous Topic: Simple Trigger Help Needed
Next Topic: More than one recordset in a procedure
Goto Forum:
  


Current Time: Tue Dec 06 04:19:28 CST 2016

Total time taken to generate the page: 0.11396 seconds