Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Merge Source table error -ORA-30926:

RengudiJan 25 2023
Hi Gurus,

Great day is today.

I have following error while doing merge

MERGE /*+ append parallel(report_orchestration) enable_parallel_dml*/
     INTO report_history
    USING (SELECT * FROM REPORT_ORCHESTRATION
           MINUS
           (SELECT * FROM report_history)) report_orchestration
       ON (report_history.NFILE = report_orchestration.NFILE)
WHEN MATCHED
THEN
    UPDATE SET
        report_history.TS = report_orchestration.TS,
        report_history."SS_DOMAIN" = report_orchestration."SS_DOMAIN",
        report_history.TTL = report_orchestration.TTL,
        report_history.CL = report_orchestration.CL,
        report_history.ANS_TYPE = report_orchestration.ANS_TYPE,
        report_history.SS_DATA = report_orchestration.SS_DATA
            WHERE EXISTS
                      (SELECT 1
                         FROM report_history
                        WHERE report_history.NFILE =
                              report_orchestration.NFILE)
WHEN NOT MATCHED
THEN
    INSERT    (TS,
               NFILE,
               SS_DOMAIN,
               TTL,
               CL,
               ANS_TYPE,
               SS_DATA)
       VALUES (report_orchestration.TS,
               report_orchestration.NFILE,
               report_orchestration.SS_DOMAIN,
               report_orchestration.TTL,
               report_orchestration.CL,
               report_orchestration.ANS_TYPE,
               report_orchestration.SS_DATA)

Error report -
ORA-30926: unable to get a stable set of rows in the source tables



TABLE report_orchestration
 Name                                      Null?    Type                        
 ----------------------------------------- -------- ----------------------------
 TS                                                 TIMESTAMP(6)                
 NFILE                                     NOT NULL VARCHAR2(255)               
 SS_DOMAIN                                          VARCHAR2(255)               
 TTL                                                NUMBER                      
 CL                                                 VARCHAR2(255)               
 ANS_TYPE                                           VARCHAR2(255)               
 SS_DATA                                            VARCHAR2(4000)              




TABLE report_history
 Name                                      Null?    Type                        
 ----------------------------------------- -------- ----------------------------
 TS                                                 TIMESTAMP(6)                
 NFILE                                     NOT NULL VARCHAR2(255)               
 SS_DOMAIN                                          VARCHAR2(255)               
 TTL                                                NUMBER                      
 CL                                                 VARCHAR2(255)               
 ANS_TYPE                                           VARCHAR2(255)               
 SS_DATA                                            VARCHAR2(4000)              

I would like fix this error; I am okay to get it done as two separate dmls[insert and update] if this can not be fixed using merge.

Thanks



This post has been answered by mathguy on Jan 25 2023
Jump to Answer

Comments

Post Details

Added on Jan 25 2023
6 comments
434 views