I am executing the below query and using alias name for all columns. I have named alias with a . since that is a requirement. now, I want to refer to the alias name directly
You already know you can't use the alias in the where clause, but that only applies in the same level of SQL. You can wrap your query in an outer query:
SELECT *
FROM (
SELECT pt.prod_desc AS"PROD_DESC",
...
END)AS ".PRNT_PROD_DESC"
FROM dims_prod_type pt
)
WHERE ".PRNT_PROD_ID" like 'A%';
The only alternative would be to repeat the whole case
that generates that column in the where
clause, which would be unpleasant with something so complicated.
Replace "PT".".PRNT_PROD_ID" by "PT"."PRNT_PROD_ID" or for a better understanding by pt.prnt_prod_id
Put the query in a subquery, then you can refer to the aliases in your where clause, e.g.:
SELECT * FROM (
SELECT pt.prod_desc AS"PROD_DESC",
...etc...
FROM dims_prod_type pt) pt
WHERE pt.".PRNT_PROD_ID" like 'A%';