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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:15:39+00:00 2026-05-13T17:15:39+00:00

I am currently working on a PHP project with an Oracle database. To update

  • 0

I am currently working on a PHP project with an Oracle database. To update a table, the php code I’m working with uses a SQL “MERGE INTO” method to loop through a table and see if values for multiple records exist in another table. If they don’t exist yet, the values are inserted into my table. If the values already exist, nothing happens.

I would like to have another query run after this that uses the auto incremented id’s created in the MERGE INTO query. Is there a way to get an array of the newly created ids? I was hoping for something like mysql_insert_id, but I haven’t found anything like that yet.

Thanks!

  • 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-13T17:15:40+00:00Added an answer on May 13, 2026 at 5:15 pm

    Oracle has supported the MERGE syntax since 9i. Haven’t tried, but you might be able to use the RETURNING clause on the MERGE statement…

    Oracle uses sequences for handling automatically incremented values. Once you’ve created a sequence, you can use:

    sequence_name.CURVAL
    

    ..to get the current value, like what mysql_insert_id would return. To populate a primary key, you’d use:

    sequence_name.NEXTVAL
    

    To populate a primary in an INSERT statement, you’d use:

    INSERT INTO your_table
      (pk_id, ..
    VALUES
      (your_sequence.NEXTVAL, ...)
    

    You can use triggers as an alternative, but they won’t return the current value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a PHP application that uses a MySQL database for its
I am currently working on a PHP project which includes extensive database usage. The
I am currently working on a php/javascript project which retrieves information from a database
In a project I'm currently working for, we're considering putting system() into php.ini's disable_functions
In the project my team is currently working on, we're modifying a commercial PHP
For the project I'm currently working on I have a database with locations (restaurants,
Currently I am working with a commercial project with PHP. I think this question
I am currently working on a php project where I need to display a
I am currently working on a php project with the user of ajax. I
I am currently working on a php/html/javascript project. I have a form where when

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.