So lets say i have a query like this
SELECT a as d,b,c FROM myTable
WHERE a=1;
Is it possible instead of
a=1 to type something like SELECTED.1 = 1 or to somehow extract allias original name since d=1 doesn’t work
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not possible to do this because of internal complexities about when the WHERE clause gets evaluated. But if the thing you are aliasing is a long expression that you’d rather not repeat, there is a typical solution to this. From https://forums.oracle.com/forums/thread.jspa?threadID=1107532:
In your example case, that would be:
But of course, this wouldn’t make sense in your literal example. If the thing you are aliasing is just a column name, then just use the actual column name in the WHERE, no real drawback in that case.
Also note that if you do use this method, you should put as much of the WHERE clause as you can in the internal query (meaning the parts that don’t reference an aliased column) to limit the size of the resulting aliased table. For example, if you also wanted to test on
bin your example, that would be: