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 6376677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:46:32+00:00 2026-05-25T01:46:32+00:00

I have to insert many product value records into an Oracle table. I get

  • 0

I have to insert many product value records into an Oracle table. I get all the data from an xls file, processing it with PHP and (for now) spitting out a long SQL statement. As each record is inserted, I want to check the Product IDs I got from the xls against the products already in the database, skipping the insert if the IDs don’t match a product. The statement I tried is the following:

INSERT ALL 
INTO PRODUCTOS_X_PLANES_CATEGORIA(PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR)
    VALUES (NULL, 123456, 81, 10000)
INTO PRODUCTOS_X_PLANES_CATEGORIA(PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR)
    VALUES (NULL, 7890, 76, 11000)
SELECT * FROM DUAL;

Which gets me an

[Err] ORA-02291: integrity constraint (OURDB.PXG_PRODUCTO_FKEY) violated - parent key not found

error message. I want to check that the PXG_PRODUCTO key exists before attempting the insert. I should check against the PRODUCTOS.PRO_ID field. I tried something like

INSERT ALL 
INTO PRODUCTOS_X_PLANES_CATEGORIA (PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR) 
    VALUES (NULL, 123456, 81, 10000) 
    USING PRODUCTOS ON PXG_PRODUCTO = PRO_ID
INTO PRODUCTOS_X_PLANES_CATEGORIA (PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR) 
    VALUES (NULL, 7890, 76, 11000) 
    USING PRODUCTOS ON PXG_PRODUCTO = PRO_ID
SELECT * FROM DUAL;

getting only a

[Err] ORA-00928: missing SELECT keyword

message. What’s the correct syntax? Or, if I’m completely wrong, what should I be doing instead?

EDIT Using

INSERT ALL 
 INTO PRODUCTOS_X_PLANES_CATEGORIA (PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR) VALUES (NULL, 123456, 81, 10000) WHERE EXISTS (SELECT * FROM PRODUCTOS WHERE 123456 = PRO_ID)
 INTO PRODUCTOS_X_PLANES_CATEGORIA (PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR) VALUES (NULL, 7890, 76, 11000) WHERE EXISTS (SELECT * FROM PRODUCTOS WHERE 7890 = PRO_ID)
SELECT * FROM   DUAL;

still results in

[Err] ORA-00928: missing SELECT keyword
  • 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-25T01:46:33+00:00Added an answer on May 25, 2026 at 1:46 am

    You could use where:

    INSERT INTO PRODUCTOS_X_PLANES_CATEGORIA 
        (PXG_ID, PXG_PRODUCTO, PXG_PLAN_CATEGORIA, PXG_VALOR) 
        SELECT NULL, 973082, 76, 10000
        FROM dual
        WHERE EXISTS (SELECT * FROM PRODUCTOS WHERE 973082 = PRO_ID)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that contains data for many clients. Currently, we insert tens
I have an INSERT query that is pulling data from two tables and inserting
When performing many inserts into a database I would usually have code like this:
I have an insert query that gets generated like this INSERT INTO InvoiceDetail (LegacyId,InvoiceId,DetailTypeId,Fee,FeeTax,Investigatorid,SalespersonId,CreateDate,CreatedById,IsChargeBack,Expense,RepoAgentId,PayeeName,ExpensePaymentId,AdjustDetailId)
I have a huge file, where I have to insert certain characters at a
HI, I have an insert statement in a Stored Procedure that requires the value
Hey guys quick question, I currently have an insert statement $query= INSERT into new_mail
I am using SQL Server 2008. I have a table A which accepts many
I have the table: select * from person; +----+------+---------+ | id | name |
I am attempting to insert many records using T-SQL's MERGE statement, but my query

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.