Luca C.
Luca C.

Reputation: 12594

oracle select true if not null

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

Answers (1)

Ankit Bajpai
Ankit Bajpai

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

Related Questions