Home » Developer & Programmer » Forms » simple query (10g developer suite, 10g ,win xp)
simple query [message #327205] Sat, 14 June 2008 22:46 Go to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Hi,

It seems that PL/SQL editor does not allow the use subquery so what is the way around?

declare
	a number;


begin
	
select :blk_cupboard.cupboardno into a from dual;	
	
	if not a in ([B]select cupboardno from cupboard[/B]) then



Quote:
error - subquery not allowed in this context.


How can I check if the value entered in the form is present in the base table or not?
Re: simple query [message #327241 is a reply to message #327205] Sun, 15 June 2008 10:43 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hm, perhaps you should read some PL/SQL book.

So, you want to check whether form item's value exists in a table, right? So, why wouldn't you CHECK it? Something like this:
select count(*)
  into l_cnt
  from cupboard
  where cupboardno = :blk_cupboard.cupboardno;

if l_cnt = 0 then 
   ...
It would return 0 if there are no records with such a "cupboardno", or number of records if it exists in a table.

Or, you might use EXISTS as
... where exists (select 'x' from cupboard
                  where cupboardno = :blk_cupboard.cupboardno
                 )
Re: simple query [message #327305 is a reply to message #327241] Mon, 16 June 2008 00:18 Go to previous message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks
Previous Topic: How to get the value of the item
Next Topic: Search not working...
Goto Forum:
  


Current Time: Sun Feb 09 23:31:50 CST 2025