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

  • SEARCH
  • Home
  • 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 6860629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:25:56+00:00 2026-05-27T02:25:56+00:00

I am using merge command to insert a non-exist record into table. When I

  • 0

I am using merge command to insert a non-exist record into table. When I use simple insert command it works fine. If I use merge system always alert ORA-00904: “T”.”GROUP_COMPANY_ID” invalid identifier. Once I change the ON condition to (1=1) to force be true then the merge command works fine.

What the original merge statement goes to wrong? I am very sure the table was created without double quoted name so there is not case issue here.

create table test
(
  create_date      DATE not null,
  group_company_id CHAR(16) not null
)

-- This is okay
INSERT INTO test (create_date, group_company_id) VALUES (TO_DATE('20100531', 'YYYYMMDD'), 'abc');

-- This one will raise ORA-00904 error
MERGE INTO test T
USING (SELECT 'abc' AS group_company_id FROM DUAL) C
   ON (T.group_company_id = C.group_company_id)
-- ON (1 = 1)
WHEN NOT MATCHED THEN
     INSERT (create_date, group_company_id)
     VALUES (TO_DATE('20100531', 'YYYYMMDD'), 'abc')
WHEN MATCHED THEN
     UPDATE SET group_company_id = 'abc';
  • 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-27T02:25:57+00:00Added an answer on May 27, 2026 at 2:25 am

    Qualify the column names with the table aiases in the insert and update clauses

    WHEN NOT MATCHED THEN
      INSERT (T.create_date, T.group_company_id)
      VALUES (TO_DATE('20100531', 'YYYYMMDD'), 'abc')
    WHEN MATCHED THEN
      UPDATE SET T.group_company_id = 'abc'; 
    

    Edit:

    MERGE INTO test  
    USING DUAL   
    ON (group_company_id = 'abc') 
    WHEN NOT MATCHED THEN      
          INSERT VALUES (TO_DATE('20100531', 'YYYYMMDD'), 'abc');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this neat command to merge multiple PDF into one, using Ghostscript: gs
I am using cat *.txt to merge multiple txt files into one, but I
I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net
I'm trying to merge two docx-documents into one docx-document using OpenXML SDK 2.0. The
I am using a third party software tool (command line tool) to merge PDF
Is there any way to merge a specific set of extesnion using merge command
I tried to merge different tab delim files into single file using the following
Any idea how to join multiple tables in ssis programatically using Merge Join ?
I am trying to merge multiple excel files using DataTable.Merge() option For Each fileName
Is it possible to merge elements using XSLT. If I have the following XML

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.