Skip to main content

Computed field in Select clause


Zacharia_Mathew
Ability to use a calculated field in a query select 1+1 as a1, a1 *10 as a2 from dual; Refer Case 00017808 / JIRA VER-27155. SQL Server and some other DBs support this. The use of a with clause and a subquery will suffice in most cases but this feature will be beneficial too. Zac.

4 replies

Bhawana
Forum|alt.badge.img
  • Participating Frequently
  • June 7, 2013
Hi Zac, Thank you for the posting "Computed field in Select clause". A feature enhancement request has been submitted , but no estimate on when it might become available. Regards, Bhawana

Zacharia_Mathew_1
Forum|alt.badge.img
Bhawana, Thank you. Would you change the status to "Under Consideration" Zac.

Forum|alt.badge.img+2
  • Participating Frequently
  • June 7, 2013
Hi Zac, Do you know that you can subqueries to obtain the same, don't you? such as select a1, a1*10 from (select 1+1 as a1 from dual); Does make sense? It should not be extra penalty cost for the subquery, but agree is not as clean as your example but it should work. Btw, all the feature request are always under consideration and are reviewed in a triage meetings, some of them get done earlier just based on priority, other features and difficulty. But we always review feature request. Hope this helps, nice to "talk" with you again. Eugenia

Zacharia_Mathew_1
Forum|alt.badge.img
Eugenia, I agree that in most cases, a sub query or a with clause will be sufficient for simple examples as I posted. But a "Computed" field will be handy especially when the computation is very complex or needs to be done on each row of the resultset. Zac.