Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622004
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:46:57+00:00 2026-05-22T02:46:57+00:00

I tried to write the following inner join query using an Oracle database: SELECT

  • 0

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 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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:46:58+00:00Added an answer on May 22, 2026 at 2:46 am

    Your problem is those pernicious double quotes.

    SQL> CREATE TABLE "APC"."PS_TBL_DEPARTMENT_DETAILS"
      2  (
      3    "Company Code" VARCHAR2(255),
      4    "Company Name" VARCHAR2(255),
      5    "Sector_Code" VARCHAR2(255),
      6    "Sector_Name" VARCHAR2(255),
      7    "Business_Unit_Code" VARCHAR2(255),
      8    "Business_Unit_Name" VARCHAR2(255),
      9    "Department_Code" VARCHAR2(255),
     10    "Department_Name" VARCHAR2(255),
     11    "HR_ORG_ID" VARCHAR2(255),
     12    "HR_ORG_Name" VARCHAR2(255),
     13    "Cost_Center_Number" VARCHAR2(255),
     14    " " VARCHAR2(255)
     15  )
     16  /
    
    Table created.
    
    SQL>
    

    Oracle SQL allows us to ignore the case of database object names provided we either create them with names all in upper case, or without using double quotes. If we use mixed case or lower case in the script and wrapped the identifiers in double quotes we are condemned to using double quotes and the precise case whenever we refer to the object or its attributes:

    SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
      2  where Department_Code = 'BAH'
      3  /
    where Department_Code = 'BAH'
          *
    ERROR at line 2:
    ORA-00904: "DEPARTMENT_CODE": invalid identifier
    
    
    SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
      2  where "Department_Code" = 'BAH'
      3  /
    
      COUNT(*)
    ----------
             0
    
    SQL>
    

    tl;dr

    don’t use double quotes in DDL scripts

    (I know most third party code generators do, but they are disciplined enough to put all their object names in UPPER CASE.)


    The reverse is also true. If we create the table without using double-quotes …

    create table PS_TBL_DEPARTMENT_DETAILS
    ( company_code VARCHAR2(255),
      company_name VARCHAR2(255),
      Cost_Center_Number VARCHAR2(255))
    ;
    

    … we can reference it and its columns in whatever case takes our fancy:

    select * from ps_tbl_department_details
    

    … or

    select * from PS_TBL_DEPARTMENT_DETAILS;
    

    … or

    select * from PS_Tbl_Department_Details
    where COMAPNY_CODE = 'ORCL'
    and cost_center_number = '0980'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone tried to dynamically select which properties they want to write to an
I'm trying to write the following query in LINQ, but can't seem to get
I've tried to write a string replace function in C, which works on a
Several years back, I innocently tried to write a little app to save my
I have the following database table with information about people, diseases, and drugs: PERSON_T
I tried to write a function that calculates a hamming distance between two codewords
I want to write the following in Clojure, but I can't figure it out
I am trying to implement _set_se_translator. I tried to write a function with the
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.