79599693

Date: 2025-04-30 06:55:37
Score: 5
Natty:
Report link

NULL is a single row comparison value - so you can't use it to compare against a result set - only single values. Try using EXISTS:


SELECT P.* FROM TABLE1 P
WHERE NOT EXISTS (SELECT CP.COLUMN1 FROM TABLE2 CP WHERE CP.CAT='PSTATUS')
        OR P.ID IN (SELECT CP.COLUMN1 FROM TABLE2 CP WHERE CP.CAT='PSTATUS')

See here for more details on Exists:
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/EXISTS-Condition.html

and NULL checking : https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Null-Conditions.html

If this doesn't help, please provide more details of the data, with your desired result. HTH< NIck

Reasons:
  • RegEx Blacklisted phrase (2.5): please provide
  • RegEx Blacklisted phrase (1.5): help, please
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Nick Pattman