user3440567
user3440567

Reputation: 135

Can anyone explain what does this query means?

What would be the output?? And please explain the below coalesce statement.

"COALESCE(NULL, :RG) IS NULL"

Upvotes: 0

Views: 30

Answers (2)

Hrabal
Hrabal

Reputation: 2525

COALESCE returns the first not null value, so if you pass 2 arguments and the first is NULL, you will receive the second one if is not null.

In a where the espression you pasted is equal to :RG IS NULL.

Maybe coalesce is here for some compatibility issue? Just a guess.

Upvotes: 0

Patrick Hofman
Patrick Hofman

Reputation: 156928

The coalesce statement is totally useless. You could also write it like this:

:RG IS NULL

And that simply checks if the :rg parameter passed in is null or not. This would be placed in a where clause or a case switch.

Upvotes: 1

Related Questions