Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Not sure what I am doing wrong.

SQL##f - SqlState: S1000, ErrorCode: 920, ErrorMsg: [Oracle][ODBC][Ora]ORA-00920: invalid relational operator

SQL SELECT
     corekey AS "corekey",
     coreid AS "coreid",
     coreconst AS "coreconst",
     corebrthyr AS "corebrthyr",
  corebrthmn AS "corebrthmn",
  corebrthdy AS "corebrthdy",
  coreprefyr AS "coreprefyr",
  coreprfsch AS "coreprfsch"
FROM corebio_full

WHERE not exists (select attrid,attrtype from attribute_full where attrid = coreid and attrtype in ('dnm','dnc','BOT','FBoD'))
AND not exists (select deathid from  death_full where deathid = coreid)
AND not exists (select phnid,phnnumber from phone_full where phnid = coreid and isnull(phnnumber))

I am trying to get rid of any records that do not have a phone number

5 Replies
maxgro
MVP
MVP

From a syntax point of view I think isnull doesn't exist in Oracle

Try with NVL

prieper
Master II
Master II

EXISTS is neither a valid syntax in SQL

Script may work with preceding load (where then the QV-commands are available):

LOAD


     corekey AS "corekey",
     coreid AS "coreid",
     coreconst AS "coreconst",
     corebrthyr AS "corebrthyr",
  corebrthmn AS "corebrthmn",
  corebrthdy AS "corebrthdy",
  coreprefyr AS "coreprefyr",
  coreprfsch AS "coreprfsch"

WHERE not exists (select attrid,attrtype from attribute_full where attrid = coreid and attrtype in ('dnm','dnc','BOT','FBoD'))

AND not exists (select deathid from  death_full where deathid = coreid)
AND not exists (select phnid,phnnumber from phone_full where phnid = coreid and isnull(phnnumber));

SQL SELECT * FROM ....

HTH Peter

manojkvrajan
Luminary
Luminary

Tammy - I am with Massimo. Please try NVL.

maxgro
MVP
MVP

exists (<subquery>)

and

not exists (<subquery>)

is a valid Oracle (and sql) syntax

prieper
Master II
Master II

@ Massimo: you are correct, did not read the syntax carefully enough

Peter