Home » Developer & Programmer » Forms » How to append a query in where clause of existing query
How to append a query in where clause of existing query [message #687834] Sat, 24 June 2023 04:45 Go to next message
irfankundi786
Messages: 4
Registered: July 2011
Location: pakistan
Junior Member
In oracle form i have a query just like

[if po_no is not null then
str := str ||'and po_no = '||:block.po_no;
end if;
now i want to append the str in below query.
select po_no
from po,
     po_det
where po_id = p_det_id
     &str]

i want to append the str in end of query but it gives ora-01722 error ..how i can do in right way..
Re: How to append a query in where clause of existing query [message #687890 is a reply to message #687834] Wed, 12 July 2023 12:43 Go to previous messageGo to next message
c2oncpr
Messages: 5
Registered: December 2011
Junior Member
provide usage details.

I can't imagine anywhere where this would be legal.
Re: How to append a query in where clause of existing query [message #687893 is a reply to message #687890] Wed, 12 July 2023 16:09 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Code you wrote looks like Oracle Reports. That tool lets you use substitution variable in query, and it works just fine.

But, this is Oracle Forms and - as far as I can tell - such a syntax isn't allowed here. It means that you'll either have to use two different queries (one for IF, and another for ELSE), or try to rewrite code so that everything is done in the same query. Something like this:

select po_no
from po, po_det
where po_id = p_det_id
  and (po_no = :block.po_no or po_no is null)
Previous Topic: Language
Next Topic: Forms cannot distinguish between mouse-click and mouse-doublclick
Goto Forum:
  


Current Time: Sat Apr 27 07:19:03 CDT 2024