Home » SQL & PL/SQL » SQL & PL/SQL » ref cursor to return boolean value  () 1 Vote
ref cursor to return boolean value [message #201852] Tue, 07 November 2006 01:38 Go to next message
gvs143
Messages: 1
Registered: November 2006
Location: a
Junior Member

friends,
i have a constraint in my procedure,
for some reasons my out parameter can only be a ref cursor.
but i have to just say whether true or false as output.
how can i do it using ref cursor

-gvs143
Re: ref cursor to return boolean value [message #201889 is a reply to message #201852] Tue, 07 November 2006 04:07 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
("True or false" = Boolean) <> sys_refcursor

Now which one is it: Boolean or refcursor? Otherwise, I'm afraid you'll get "expression is of wrong type". Or maybe not?
Re: ref cursor to return boolean value [message #201893 is a reply to message #201852] Tue, 07 November 2006 04:29 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
Can someone explain to me why people who post on these forums always seem to have some ludicrous constraint on what they can develop. Why can the procedure only take an REFCURSOR parameter ? Why can't it have another parameter, say a BOOLEAN, as well ? Is development using Oracle all a bit too easy, so we have to add some absurd restriction in order to make it more challenging ?

[Updated on: Tue, 07 November 2006 04:32]

Report message to a moderator

Re: ref cursor to return boolean value [message #201895 is a reply to message #201893] Tue, 07 November 2006 04:33 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
LOL

So true Cthulhu! I often wonder that myself.
Still waiting for the ultimate question: I want to select a row from EMP, but I do not want to use the SELECT keyword..
Re: ref cursor to return boolean value [message #201926 is a reply to message #201895] Tue, 07 November 2006 07:33 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
That's do-able
declare
  v_empno  emp.empno%type;
  v_deptno emp.deptno%type;
BEGIN
  UPDATE EMP
  set    ename = ename
  where ename = 'Brown'
  returning empno,deptno into v_empno,v_deptno;
end;


Doing it in straight SQL might be more of a challenge though.....
Re: ref cursor to return boolean value [message #201929 is a reply to message #201852] Tue, 07 November 2006 07:44 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
You could write an update statement and then have a update trigger that returns the data using a RAISE_APPLICATION_ERROR (or writes it to an external table, which you then read using a shell script).

At any rate, it's probably easier than trying to have a variable type which acts as a REF CURSOR and a BOOLEAN at the same time.
Re: ref cursor to return boolean value [message #201946 is a reply to message #201929] Tue, 07 November 2006 08:47 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Ah, but I forgot to mention I also don't want to use WHERE

Edit: or IF or CASE or DECODE ...

[Updated on: Tue, 07 November 2006 08:48]

Report message to a moderator

Previous Topic: ORA-01722 in Bulk Bind
Next Topic: automatically populate UID field
Goto Forum:
  


Current Time: Sat Dec 03 08:09:00 CST 2016

Total time taken to generate the page: 0.09401 seconds