I am trying find my fault. I am getting this error message:
SQL-Fehler: ORA-00904: "S1"."PARTNO": ungültiger Bezeichner 00904. 00000 - "%s: invalid identifier"
I have checked my database and all tables exist.
Here is my sql code:
select s1.*
, p.city as "Produktionsort"
, p.partname
from (select count(s.partno) as "Anzahl_Produktarten"
, s.partno as "Partno"
from company.supp_part_job s
group by s.partno ) s1
, company.part p
where s1.partno IN (select p1.partno from company.part p1 where p1.city != 'London')
and p.partno = s1.partno
group by s1.partno
Ora-00904 Error Message “Invalid Identifier” This error is most common when querying a SELECT statement. To resolve this error, first check to make sure the column name being referenced exists. If it does not exist, you must create one before attempting to execute an SQL statement with the column.
control-shift-L should open the log(s) for you. this will by default be the messages log, but if you create the item that is creating the error the Compiler Log will show up (for me the box shows up in the bottom middle left).
An SQL identifier is the name of a database object. The following objects are examples of SQL identifiers: Parts of the database schema such as tables, columns, views, indexes, synonyms, and stored procedure names. Dynamic IBM® Informix® ESQL/C structures such as cursors and statement IDs.
An identifier is the representation within the language of items created by the user, as opposed to language keywords or commands. Some identifiers stand for dictionary objects, which are the objects you create- such as tables, views, indexes, columns, and constraints- that are stored in a database.
Because you aliased in the inner select (s1) partno
as "Partno"
you must refer to it as case sensitive in the outer query:
select s1.*
, p.city as "Produktionsort"
, p.partname
from (select count(s.partno) as "Anzahl_Produktarten"
, s.partno as "Partno"
from company.supp_part_job s
group by s.partno ) s1
, company.part p
where s1."Partno" IN (select p1.partno from company.part p1 where p1.city != 'London')
and p.partno = s1."Partno"
group by s1."Partno"
If you put double quotes around a column name, it will make it case sensitive. So I would think this line:
s.partno as "Partno"
is creating a case-sensitive s1."Partno" but the where
clause is looking for s1.partno. Try removing the double quotes from your column aliases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With