Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Functions and where vs. group-by inconsistency
Martin T. wrote:
> DA Morgan wrote: >> Martin T. wrote:
>>>> Martin T. wrote: >>>>> Hello all. >>>>> (assuming Oracle 9.2) >>>>> >>>>> First of all, does anyone know why the Oracle SQL Parser will not allow >>>>> us to use the <name>-part of "table.column AS <name>" in where or >>>>> group-by clauses?? Is this just being lazy on their part, or is there >>>>> an actual reason behind this? >>>> Just read the above paragraph a second time. I have no idea what you >>>> are asking. Is the lack of clarity just being lazy on your part? ;-) >>>>
>>>
>>>
>>>
>> Because COL1_FUNC is an alias. It is not the name of a column. >> >> You must have far too much idle time on your hands if this is the >> issue d'jour. ;-) >> -- > > I wouldn't go so far as to call it "far" too much :-) > But while one is waiting for the compiler to finish, or the file to > download, or other such thankless tasks, one may just as well try to > find out why Oracle does things the way it does them -- or what it > actually does ... for example that it will not evaluate functions in > the group by clause if the same appers in the select expression. > > Whatever - I really should start to ask less at once ... :-) > > cheers, > Martin
Then, perhaps, you can substitute this:
CREATE TABLE airplanes (
program_id VARCHAR2(3),
delivered_date DATE,
customer_id VARCHAR2(4), order_date DATE);
CREATE TABLE ap_cust (
customer_id VARCHAR2(4),
program_id VARCHAR2(3),
del_date DATE);
CREATE TABLE ap_orders (
order_date DATE,
program_id VARCHAR2(3));
INSERT ALL
INTO ap_cust VALUES (customer_id, program_id, delivered_date)
INTO ap_orders VALUES (order_date, program_id)
SELECT program_id, delivered_date, customer_id, order_date
FROM airplanes;
It is far more interesting. At least to me. ;-)
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Fri Oct 06 2006 - 21:29:16 CDT
![]() |
![]() |