RE: ORA-00905: missing keyword

From: <Dominic.Brooks_at_barclayscapital.com>
Date: Fri, 11 Feb 2011 12:39:58 +0000
Message-ID: <853BE8E3785A554D92010F1FB6C0B279AE3E9BD0_at_LDNPCMMGMB11.INTRANET.BARCAPINT.COM>



e.g.
SQL> WITH scadenziario AS
  2 (SELECT 1 id_veterinario_programmato   3 , 1 id_unita_aziendale
  4 FROM DUAL)
  5 , operatore AS
  6 (SELECT 1 id
  7 , 1 id_anagrafica
  8 FROM DUAL)
  9 , anagrafica AS
 10 (SELECT 1 id
 11 FROM DUAL)
 12 , unita_aziendale AS
 13 (SELECT 1 id
 14 , 1 id_anagrafica
 15 FROM DUAL)
 16 SELECT DISTINCT count(*)
 17 FROM scadenziario
 18 left join
 19         operatore      
 20  ON     scadenziario.id_veterinario_programmato=operatore.id
 21  left join 
 22         anagrafica     
 23  ON     operatore.id_anagrafica=anagrafica.id
 24  join 
 25         unita_aziendale     
 26  ON     scadenziario.id_unita_aziendale =unita_aziendale.id
 27  join 
 28         anagrafica AS aua   
 29  ON     aua.id = unita_aziendale.id_anagrafica
 30  /
       anagrafica AS aua
                  *

ERROR at line 28:
ORA-00905: missing keyword

SQL> 28
 28* anagrafica AS aua
SQL> c/AS/
 28* anagrafica aua
SQL> /   COUNT(*)


         1

SQL> P.S. Not sure that DISTINCT COUNT(*) makes much sense - might as well just be COUNT(*)

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Brooks, Dominic: IT (LDN) Sent: 11 February 2011 12:35
To: jose.soares_at_sferacarta.com; oracle-l_at_freelists.org Subject: RE: ORA-00905: missing keyword

> anagrafica as aua

'AS' can be used with column aliases not table aliases

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of jose soares Sent: 11 February 2011 12:28
To: ORACLE-L
Subject: ORA-00905: missing keyword

Hi all,

What's wrong with this query?

SELECT DISTINCT count(*) FROM scadenziario left join operatore ON
scadenziario.id_veterinario_programmato=operatore.id

left join anagrafica     ON operatore.id_anagrafica=anagrafica.id
join unita_aziendale     ON scadenziario.id_unita_aziendale = 
unita_aziendale.id
join anagrafica as aua ON aua.id = unita_aziendale.id_anagrafica WHERE id_piano= 23

it gives me this error:

      cx_Oracle.DatabaseError: ORA-00905: missing keyword

I tried it in PostgreSQL and it works.

Thanks for any help.

j

--
http://www.freelists.org/webpage/oracle-l


_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered offic
 e at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________
--
http://www.freelists.org/webpage/oracle-l


--
http://www.freelists.org/webpage/oracle-l
Received on Fri Feb 11 2011 - 06:39:58 CST

Original text of this message