Skip to content
Advertisement

IS NULL in CASE in predicates

tell me pls, that’s real – use the CASE construct, where the expression with IS NULL/IS NOT NULL will be returned in TNEN? I have a procedure in a package that receives an input parameter and it is passed to the selector in cursor, which I want to set one of the predicates:

input_parm – is the parameter entering the procedure

  • if input_parm=Y then the t1.id field is not equal null
  • if input_parm=N then the t1.id field is equal null
  • if input_parm is null then this this condition should not be taken into condition, those selector should be both from IS NULL and IS NOT NULL
  • if input_parm IS NOT NULL and !=’Y’ and !=’N’ then t1.id=input_parm

In the example the compiler swears at IS NULL after THEN. Can you help me plz?

Advertisement

Answer

The predicates of a CASE expression (i.e. what follows THEN and ELSE) must be literal values, not boolean expressions. You may refactor your CASE expression as:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement