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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:41:43+00:00 2026-06-09T23:41:43+00:00

Friends i am using merge syntax to update and insert values in a table

  • 0

Friends i am using merge syntax to update and insert values in a table

MERGE INTO iq_dnr b
   USING (SELECT *
            FROM iq_dnr
           WHERE co_series = 'IO' AND CATEGORY = 9 AND dnr_from = 13567362) a
   ON (    a.co_series = b.co_series
       AND a.CATEGORY = b.CATEGORY
       AND a.dnr_from = b.dnr_from)
   WHEN MATCHED THEN
      UPDATE
         SET b.dnr_to = 0001
   WHEN NOT MATCHED THEN
      INSERT (co_series, CATEGORY, dnr_from, dnr_to)
      VALUES ('IO', 9, 13567362, 00001)

and i want to ask whether it is possible to check and insert in one table only like i did in above query.
know the problem is i am able to successfully update the table but i am not able to insert the values .
plss help me

  • 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-06-09T23:41:44+00:00Added an answer on June 9, 2026 at 11:41 pm

    Try with using DUAL, it might solve your problem:

    MERGE INTO iq_dnr b
       USING (SELECT 'IO' co_series,
                      9 CATEGORY,
                      13567362 dnr_from
                FROM dual) a
       ON (    a.co_series = b.co_series
           AND a.CATEGORY = b.CATEGORY
           AND a.dnr_from = b.dnr_from)
       WHEN MATCHED THEN
          UPDATE
             SET b.dnr_to = 0001
       WHEN NOT MATCHED THEN
          INSERT (co_series, CATEGORY, dnr_from, dnr_to)
          VALUES ('IO', 9, 13567362, 00001)
    

    Using above DUAL ensures that it returns something anyway which keeps MERGE statement working….

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

Sidebar

Related Questions

I can select using or with the sql statement select f.userid, f.friend_userid from friends
Hi friends i'm getting json from server (using kohana framework 3.0) like this.... {
I made a simple program for my friends using some things from the os
I am attempting to insert many records using T-SQL's MERGE statement, but my query
I have to find friends of friends (not my friends) from an sql table
I'm trying to get all events from all of my friends on Facebook using
I am using below code to get profile image of friends using Resfb. I
The following batch request for retrieve friends using the same app is not working:
I can send requests to friends using Multi Friend Request Selector inside my Page
I'm trying to get a list of user's friends using fb connect for the

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.