Merge - ora 12854

MERGE INTO tml_auths_arch partition(PART_20090729) t1
USING tml_auths_arch_avw@link1 t2
ON (t1.txn_uid = t2.txn_uid)
WHEN NOT MATCHED THEN
INSERT VALUES( t2.TXN_UID,
t2.RELATED_UID,
Error.
ORA-12854: Parallel query is not supported on temporary LOBs
I find the below solution.
ORA-12854: Parallel query is not supported on temporary LOBs
Cause: The parallel query statement produced a temporary LOB.
Action: Turn off parallelism for the query or underlying table
But how to stop parallelism for the query?
Please help

It may be that it depends on the db version, which the op did not mention:
In 11g the noparallel hint has bee deprecated:
»The NOPARALLEL hint has been deprecated. Use the NO_PARALLEL hint instead.«
So I would try
MERGE INTO tml_auths_arch PARTITION(part_20090729) t1
USING (select /*+ no_parallel (t2)*/ from tml_auths_arch_avw@link1 t2) t2
ON (t1.txn_uid = t2.txn_uid)
WHEN NOT MATCHED THEN
INSERT VALUES( t2.txn_uid,
t2.related_uid
);

Similar Messages

  • Party Merge ORA-29861: domain index is marked LOADING/FAILED/UNUSABLE

    Hi gurus,
    i am using 11.5.10.2 on linux.
    while running the party merge concurrent program , we are getting below error, please help.
    Errors in Merge :
    Application: Receivables_
    Error: Merge failed in Receivables (HZ_STAGED_PARTY_SITES ) with the following error message:
    This unexpected SQL error occurred during the merge process :
    ORA-29861: domain index is marked LOADING/FAILED/UNUSABLE
    The following record was being handled when the error occurred :
    Thanks
    RB

    Thanks Hussain, this is similer to the error i got, i will run the steps and get back to you, once again thanks for your prompt responce.
    Thx
    RB
    Edited by: R12DBA on Jul 23, 2010 4:36 PM
    Edited by: R12DBA on Jul 23, 2010 4:50 PM

  • Runtime Error with MERGE

    I have a mapping that compiles but produces a run-time error:
    BATCH MERGE
    ORA-00918: column ambigiously defined
    I've traced it to this section of the code:
    MERGE INTO "GXP_LOCATION"
    USING
    (SELECT /*+ NO_MERGE*/
    <snip>
    FROM
    "DW_GXP_LOCATIONS"@"GPDW" "DW_GXP_LOCATIONS_GPDW"
    ) "MERGEQUERY_393"
    ON (
    "GXP" = "MERGEQUERY_393"."GXP" AND
    "NETWORK_CODE" = "MERGEQUERY_393"."NETWORK_CODE" )
    WHEN MATCHED THEN
    UPDATE
    SET "TPNZ_GRID_BUS" = "MERGEQUERY_393"."TPNZ_GRID_BUS",
    "LOCATION" = "MERGEQUERY_393"."LOCATION",
    "CONNECTION_TYPE" = "MERGEQUERY_393"."CONNECTION_TYPE",
    "AUDIT_ID" = "MERGEQUERY_393"."AUDIT_ID"
    WHEN NOT MATCHED THEN
    INSERT
    <snip>
    If I prefix the table name to the columns used in the ON clause, it works.
    Any ideas?
    Regards
    Hong
    Environment
    OWB version 9.0.2.62.3
    Oracle9i EE 9.0.1.3.0

    I have recreated this and it seems to be a code generation error. The workaround I can suggest is to either rename the ON clause fields in the target table or to create a view atop of the source table in which the names of the mentioned fields will be different from the ones in the table and then extract from that view (I presume you cannot touch the source table). This problem will be fixed in the next release.
    Igor

  • PL/SQL: ORA-03001: unimplemented feature

    hi i am just trying to understand the bulk binding feature of oracle
    this is the test code that i am trying
    set serveroutput on
    set timing on
    declare
    src_obj src;
    begin
    SELECT srcip BULK COLLECT INTO src_obj
    FROM rawcdr ;
    insert into rawcdr1(srcip) values src_obj;
    end;
    i am using oracle 10 g std edition
    and i get this error
    insert into rawcdr1(srcip) values src_obj;
    ERROR at line 6:
    ORA-06550: line 6, column 25:
    PL/SQL: ORA-03001: unimplemented feature
    ORA-06550: line 6, column 5:
    PL/SQL: SQL Statement ignored
    is it something related to the db version
    or i m misin on basics
    please help

    hey thanks william
    it does work but why was it giving unimplemented feature before
    SRC by the way is table type .
    now i want to perform some string function on the returned data
    what i tried was
    SELECT srcip BULK COLLECT INTO src_obj
    FROM rawcdr
    WHERE srcip='220.227.46.130';
    FORALL i IN src_obj.FIRST..src_obj.LAST
    if (instr(src_obj(i),'00')=5) then
    INSERT INTO rawcdr1 (srcip) VALUES (src_obj(i));
    end if;
    i get this error
    if (instr(src_obj(i),'00')=5) then
    ERROR at line 7:
    ORA-06550: line 7, column 6:
    PLS-00103: Encountered the symbol "IF" when expecting one of the following:
    . ( * @ % & - + / at mod remainder rem select update with
    <an exponent (**)> delete insert || execute multiset save
    merge
    ORA-06550: line 11, column 0:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    end not pragma final instantiable order overriding static
    member constructor map
    Elapsed: 00:00:00.03
    is it not possible to use the string function in this context
    please help whats the right way to do the same

  • How to use Bulk Collect and Forall

    Hi all,
    We are on Oracle 10g. I have a requirement to read from table A and then for each record in table A, find matching rows in table B and then write the identified information in table B to the target table (table C). In the past, I had used two ‘cursor for loops’ to achieve that. To make the new procedure, more efficient, I would like to learn to use ‘bulk collect’ and ‘forall’.
    Here is what I have so far:
    DECLARE
    TYPE employee_array IS TABLE OF EMPLOYEES%ROWTYPE;
    employee_data  employee_array;
    TYPE job_history_array IS TABLE OF JOB_HISTORY%ROWTYPE;
    Job_history_data   job_history_array;
    BatchSize CONSTANT POSITIVE := 5;
    -- Read from File A
    CURSOR c_get_employees IS
             SELECT  Employee_id,
                       first_name,
                       last_name,
                       hire_date,
                       job_id
              FROM EMPLOYEES;
    -- Read from File B based on employee ID in File A
    CURSOR c_get_job_history (p_employee_id number) IS
             select start_date,
                      end_date,
                      job_id,
                      department_id
             FROM JOB_HISTORY
             WHERE employee_id = p_employee_id;
    BEGIN
        OPEN c_get_employees;
        LOOP
            FETCH c_get_employees BULK COLLECT INTO employee_data.employee_id.LAST,
                                                                              employee_data.first_name.LAST,
                                                                              employee_data.last_name.LAST,
                                                                              employee_data.hire_date.LAST,
                                                                              employee_data.job_id.LAST
             LIMIT BatchSize;
            FORALL i in 1.. employee_data.COUNT
                    Open c_get_job_history (employee_data(i).employee_id);
                    FETCH c_get_job_history BULKCOLLECT INTO job_history_array LIMIT BatchSize;
                             FORALL k in 1.. Job_history_data.COUNT LOOP
                                            -- insert into FILE C
                                              INSERT INTO MY_TEST(employee_id, first_name, last_name, hire_date, job_id)
                                                                values (job_history_array(k).employee_id, job_history_array(k).first_name,
                                                                          job_history_array(k).last_name, job_history_array(k).hire_date,
                                                                          job_history_array(k).job_id);
                                             EXIT WHEN job_ history_data.count < BatchSize                        
                             END LOOP;                          
                             CLOSE c_get_job_history;                          
                     EXIT WHEN employee_data.COUNT < BatchSize;
           END LOOP;
            COMMIT;
            CLOSE c_get_employees;
    END;
                     When I run this script, I get
    [Error] Execution (47: 17): ORA-06550: line 47, column 17:
    PLS-00103: Encountered the symbol "OPEN" when expecting one of the following:
       . ( * @ % & - + / at mod remainder rem select update with
       <an exponent (**)> delete insert || execute multiset save
       merge
    ORA-06550: line 48, column 17:
    PLS-00103: Encountered the symbol "FETCH" when expecting one of the following:
       begin function package pragma procedure subtype type use
       <an identifier> <a double-quoted delimited-identifier> form
       current cursorWhat is the best way to code this? Once, I learn how to do this, I apply the knowledge to the real application in which file A would have around 200 rows and file B would have hundreds of thousands of rows.
    Thank you for your guidance,
    Seyed

    Hello BlueShadow,
    Following your advice, I modified a stored procedure that initially was using two cursor for loops to read from tables A and B to write to table C to use instead something like your suggestion listed below:
    INSERT INTO tableC
    SELECT …
    FROM tableA JOIN tableB on (join condition).I tried this change on a procedure writing to tableC with keys disabled. I will try this against the real table that has primary key and indexes and report the result later.
    Thank you very much,
    Seyed

  • Duplicate rows in workspace

    One of my users made some "adjustments" (still not fully sure what he did) to a workspace in our production database. Another user then went into the same workspace and made over 100 changes. When attempting to merge, ORA-0001 unique constraint errors appeared. I was able to remove the duplicate rows from the table, but I am still receiving duplicate entries in the aux table.  Due to the number of changes, they do not want to drop the workspace and start from scratch.  Any idea as to how to remove the duplicate entries from the AUX table without messing up all of the workspaces?

    Hi Ben, thank you for your response. Here is what I would like to try:
    1. Use the ROWID to remove the duplicate rows (17 rows)
    2. Export the remaining rows to a staging table then delete them from the table
    3. Merge the workspace forcing all of the changes into the parent table
    4. Option (a) Import the erred 17 rows and see if I still get the same AUX duplicate unique key errors
    5. Option (b) Export the rows from another workspace and import them into the erred workspace
    6. Option (c) Drop the workspace and re-create it. Have the user manually add the missing rows
    Option C is a "can't find any other way around it" option. I think that I have a fighting chance with one of these options. I will put in a TAR if this doesn't work.

  • ORA 900 error while executing MERGE statement

    Hi All,
    I am using Oracle 11 Rg1.
    I have a summarization process running daily where the process of execution is as follows:-
    1. Data loads every 10 min into a transaction table from external dat files
    2. I have a package with 13 stored procedures - each procedure has a MERGE logic to summarize data from the above table into a summarization table. Each procedure select data depending on the business requirement
    3. A wrapper file is invoked by a crontab daily to execute each procedue in the above package sequentially
    4. Each of the 13 procs is executed and data summarized daily into the summarization tables
    From a few days, I have been getting a strange error - where 5 of the stored procs are failing with the error code and description as ORA 900 - invalid sql statement. The structure of all the 13 procs is the same. The only difference is in the MERGE logic WHERE clauses.
    Due to some data loss occurence I introduced conditions the WHERE clause that take into account pl/sql variables.
    I shall paste one procedure here and provide additional details as the discussion progress to avoid making this first post very lengthy.
    This logic is failing with ORA 900 when invoked from the wrapper in unix as :-
    exec PKG_ODS_AV_SUMMARY.SP_LOAD_ODS_AV_SUMMARY_BYSRCCD(sysdate-1,'');
    create or replace PACKAGE PKG_AV_SUMMARY AS
      PROCEDURE SP_LOAD_SUMMARY_BYSRCCD (pv_sum_enddate IN DATE, pv_summm_type_indicator IN VARCHAR2);
    END PKG_AV_SUMMARY;
    create or replace
    PACKAGE BODY PKG_AV_SUMMARY AS
    --Girish:07June2011 global variables
    -- Declaring package variables to hold common constant values
    c_status_inprogress VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_INPROGRESS');
    c_status_success VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_SUCCESS');
    c_status_failure VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_FAILURE');
    c_summaryType_fullLoad VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSUMMTYPE_FULL');
    c_summaryType_incrementLoad VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSUMMTYPE_INCR');
    c_errordesc_summparamisN VARCHAR2(100) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSERRORDESC_SUMMPARAMISN');
    PROCEDURE SP_LOAD_SUMMARY_BYSRCCD (pv_sum_enddate IN DATE, pv_summm_type_indicator IN VARCHAR2)
    AS
    lv_table_name VARCHAR2(30) := 'AV_SUMMARY_BYSRCCD';
    ln_count NUMBER;
    lv_summarizationrequired VARCHAR2(2);
    lv_summm_type_indicator VARCHAR2(5);
    lv_sum_startdate DATE;
    lv_sum_enddate DATE;
    lv_partitioned_start_date DATE;
    lv_partitioned_end_date DATE;
    ln_errorcode NUMBER;
    lv_errormsg VARCHAR2(200);
    e_exception exception;
    BEGIN
    -- lv_summm_type_indicator is used as IN OUT parameter for SP_INS_SUMMARY_PARAMETERS procedure.
    lv_summm_type_indicator := pv_summm_type_indicator;
    PKG_SUMMARY_COMMON.SP_INS_SUMMARY_PARAMETERS(lv_table_name, pv_sum_enddate, lv_summm_type_indicator,
    lv_sum_startdate, lv_sum_enddate, ln_errorcode, lv_errormsg);
    --raise e_exception;
    IF ( lv_errormsg IS NOT NULL or LENGTH(lv_errormsg) <> 0 ) THEN
         raise e_exception;
    END IF;
    lv_summarizationrequired := PKG_SUMMARY_COMMON.FN_fetch_summarizationRequired(lv_table_name);
    IF( lv_summarizationrequired = 'Y' ) THEN
    BEGIN
    IF( lv_summm_type_indicator = c_summaryType_fullLoad) THEN
    PKG_SUMMARY_COMMON.SP_FETCH_PARTITION_DATE('ARTICLE_VIEWS',lv_sum_startdate,lv_sum_enddate,lv_partitioned_start_date,lv_partitioned_end_date);
    ELSE
    lv_partitioned_start_date := lv_sum_startdate;
    lv_partitioned_end_date := lv_sum_enddate;
    END IF;
    MERGE INTO av_summary_bysrccd
    USING
    (SELECT LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS SUMMARY_DATE,
    os.acctnum,
    ol.sourcecode AS sourcecode,
    ol.sourcename AS sourcename,
    count(1) cnt_articleview
    FROM article_views os , master_sourcecode ol
    where os.sourcecode = ol.sourcecode
    AND os.acctnum IS NOT NULL
    AND ol.sourcecode IS NOT NULL
    AND os.requestdatetime IS NOT NULL
    AND UPPER(os.success_ind) = 'S'
         AND (
              (lv_summm_type_indicator  = c_summaryType_fullLoad
              AND  (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
              AND   os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
              OR (lv_summm_type_indicator = c_summaryType_incrementLoad
              AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
    group by LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))),
    os.acctnum,ol.sourcecode,ol.sourcename) mrg_query
    ON (av_summary_bysrccd.acctnum = mrg_query.acctnum AND
    av_summary_bysrccd.summary_date=mrg_query.summary_date AND
    av_summary_bysrccd.sourcecode=mrg_query.sourcecode)
    WHEN NOT MATCHED THEN
    INSERT (SUMMARY_date,ACCTNUM,SOURCECODE,SOURCENAME,CNT_ARTICLEVIEW,ENTRY_LASTUPDATEDDATE)
    VALUES(mrg_query.summary_date,mrg_query.acctnum,mrg_query.sourcecode,mrg_query.sourcename,
    mrg_query.cnt_articleview,sysdate)
    WHEN MATCHED THEN
    UPDATE SET ods_av_summary_bysrccd.cnt_articleview=
    CASE WHEN NVL(lv_summm_type_indicator,c_summaryType_incrementLoad) = c_summaryType_fullLoad THEN mrg_query.cnt_articleview
    ELSE av_summary_bysrccd.cnt_articleview+mrg_query.cnt_articleview
    END,
    av_summary_bysrccd.entry_lastupdateddate=sysdate;
    PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_success,'');
    END;
    ELSE
    PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_failure,c_errordesc_summparamisN);
    END IF;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    BEGIN
    ROLLBACK;
    lv_errormsg := SQLERRM;
    ln_errorcode := SQLCODE;
    ln_count := PKG_SUMMARY_COMMON.FN_GET_COUNTOFTABLEINSUMMPARAM(lv_table_name,c_status_inprogress);
    IF ( ln_count <> 0 ) THEN
    PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_failure,lv_errormsg);
    END IF;
    COMMIT;
    raise_application_error(-20004,lv_errormsg);
    END;
    END SP_LOAD_SUMMARY_BYSRCCD;
    END PKG_AV_SUMMARY;Edited by: Chaitanya on Aug 29, 2011 1:56 AM
    Edited by: Chaitanya on Aug 29, 2011 2:06 AM

    Hi Sven,
    Unfortunately, requestdatetime is a varchar2 column. The source table which has this column had been created a long back and recently we have started to take care of this issue by loading data after converting it into date format.
    We have managed to locate the place in the logic where the error is occuring, but not why it might be occuring. Its due to the logic:-
         AND (
              (lv_summm_type_indicator  = c_summaryType_fullLoad
              AND  (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
              AND   os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
              OR (lv_summm_type_indicator = c_summaryType_incrementLoad
              AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
         )When I hardcoded the values for lv_summm_type_indicator, c_summaryType_fullLoad and c_summaryType_incrementLoad, the logic worked fine:
         AND (
              ('INCR'  = 'FULL'
              AND  (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
              AND   os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
              OR ('INCR'  = 'INCR'
              AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
         )But, the data for the pl sql variables is coming properly as I used dbms_output statements to check. So not sure what exactly is happening.

  • When merging workspace I get ORA-01403: no data found error in WMSYS.LT

    Hi,
    I am investigating an error in a remote system with very little info to go on apart from a stacktrace! This is what it says:
    java.sql.SQLException: ORA-01403: no data found
    ORA-06512: at "WMSYS.LT", line 6028
    ORA-06512: at line 1
    The context is an attempt to merge a child workspace into LIVE (LIVE being its direct parent).
    it is on Oracle Database 11.1.0.7.
    Can you advise what this error means? I am unable to dig deeper into it because the PL-SQL source code for WMSYS.LT is wrapped.
    thanks
    Simon

    Hi,
    Are you able to get a standard trace of the error from the remote database? ora-1403 errors can come from a number of places, so an errorstack trace is usually needed to determine the cause.
    Regards,
    Ben

  • ORA-02291 - ORA-02063 on merge with dml error logging through DB link

    Hello all,
    I have 2 DB's and I would like to merge records from A into B with dml error logging through a db link.
    Exemple:
    merge into B@dblink
    using (select ... from A where...)
    when matched then
    when not matched then
    log errors into err$_A reject limit unlimited;
    When I use this, and exception is thrown:
    ORA-02291: integrity constraint (B.constraint_name) violated - parent key not found
    ORA-02063: preceding line from dblink
    I've got no idea of what causes this.
    Could anyone please help me ?
    Thanks !
    Regards,
    TDE.

    Hello damorgan,
    Thanks for your answer.
    I've well understood that its was a foreign key violation, and I guess that's an error in the source: wee make only logical deletes, and I'm quite sure the problem is there.
    Anyway, I really would understand why dml error logging doesn't work in this case.
    I'll investigate and keep you informed.
    Regards.

  • Mapping with Match and Merge operater giving ORA-06550 error while deploy..

    Created a simplet mapping to source from Customer table to tstcustomer table thru' Match and Merge operator. The mapping validated successful but giving ORA-06550 line x column y error while deploying the mapping.
    It is a simple mapping consisting of source Customer table, Match and Merge operator, tstcustomer target table.
    Could anyone advise me on how to resolve this?

    The test mapping basically consists of :
    source table - sh.customers
    target table - tstcustomers (similar to sh.customers)
    Match-Merge operator.
    The mapping validation was successful but when attempt was made to deploy, its giving errors starting with ORA-06550.
    I saved the code and executed thru' SQL Plus and the error details are as follows:
    SQL> show errors;
    Errors for PACKAGE BODY MMTEST4:
    LINE/COL ERROR
    594/6 PL/SQL: Statement ignored
    594/37 PLS-00306: wrong number or types of arguments in call to 'RTRIM'
    601/6 PL/SQL: Statement ignored
    601/36 PLS-00306: wrong number or types of arguments in call to 'RTRIM'
    1017/655 PL/SQL: SQL Statement ignored
    30
    1020/27 PL/SQL: ORA-00942: table or view does not exist
    2163/6 PL/SQL: Statement ignored
    2163/43 PLS-00201: identifier 'CUSTOMERS_0_CUST_GENDER' must be declared
    2170/6 PL/SQL: Statement ignored
    LINE/COL ERROR
    2170/42 PLS-00201: identifier 'CUSTOMERS_0_COUNTRY_ID' must be declared
    2586/655 PL/SQL: SQL Statement ignored
    30
    2589/27 PL/SQL: ORA-00942: table or view does not exist
    SQL>
    For your info, the same mapping without Match-Merge Operator is getting deployed and executed successfully.
    But with Match-Merge operator, after setting Match bins, Match rules, Merge rules etc the mapping is validated successfully but errorring out while deployment.
    Pls advise on how to resolve this.
    I understand that the Match-Merge Operator gives Pl/Sql output from the documentation.
    thanks
    Naren.

  • Problem in merge statement -ORA-27432 Step does not exist for chain

    Hi
    I m getting ORA-27432 Step does not exist for chain error in merge statement.Please explain the same.
    MERGE INTO fos.pe_td_hdr_sd B
    USING (
             SELECT ACTIVE, ADDUID, ADDUIDTIME,TDKEY         FROM pe.pe_td_hdr
              WHERE  (adduidtime like '20070104%' or edituidtime like '20070104%')
              AND NVL(legacy_td,'N')<>'Y'
              AND SUBSTR(adduidtime,1,4)='2007'
              AND AMENDMENT_NO=0)A ON ( B.TDKEY = A.TDKEY)
      WHEN MATCHED THEN
        UPDATE SET B.ACTIVE=A.ACTIVE,
    B.ADDUID=A.ADDUID,
            B.ADDUIDTIME=A.ADDUIDTIME
      WHEN NOT MATCHED THEN
                      INSERT
                              B.ACTIVE,
                              B.ADDUID,
                              B.ADDUIDTIME)
                        VALUES(
                              A.ACTIVE,
                              A.ADDUID,
                              A.ADDUIDTIME)This query is a short version of the main query.It is same but having 180 columns in original table.

    What version of Oracle are you using? This message does not appear in my 10.1 Error Messages document, but the other messages in that range seem to be about DBMS_SCHEDULER.
    Are you using scheduler somewhere around where you are getting the error message?
    John

  • Error in MERGE statement - ORA-00969: missing ON keyword

    Hi All ,
    I am trying to write a Merge statement , but I am getting the below error .
       MERGE  INTO main_table m
                              USING  tab_1 l, tab_2 u
                              ON  (   l.col1        =  m.col1
                                       AND u.col2 = l.col2)
    When Matched then
    update........
    When not mached then
    Insert  ...... 
    But here I am using 2 tables in the USING clause . and here I am getting  this error :-
    142/17   PL/SQL: SQL Statement ignored
    143/42   PL/SQL: ORA-00969: missing ON keyword
    May I know where i am doing wrong ?

    Hi LuKKa, you are on the Portugues Forum, but we can help you, try the code mentioned below:
       MERGE  INTO main_table m
                              USING  (select l.col1, l.col2, u.col2 from tab_1 l join tab_2 u on (u.col2 = l.col2)) t
                              ON  (t.col1 =  m.col1)
    When Matched then
    update........
    When not mached then
    Insert  ......  
    Regards.

  • ORA 22813 in merge statement

    hi gems..good afternoon...
    My database version is 11.2.0.1.0 64 bit Solaris OS.
    I am facing an "ORA-22813: operand value exceeds system limits" while running a procedure.
    I have used loggers and found that it is getting failed in a MERGE statement.
    That merge statement is used to merge a table with a collection. the code is like below:
    MERGE /*+ INDEX(P BALANCE_HISTORIC_INDEX) */
        INTO BALANCE_HOLD_HISTORIC P
        USING TABLE(GET_BALANCE_HIST(V_MERGE_REC)) M
        ON (P.CUSTOMER_ID = M.CUSTOMER_ID AND P.BOOK_ID = M.BOOK_ID AND P.PRODUCT_ID = M.PRODUCT_ID AND P.SUB_BOOK_ID = M.SUB_BOOK_ID AND)
        WHEN MATCHED THEN
          UPDATE
             <set .....>
        WHEN NOT MATCHED THEN
          INSERT<.....>The parameter of the function GET_BALANCE_HIST(V_MERGE_REC) is a table type.
    Now the function GET_BALANCE_HIST(V_MERGE_REC) is a pipelined function and we have used that because the collection V_MERGE_REC may get huge with data.
    This proc was running fine from the beginning but from day before yesterday it was continously throwing ORA 22813 error in that line.
    please help..thanks in advance..

    hi paul..thanks for your reply...
    the function GET_BALANCE_HIST is not selecting data from any tables.
    What this pipeline function is doing is, it is taking the huge collection V_MERGE_REC as parameter and releasing its datas in pipelined form. The code for the functions is :
    CREATE OR REPLACE FUNCTION GET_BALANCE_HIST(P_MERGE IN TAB_TYPE_BALANCE_HISTORIC)
      RETURN TAB_TYPE_BALANCE_HISTORIC
      PIPELINED AS
      V_MERGE TAB_TYPE_BALANCE_HISTORIC := TAB_TYPE_BALANCE_HISTORIC();
    BEGIN
      FOR I IN 1 .. P_MERGE.COUNT LOOP
        V_MERGE.EXTEND;
        V_MERGE(V_MERGE.LAST) := OBJ_TYPE_BALANCE_HISTORIC(P_MERGE(I).CUSTOMER_ID,
                                                 P_MERGE(I).BOOK_ID,
                                                 P_MERGE(I).PRODUCT_ID,
                                                 P_MERGE(I).SUB_BOOK_ID,
                                                 P_MERGE(I).EARNINGS,
                                                 P_MERGE(I).EARNINGS_HOUSE,
                                                 P_MERGE(I).QUANTITY,
                                                 P_MERGE(I).ACCOUNT_INTEGER);
      END LOOP;
      FOR J IN 1 .. V_MERGE.COUNT LOOP
        PIPE ROW(OBJ_TYPE_BALANCE_HISTORIC(V_MERGE(I).CUSTOMER_ID,
                                                 V_MERGE(I).BOOK_ID,
                                                 V_MERGE(I).PRODUCT_ID,
                                                 V_MERGE(I).SUB_BOOK_ID,
                                                 V_MERGE(I).EARNINGS,
                                                 V_MERGE(I).EARNINGS_HOUSE,
                                                 V_MERGE(I).QUANTITY,
                                                 V_MERGE(I).ACCOUNT_INTEGER));
      END LOOP;
      RETURN;
    END;I think the error is comming because of the parameter value of V_MERGE_REC. Since it is huge, so loading that into memory is causing problem. But in this case, how can I resolve it?? Can I use a global temporary table for this??
    Please suggest...

  • ORA-00904 in Merge statement

    I encountered with ORA-00904 in Merge statement. I fixed the error but I don't know why. Would you please help me explain it? Thanks in advance. The following is the detail description of my question.
    I have two tables TBL_A<col1 integer,col2 integer> TBL_B<col1 integer,col2 integer> and an anonymous block to test executed in Oracle 10gR2.
    DECLARE
    V_NUM INTEGER;
    BEGIN
    V_NUM := 1;
    /*merge I it's okay.the function of merge seems meaningless, please pay attention to its grammar*/
    MERGE INTO TBL_A A
    USING (SELECT V_NUM N, COL1, COL2 FROM TBL_B) B
    ON (A.COL1 = B.N)
    WHEN MATCHED THEN
    UPDATE SET A.COL2 = B.COL2;
    /*merge II*/
    /*ora-00904*/
    MERGE INTO TBL_A A
    USING (SELECT V_NUM, COL1, COL2 FROM TBL_B) B
    ON (A.COL1 = V_NUM)
    WHEN MATCHED THEN
    UPDATE
    SET A.COL2 = B.COL2;
    /*merge III is okay*/
    MERGE INTO TBL_A A
    USING (SELECT COL1, COL2 FROM TBL_B) B
    ON (A.COL1 = V_NUM)
    WHEN MATCHED THEN
    UPDATE
    SET A.COL2 = B.COL2;
    COMMIT;
    END;
    I traced the 904 error and it seems the point is in the binding of variable V_NUM. But I don't know the exact reason. I think maybe it relates with the parse of PL/SQL. Would someone please help me or give me some hints?

    hi,
    When you saye,
       MERGE INTO TBL_A A
        USING (SELECT V_NUM,
                      COL1,
                      COL2
                 FROM TBL_B) B
           ON (A.COL1 = V_NUM)
       WHEN MATCHED
       THEN
          UPDATE SET A.COL2 = B.COL2;
    In the above for ON (A.COL1 = V_NUM)
    oracle treats v_num as a variable in the procedure rather than v_num returned from using clause.
    So you need to alias that.
    MERGE INTO TBL_A A
        USING (SELECT V_NUM as somecol,
                      COL1,
                      COL2
                 FROM TBL_B) B
           ON (A.COL1 = b.somecol)
       WHEN MATCHED
       THEN
          UPDATE SET A.COL2 = B.COL2;Edited by: Ganesh Srivatsav on May 12, 2011 11:42 AM
    Added alias after peter pointed out for variable in the using.

  • ORA-02291 during MERGE on self-referenced table

    Hello,
    I encountered error ORA-02291 when I tried to use MERGE statement on the table with "self-referenced" foreign key. Using the foreign key deferrable did not help. The only one thing, which helped me, was using errorlog table. See the demonstration:
    Working as common user:
    SQL> CONNECT scott/tiger
    First of all, I create table and (not deferrable) constraints:
    CREATE TABLE fkv (
         id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
         parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    INSERT is working well:
    INSERT INTO fkv (
         id,
         parent_id
    SELECT
    1,
    1
    FROM
    DUAL;
    COMMIT;
    1 rows inserted.
    commited.
    MERGE statement using UPDATE branch is working well too:
    MERGE INTO fkv USING (
    SELECT
    1 AS ID,
    1 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    COMMIT;                                        
    1 rows merged.
    commited.
    And now is coming the strange behaviour:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    SQL Error: ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ROLLBACK;
    rollback complete.
    Ok, even it is not a good solution, I try deferrable constraint:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(id) DEFERRABLE INITIALLY DEFERRED;
    table FKV altered.
    table FKV altered.
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    1 rows merged.
    COMMIT;
    SQL Error: ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ... deffered constraint did not help :-(
    Let's try another way - errorlog table; for the first with the not deferrable constraint again:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    table FKV altered.
    table FKV altered.
    BEGIN
    sys.dbms_errlog.create_error_log (
    dml_table_name => 'FKV',
    err_log_table_name => 'ERR$_FKV'
    END;
    anonymous block completed
    Toys are prepared, let's start with error logging:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID)
    LOG ERRORS INTO err$_fkv;
    1 rows merged.
    Cannot belive, running SELECT for confirmation:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Ok, COMMIT:
    COMMIT;
    commited.
    SELECT for confirmation again:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Using deffered constraint and error logging is working well too.
    Metalink and Google did not help me. I am using databases 10.2.0.5 and 11.2.0.3.
    Has somebody encountered this problem too or have I missed something?
    Thank you
    D.

    drop table fkv;
    CREATE TABLE fkv (
    id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
    parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    CREATE INDEX PK_FKV_ID ON FKV(ID);
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE FKV ADD CONSTRAINT FK_FKV_PAID FOREIGN KEY (PARENT_ID) REFERENCES FKV(ID);Now run your MERGE statement and it works with non deferrable constraints.
    Personally, I would contact support about this before depending on it in production.
    P.S. I was not able to reproduce your findings that dropping and re-adding the constraints changes things. I suspect that when you dropped the constraint the index was NOT dropped, so you kept a non-unique index.
    Try again using ALTER TABLE FKV DROP CONSTRAINT PK_FKV_ID drop index;

Maybe you are looking for