Skip to content
Advertisement

SQL Custom Function is not returning data as expected by matching to my conditions

I am trying to create this function but null values fail

But some of the conditions are not working, specially when I am passing null calls that are not giving expected results are:

Expecting above to return (‘REVIEWED’, -2) while I am getting nothing

Expecting above to return ( , -2) while I am getting nothing

Expecting above to return (‘IN_PROGRESS’, 11) while I am getting (“NO MATCH”, -4)

In simple words the following is what I am trying to achieve A SQL function that takes in

And returns the following based on conditions

Advertisement

Answer

I explain null case only. Your code working as intended. If you not sure. just copy paste all the work in sql fiddle.
demo

will return

BECAUSE: This execution meet predicate:


will get

BECAUSE It meet predicate

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