Error Code 904 Sqlstate 42000
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might sql error 904 sqlstate 42000 ora-00904 invalid identifier have Meta Discuss the workings and policies of this site error sqlstate 42000 syntax error or access violation 1066 not unique table/alias About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting
Error Sqlstate 42000 Syntax Error Or Access Violation 1064
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7
Errorcode 1064 Sqlstate 42000
million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ORA-00904: invalid identifier up vote 24 down vote favorite 10 I tried to write the following inner join query using an Oracle database: SELECT Employee.EMPLID as EmpID, Employee.FIRST_NAME AS Name, Team.DEPARTMENT_CODE AS TeamID, Team.Department_Name AS teamname FROM PS_TBL_EMPLOYEE_DETAILS errorcode 942 sqlstate 42000 Employee INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team ON Team.DEPARTMENT_CODE = Employee.DEPTID That gives the below error: INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team ON Team.DEPARTMENT_CODE = Employee.DEPTID * ERROR at line 4: ORA-00904: "TEAM"."DEPARTMENT_CODE": invalid identifier The DDL of one table is: CREATE TABLE "HRMS"."PS_TBL_DEPARTMENT_DETAILS" ( "Company Code" VARCHAR2(255), "Company Name" VARCHAR2(255), "Sector_Code" VARCHAR2(255), "Sector_Name" VARCHAR2(255), "Business_Unit_Code" VARCHAR2(255), "Business_Unit_Name" VARCHAR2(255), "Department_Code" VARCHAR2(255), "Department_Name" VARCHAR2(255), "HR_ORG_ID" VARCHAR2(255), "HR_ORG_Name" VARCHAR2(255), "Cost_Center_Number" VARCHAR2(255), " " VARCHAR2(255) ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS sql database oracle ora-00904 share|improve this question edited Jun 1 at 19:45 Abhishek 690721 asked May 17 '11 at 8:05 Navaneethan 53551028 Are you sure the column name Department_Code is spelled correctly? –Fabrizio D'Ammassa May 17 '11 at 8:20 Yes there is a column Department_Code –Navaneethan May 17 '11 at 9:26 add a comment| 7 Answers 7 active oldest votes up vote 56 down vote accepted Your problem is those pernicious double quotes. SQL> CREATE TABLE "APC"."PS_TBL_DEPARTMENT_DE
invalid identifier Discussion in 'SQL PL/SQL' started by amy85, Apr 4, 2009. amy85 Active Member Messages: 11 Likes Received: 0 Trophy Points: 80 Hi another simple question ( sorry...) When I try to create a table like this , I get the error below Code (Text): create
Errorcode 933 Sqlstate 42000
table EMP ( ID NUMBER not null, CREATION_DATE TIMESTAMP(3) not errorcode 936 sqlstate 42000 null, COMMENT VARCHAR2(255), primary key (ID) ) Error: [B]ORA-00904:: invalid identifier[/B] SQL State: 42000 Error Code: 904 error code 1064 sql state 42000 What am I missing? Thanks again (... and again) amy85, Apr 4, 2009 #1 tyro Forum Genius Messages: 368 Likes Received: 20 Trophy Points: 260 Location: India hey don't say sorry dear you can't use COMMENT as your column name (the invalid http://stackoverflow.com/questions/6027961/ora-00904-invalid-identifier identifier) because it is a oracle reserved term. Use this Code (Text): create table EMP ( ID NUMBER not null, CREATION_DATE TIMESTAMP(3) not null, P_COMMENT VARCHAR2(255), primary key (ID) ) But if you must use COMMENT as a column name put it in between double quotes as below: Code (Text): create table EMP ( ID NUMBER not null, CREATION_DATE TIMESTAMP(3) not null, http://www.club-oracle.com/threads/ora-00904-invalid-identifier.693/ "COMMENT" VARCHAR2(255), primary key (ID) ) Cheers [] tyro, Apr 4, 2009 #2 amy85 likes this. rajavu Forum Guru Messages: 815 Likes Received: 52 Trophy Points: 610 Location: @ Bangalore , India As you might be knowing , it is not desirable to use the reserved words as a column name of a table . You have to use double quotes always in the application to refer the reserved key word column name. It is recommended to change the column name as suggested by Tyro. Code (SQL): SQL> CREATE TABLE EMP12 ( 2 ID NUMBER NOT NULL, 3 CREATION_DATE TIMESTAMP(3) NOT NULL, 4 "COMMENT" VARCHAR2(255), 5 PRIMARY KEY (ID) 6 ) 7 ; TABLE created. SQL> INSERT INTO EMP12 VALUES ( 10, SYSTIMESTAMP, '1D=10'); 1 ROW created. SQL> SELECT ID ,COMMENT FROM EMP12 ; SELECT ID ,COMMENT FROM EMP12 * ERROR at line 1: ORA-00936: missing expression SQL> SELECT ID ,"COMMENT" FROM EMP12; ID COMMENT ---------- -------------------- 10 1D=10 SQL> rajavu, Apr 8, 2009 #3 amy85 likes this. amy85 Active Member Messages: 11 Likes Received: 0 Trophy Points: 80 hi guys thank you for your responses. I had initially used the double-quotes but now i have dropped that table and re-created with a different column name. amy85, Apr 8, 2009 #4 (You must log
Delete all board cookies • All times are UTC - 3 hours Powered by phpBB © 2016 phpBB Group | Anuncie neste Site