How to use the PLSQL exists function
Author: David Nishimoto
Rating:
Rate this Resource
Visits: 3473
Discuss in Newsgroups
Function:Exists
Description:Exists can be used
in a sql to determine if a subquery returns
results.
Example
Exists with a select
01> select field1 from table1 a where
02> exists (select '' from table2 b where a.field1=b.field1)
02> The subquery produces a recordset if field1 of table1
is equal to field1 of table2. 01> Then displays
field1 records from table1 that produce a subquery
result.
Exists with a update
01> update table1 set field1='abc' where
02> exists (select '' from table2 b where a.field1=b.field1)
02> The subquery produces a recordset if field1 of table1
is equal to field1 of table2. 01> Table1 updates
field1 with the value 'abc' for all records from table1
that produce a subquery result.
Visit my guru profile
Visitor Comments
Be the first to rate this article!