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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:51:32+00:00 2026-06-12T04:51:32+00:00

Possible Duplicate: oracle insert if row not exists I am using the query below

  • 0

Possible Duplicate:
oracle insert if row not exists

I am using the query below to calculate a total for some data, however, I want the insert to only be executed if the ID doesn’t exist in the EL_CLIENT_REC_UNITS in the first place. Can anyone see a way of doing this?

     INSERT INTO EL_CLIENT_REC_UNITS 
     (ID,
     EL_CLIENT_ID,
     RECORDING_ID,
     UNIT_TYPE,
     PHY_DIG_OR_TOTAL,
     CONTROLLED_PERCENTAGE,
     PERC_ADJ_UNITS_RECEIVED,
     SUM_UNITS_RECEIVED) (       
      (SELECT 
        EL_CLIENT_ID||RECORDING_ID||'CT'   AS ID,
        EL_CLIENT_ID                 AS EL_CLIENT_ID, 
        RECORDING_ID                 AS RECORDING_ID, 
        UNIT_TYPE                    AS UNIT_TYPE, 
        'Total'                      AS PHY_DIG_OR_TOTAL, 
        NULL AS CONTROLLED_PERCENTAGE,
        SUM(PERC_ADJ_UNITS_RECEIVED) AS PERC_ADJ_UNITS_RECEIVED,
        SUM(SUM_UNITS_RECEIVED)      AS SUM_UNITS_RECEIVED
    FROM EL_CLIENT_REC_UNITS
    WHERE EL_CLIENT_ID = pRow.ID
    AND UNIT_TYPE = 'Cleared'
    GROUP BY UNIT_TYPE, EL_CLIENT_ID, RECORDING_ID)
    WHERE NOT EXISTS (SELECT );
  • 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-12T04:51:34+00:00Added an answer on June 12, 2026 at 4:51 am

    Try this

    INSERT INTO EL_CLIENT_REC_UNITS 
         (ID,
         EL_CLIENT_ID,
         RECORDING_ID,
         UNIT_TYPE,
         PHY_DIG_OR_TOTAL,
         CONTROLLED_PERCENTAGE,
         PERC_ADJ_UNITS_RECEIVED,
         SUM_UNITS_RECEIVED)       
        SELECT * FROM
        (SELECT 
            EL_CLIENT_ID||RECORDING_ID||'CT'   AS ID,
            EL_CLIENT_ID                 AS EL_CLIENT_ID, 
            RECORDING_ID                 AS RECORDING_ID, 
            UNIT_TYPE                    AS UNIT_TYPE, 
            'Total'                      AS PHY_DIG_OR_TOTAL, 
            NULL AS CONTROLLED_PERCENTAGE,
            SUM(PERC_ADJ_UNITS_RECEIVED) AS PERC_ADJ_UNITS_RECEIVED,
            SUM(SUM_UNITS_RECEIVED)      AS SUM_UNITS_RECEIVED
        FROM EL_CLIENT_REC_UNITS
        WHERE EL_CLIENT_ID = pRow.ID
        AND UNIT_TYPE = 'Cleared'
        GROUP BY UNIT_TYPE, EL_CLIENT_ID, RECORDING_ID) INS_VALS
        WHERE NOT EXISTS (SELECT 1 FROM EL_CLIENT_REC_UNITS ELC WHERE ELC.ID =  INS_VALS.ID );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can not connect to Oracle via VBA - Driver's SQLSetConnectAttr Failed I
Possible Duplicate: Oracle DB: How can I write query ignoring case? I have an
Possible Duplicate: SELECT INTO using Oracle I have one table in my oracle database.
Possible Duplicate: ‘CONTINUE’ keyword in Oracle 10g PL/SQL I am Using Oracle 9i and
Possible Duplicate: How to best split csv strings in oracle 9i I have some
Possible Duplicate: oracle PL/SQL: sort rows I run this query: Select a.product, sum( case
Possible Duplicate: Difference of create Index by using include column or not using Edit:
Possible Duplicate: Is there an Oracle SQL query that aggregates multiple rows into one
Possible Duplicate: Oracle "(+)" Operator Can some one tell me what does (+) sign
Possible Duplicate: how to convert csv to table in oracle I have a 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.