I want to use a variable in when clause of oracle sql like below
DEFINE balancing_id = 0--'16493'--null;
ON A.BALANCING_ID =
CASE
WHEN &balancing_id is null-- &balancing_id = ''--balancing_id>0
THEN B.BALANCING_ID
ELSE &balancing_id
END
But I get the error below :
ORA-00920: invalid relational operator
00920. 00000 - "invalid relational operator"
*Cause:
*Action:
this line:
>WHEN &balancing_id is null-- &balancing_id = ''--balancing_id>0
UPDATE:
> WHEN 1 = 1
works as expected
How to use variable like this?
Asked by guradio
(95 rep)
Jul 5, 2023, 07:19 AM
Last activity: Jul 15, 2023, 04:24 PM
Last activity: Jul 15, 2023, 04:24 PM