Snippet Name: EXISTS
Description: Sample of the use of 'EXISTS' clause in SQL
Also see: » AND Condition
» Distinct
» Having Clause
» EXISTS 2
» WITH with CONNECT BY
» WITH Clause: Single alias
» WITH Clause: Double alias
Comment: (none)
Language:
Highlight Mode: PLSQL
Last Modified: March 01st, 2009
|
SELECT SUBSTR(trx_number,1,10), SUBSTR(trx_type,1,8),
SUBSTR(line_amount,1,8), SUBSTR(line_number,1,8)
FROM ar_invoice_interface_lines a
WHERE EXISTS (SELECT 'x' FROM ar_invoice_interface_headers ah
WHERE ah.trx_number = a.trx_number
AND ah.status = 'Error 114')
AND a.ROWID > (SELECT MIN(b.ROWID) FROM ar_invoice_interface_lines b
WHERE a.trx_number = b.trx_number)
/
|