Condition On WHERE Clause

oracle

I need to add a condition on the WHERE clause such that when sevnum is not null then relate the tables by premnum and sevnum. However, the code below returns an error.

SELECT *
FROM prem c, tempTable t
WHERE 
  CASE WHEN t.sevnum IS NOT NULL 
     THEN t.premnum = c.premnum
     AND t.sevnum = c.sevnum
  END
;

Best Answer

WHERE (    t.sevnum IS NOT NULL 
       AND t.premnum = c.premnum 
       AND t.sevnum = c.sevnum) 
/* OR (t.sevnum IS NULL) */