To allow an Super User/Admin to log in to my system, I am running (a larger version of) this query:
Select *
From mytable
Where (:id = 'Admin' Or :id = mytable.id);
If I pass a user id I get all the data for that user; if I pass the string 'Admin' I get all the data. This works because Oracle's OR is a short-circuit operator.
However, if I make 'Admin' a package constant and get it with a function, like this
Select *
From mytable
Where (:id = mypackage.GetAdminConstant Or :id = mytable.id);
I get ORA-01722: invalid number
when I pass 'Admin'.
Why does OR lose its short-circuit aspect when I introduce a function?