Reputation: 12594
I have to select true in a variable when a field is not null, my attempt is this but does not compile, do you have a working solution?
SELECT CASE blob_data WHEN NULL THEN FALSE ELSE TRUE END
INTO v_blob_found
FROM docs dd
WHERE dd.id=my_id
Upvotes: 6
Views: 10397
Reputation: 13517
You can try somthing like this:-
SELECT CASE WHEN blob_data IS NULL THEN 'FALSE' ELSE 'TRUE' END
INTO v_blob_found
FROM docs dd
WHERE dd.id=my_id
Upvotes: 5