problem compiling with MERGE statement

What is the problem with this merge statement?

When I compile I get the message
met symbol IN when one of the following expected
*:= . (@ %; < a SQL > *)

MERGE INTO PF_REP_TEMP HAS
WITH THE HELP OF PF_REP_SKS B
WE (a. pf_userid = "FINP' AND B.pfbatch = 'F99' and B.pfstfno = A.pf_staffno
and B.pfcc = "7" and B.pftransmy = A.mmyy and B.slno = A.s_no)
When matched then
game update
a.pfwdrlm = b.pfwdrlm,
a.PFRC = b.PFRC;

Help, please

(version of the form is 10g, 11g database version)

How to perform a merge into forms button pressed trigger command

Tags: Database

Similar Questions

  • problem compiling with gcc 4.7.3 dbstl

    Hello

    my project uses dbstl and will not compile with gcc 4.7.3 und Linux x 86, unless I'm using - fpermissive. I tried different versions of db between 4.8 and 6.0.20 without success. In fact

    do exstl_advancedfeatures

    below, already, fails. There seems to be problems with name resolution. I couldn't find anything on the issue. Is it known? If not, where should I report it?

    Best,

    Andreas

    brand exstl_advancedfeatures output:

    . / libtool - mode = compilation g ++-I / examples/stl - c - I.-j' have... / SRC-D_GNU_SOURCE-D_REENTRANT-O3-I... / lang/cxx/STL... /examples/STL/StlAdvancedFeatures.cpp

    libtool: compile: g ++-I / examples/stl - c - I.-j' have... / SRC-D_GNU_SOURCE-D_REENTRANT-O3-I... / lang/cxx/STL... /examples/STL/StlAdvancedFeatures.cpp - fPIC - DPIC-o.libs/StlAdvancedFeatures.o

    In file included from... examples/STL/StlAdvancedFeatures.h:32:0.

    Of... /examples/STL/StlAdvancedFeatures.cpp:9:

    .. «/lang/cxx/STL/dbstl_vector.h: in the instantiation of the ' dbstl::db_vector_iterator < T, value_type_sub >: auto & dbstl::db_vector_iterator < T, value_type_sub >: operator ++ () [with T = char *; value_type_sub = dbstl::ElementHolder < char * >; < T, value_type_sub > dbstl::db_vector_iterator: auto = dbstl::db_vector_iterator < tank *, dbstl::ElementHolder < tank * > >]» :

    .. /examples/STL/StlAdvancedFeatures.h:663:26: required here

    .. /lang/cxx/STL/dbstl_vector.h:859:3: error: 'move_by' was not declared in this scope, and no declaration found by dependent on research of an argument when instantiating [-fpermissive]

    .. /lang/cxx/STL/dbstl_vector.h:859:3: Note: basic statements depending on "dbstl::db_vector_base_iterator < char * > ' cannot find search for the absolute

    .. /lang/cxx/STL/dbstl_vector.h:859:3: Note: use 'this-> move_by' instead

    [...]

    Hello

    We have fixed all the problems of compiling for dbstl in the development branch.

    So what version do you use?  Next, we'll create the patch for the specific version.

    Kind regards

    -Winter

  • Problem in the Merge statement

    Hi all

    I use the merge updated statement 30000 records of tables having 55 records of Lakes.
    But it takes a lot of time as I kill the session after 12 hours, as it was still ongoing.

    So, the same day I m using cursors, it will end in less than 3 hours.

    I used merge is: -.

    MERGE IN Table1 a
    USING (SELECT MAX (TO_DATE (TO_CHAR (contact_date, "dd/mm/yyyy")
    || contact_time,
    "jj/mm/aaaa HH24:Mi:SS".
    )
    ) m_condate,.
    appl_id
    FROM Table2 b,.
    (SELECT DISTINCT acc_no acc_no
    IN table 3, Table1
    WHERE acc_no = appl_id AND delinquent_flag = 'Y '.
    AND financier_id = 'NEWACLOS') d
    WHERE d.acc_no = b.appl_id
    AND (contacted_by IS NOT NULL
    OR followup_branch_code IS NOT NULL
    )
    GROUP BY appl_id) c
    WE (a.appl_id = c.appl_id AND a.delinquent_flag = 'Y')
    WHEN MATCHED THEN
    UPDATE
    SET last_contact_date = c.m_condate;

    In this query, table 1 has 30000 documents and table 2 and table 3 have records 3670955 and 555674 respectively.

    Please suggest, what I'm doing wrong with merger, because according to my understanding merge statement is much better than the updates or updates using cursors.

    Required info is as follows:

    SQL > show the user_dump_dest parameter

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    user_dump_dest string/opt/oracle/admin/FINCLUAT/udu
    MP
    SQL > show parameter optimizer

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    optimizer_dynamic_sampling integer 2
    optimizer_features_enable string 10.2.0.4
    optimizer_index_caching integer 0
    OPTIMIZER_INDEX_COST_ADJ integer 100
    the string ALL_ROWS optimizer_mode
    optimizer_secure_view_merging Boolean TRUE
    SQL > show parameter db_file_multi

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    db_file_multiblock_read_count integer 16
    SQL > show parameter db_block_size

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    Whole DB_BLOCK_SIZE 8192
    SQL > column sname format a20
    SQL > column pname format a20
    SQL > column pval2 format a20
    SQL > select
    2 sname,
    3 pname,
    pval1 4,.
    5 pval2
    6 of
    7 sys.aux_stats$;
    sys.aux_stats$
    *
    ERROR on line 7:
    ORA-00942: table or view does not exist


    Elapsed time: 00:00:00.05
    SQL > explain the plan for
    2 - Put your statement here
    3 MERGE IN one cs_case_info
    4 USE (SELECT MAX (TO_DATE (TO_CHAR (contact_date, "dd/mm/yyyy")
    5                          || contact_time,
    6 'dd/mm/yyyy HH24:Mi:SS.
    7                          )
    (8) m_condate,
    9 appl_id
    CS_CASE_DETAILS_ACLOS 10 b,
    11 (SELECT DISTINCT acc_no acc_no
    12 OF NEWACLOS_RESEARCH_HIST_AYLA, cs_case_info
    13 WHERE acc_no = appl_id AND delinquent_flag = 'Y '.
    14 AND financier_id = "NEWACLOS") d
    15 WHERE d.acc_no = b.appl_id
    16 AND (contacted_by IS NOT NULL
    17 GOLD followup_branch_code IS NOT NULL
    18                )
    C 19 GROUP BY appl_id)
    20. WE (a.appl_id = c.appl_id AND a.delinquent_flag = 'Y')
    21. WHEN MATCHED THEN
    UPDATE 22
    23 SET last_contact_date = c.m_condate
    24;

    He explained.

    Elapsed time: 00:00:00.08
    SQL > select * from table (dbms_xplan.display);

    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------------------------------------

    --------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU).
    --------------------------------------------------------------------------------------------------
    | 2 > MERGE STATEMENT | 47156 | 874K | 128K (1) |
    | 1. MERGE | CS_CASE_INFO |
    | 2. VIEW |
    | 3. HASH JOIN | 47156 | 36 M | 5672K | 128K (1) |
    | 4. VIEW | 47156 | 5111K | 82339 (1) |
    | 5. GROUP SORT BY | 47156 | 4236K | 298 M | 82339 (1) |
    | 6. HASH JOIN | 2820K | 247 M | 10 M | 60621 (1) |
    | 7. HASH JOIN | 216K | 7830K | 6985 (1) |
    | 8. VIEW | the index $ _join$ _012 | 11033. 258K | 1583 (1) |
    | 9. HASH JOIN |
    | 10. INDEX RANGE SCAN | IDX_CCI_DEL | 11033. 258K | 768 (1) |
    | 11. INDEX RANGE SCAN | CS_CASE_INFO_UK | 11033. 258K | 821 (1) |
    | 12. FULL RESTRICTED INDEX SCAN FAST | IDX_NACL_RSH_ACC_NO | 5539K | 68 M | 5382 (1) |
    | 13. TABLE ACCESS FULL | CS_CASE_DETAILS_ACLOS | 3670K | 192 M | 41477 (1) |
    | 14. TABLE ACCESS FULL | CS_CASE_INFO | 304K | 205 M | 35975 (1) |
    --------------------------------------------------------------------------------------------------

    Note
    -----
    -"PLAN_TABLE' is old version

    24 selected lines.

    Elapsed time: 00:00:01.04
    SQL > rollback;

    Complete restoration.

    Elapsed time: 00:00:00.03
    SQL > set autotrace traceonly arraysize 100
    SQL > alter session set events 10046 name context forever, trace level 8';
    ERROR:
    ORA-01031: insufficient privileges


    Elapsed time: 00:00:00.04
    SQL > disconnect
    Disconnected from the database to Oracle 10 g Enterprise Edition Release 10.2.0.4.0 - Production 64-bit
    With partitioning, OLAP, Data Mining and Real Application Testing options
    SQL > spool off

    Published by: user4528984 on May 5, 2009 22:37

    Create indexes for tables. CS_CASE_DETAILS_ACLOS, CS_CASE_INFO

    also try to use the underside of suspicion

    (SELECT / * + no_merge * / SEPARATE acc_no acc_no)
    IN table 3, Table1

    HTH

  • Problem with merge statement

      CREATE TABLE "XCR_DAILY_JOB_STATUS" 
       (     "CAMPAIGN_ID" VARCHAR2(50 BYTE), 
         "REPORTING_DATE" DATE, 
         "REPORT_TYPE" CHAR(10 BYTE), 
         "STATUS" NUMBER(1,0) DEFAULT 0, 
         "CREATED_DTTM" DATE DEFAULT sysdate, 
         "UPDATED_DTTM" DATE
       );
    create or replace
    FUNCTION fn_update_job_status (
       p_campaign_id      VARCHAR,
       p_process_date     DATE,
       p_report_type      VARCHAR,
       p_process_status   NUMBER
    )
       RETURN NUMBER
    IS
       PRAGMA AUTONOMOUS_TRANSACTION;
       v_campaign_id      VARCHAR (50)    := TRIM (p_campaign_id);
       v_process_date     DATE            := p_process_date;
       v_process_status   PLS_INTEGER     := p_process_status;
       v_report_type      VARCHAR (32)    := upper(trim(p_report_type));
       v_err_num          PLS_INTEGER     := 0;
       v_error_message    VARCHAR2 (4000);
    BEGIN
      
      dbms_output.put_line(v_campaign_id || v_process_date || v_report_type || v_process_status);
       MERGE INTO xcr_daily_job_status a
          USING (SELECT v_campaign_id AS campaign_id,
                        v_process_date AS reporting_date,
                        v_report_type AS report_type, v_process_status AS status
                   FROM DUAL) b
          ON (    upper(a.campaign_id) = upper(b.campaign_id)
              AND a.reporting_date = b.reporting_date
              AND a.report_type = b.report_type)
          WHEN MATCHED THEN
             UPDATE
                SET a.status = b.status,
                a.updated_dttm = SYSDATE
          WHEN NOT MATCHED THEN
             INSERT (a.campaign_id, a.reporting_date, a.report_type, a.status,
                     a.created_dttm)
             VALUES (b.campaign_id, b.reporting_date, b.report_type, b.status,
                     SYSDATE);
       COMMIT;
       RETURN v_process_status;
    EXCEPTION
       WHEN OTHERS
       THEN
          v_err_num := SQLCODE;
          v_error_message := SUBSTR (SQLERRM, 1, 4000);
          DBMS_OUTPUT.put_line ('Error code ' || v_err_num || ': '
                                || v_error_message
                               );
          ROLLBACK;
          RETURN v_err_num;
    END;
    When I train this time two
    select fn_update_job_status('cmp12105', to_date('17-JAN-2013','DD-MON-YYYY'), 'AUDIENCE', 1) from dual;
    Instead of update of the old line, it will create the new line: (.)

    What could be the problem?

    Published by: Mr. lonely on 14 March 2013 15:05

    Is why REPORT_TYPE is of type CHAR (10 BYTES) in the table and v_report_type is of type VARCHAR (32) in proc, and then you do not need TRIM.
    I suggest to use VARCHAR2 to both with the same length.

    And also fix the date in proc comparison, AND trunc (a.reporting_date) = trunc (b.reporting_date)

    Solve these and your problem will be solved, I tried and its working fine now.

    Kind regards
    Ankit Rouault
    http://oraclenbeyond.blogspot.in

  • problem compiling with references to projects

    Hello

    I developed as a framework and I'm trying to bring to BB10.

    I have four static libraries, have references to others.

    I create a project test using the four libraries and checked in the window references my four libraries (QNX IDE: project properties / general ad for C/C++ /Paths symbols / References).

    When I compile I have many ' reference "..." "undefined error. I know that I can change the order of the links, but it is not enough to solve some "circular" linking problems.

    I already had this problem when I compiled the framwork for Android, but in the makefile, I was able to link several times with the same library (example:)

    Project4.a
    Project1.a

    Project3.a
    Project1.a
    Project2.a
    )
    But I can't, or I don't know how I can do it in QNX IDE.

    No idea how I can do to link all my projects properly please?

    Thanks a lot for your help.

    You should put all your libraries to be used by the editor of links here:

    Build properties of the project-> C/C++/QCC Linker-> library-> library (-l)

  • Problem compiling with Xcode plugin sample

    Hi all

    I'm having a problem of compiling a sample plugin in the SDK ("BasicPlugin") using Xcode on Mac OS. Xcode build error is "name"CursHandle"unknown type". The error occurs in two source files: AVExpT.h and SafeResources.h. I can't find any header provided with the Acrobat SDK kit that defines the type of CursHandle.

    I'm on Mac OS 10.8.4 and Xcode 4.6.3.

    The SDK documentation says that the SDK is only compatible with Xcode 2.x; elsewhere in the documentation it says that it was compatible with Xcode 3.2 and 3.3. What is the reason for the above error? It is not possible for me to install the old version of Xcode, because I'm running 10.8 OX, and older versions are not compatible.

    I would be very grateful for any help.

    Paul

    Yes, the software SDK still uses characteristic of carbon (even if Acrobat itself does not use anything carbon).   Therefore, you need an older version of Xcode that talks about carbon.

    Consider using a virtual machine from a certain flavor to run an earlier version of Mac OS and Xcode.

  • MERGE statement is increment the sequence. It problem?


    Hi all

    I use a merge statement to update thousands of data in a table. If the criteria does not match (WHEN NOT MATCHED) I wrote an insert statement that contains a reference to the sequence. And it works very well.

    My question is, will this increment also sequence even though it won't insert the statement in the script of fusion. I think it will be. Right?

    Say, I update 20K record will be the sequence also increment by 20 times k. If his past all work around.

    Thanks in advance.

    Here is a less effective solution to your problem that creates a function to get the value of the following sequence, but I agree with Justin cave that because of the cache you must lose the values.

    SQL > CREATE SEQUENCE s_emp;

    Order of creation.

    SQL > CREATE or REPLACE FUNCTION s_emp_nextval

    2 RETURN NUMBER

    3 AS

    4 v_nextval NUMBER;

    5 BEGIN

    6. SELECT s_emp.nextval

    7 INTO v_nextval

    8 DOUBLE;

    9 v_nextval of RETURN;

    10 END;

    11.

    The function is created.

    SQL > MERGE IN emp t (USING)

    2. SELECT empno, ename

    3 FROM emp) s

    4. WE (t.empno = s.empno)

    5. WHEN MATCHED THEN

    UPDATE 6

    7 SET t.ename = s.ename

    8 WHEN NOT MATCHED THEN

    9 INSERT (empno, ename)

    10 VALUES (s_emp_nextval, 'SMITH');

    14 lines merged.

    SQL > SELECT s_emp. NEXTVAL

    2 FROM dual;

    NEXTVAL

    ----------

    1

  • ORA-30926 on MERGE statement, occurs only with PARALLEL, success without PARALLEL hint hint.

    Hi Experts,

    I write under the MERGE statement. In this cardinality of the table_a table_b is 1:2. That is, each record of table_b corresponds to 2 records in table_a based on columns in CLAUSE.

    Well, this query throws below error.

    -Error-

    ORA-12801: error reported in the P011 parallel query server

    ORA-30926: failed to get a stable set of rows in the source tables

    However, the same statement runs successfully what tip PARALLEL is removed altogether. (There are no duplicates in table_b based on unity, group, loc columns.)

    Please sugget if anything look his place here or causes possible.

    -Request-

    MERGE / * + PARALLEL (8) * /.

    IN table_a a

    With the HELP of table_b b

    ON (a.unit = b.unit

    AND a.group = b.group

    AND a.loc = b.loc)

    WHEN MATCHED

    THEN UPDATE

    SET a.u_pushonly = b.u_pushonly

    a.u_seasonind = b.u_seasonind,

    a.eff = BOX

    WHEN b.u_season_start_dt <>TO_DATE('01/01/1970','DD/MM/YYYY')

    OR b.u_season_end_dt <>TO_DATE('01/01/1970','DD/MM/YYYY')

    OR b.u_pushonly = 1

    THEN more GRAND (NVL (b.u_assortment_start_dt, TO_DATE('01/01/1970','DD/MM/YYYY'))

    b.u_season_start_dt)

    Of OTHER NVL (b.u_assortment_start_dt, TO_DATE('01/01/1970','DD/MM/YYYY'))

    END;

    kendenny wrote:

    Fusion requires that columns be unique in both tables. Given that you only update was not insert is not put in correspondence, then you can use a single update statement.

    I don't think so, it requires only NEW data is unique. Informal argument: a single line in the new table can update several lines in the table of old, but you can not use several lines in the new table to update a single row in the old table.

    However, I wonder if something went wrong with the parallelism so that the lines with the same VALUES for the data (old) table_a has been distributed through many slaves, leading to several slaves, trying to update each on the other lines.  (I don't see how this could happen, but it's one of the problems with bugs - if she should not deceive you, it can be difficult to imagine how it's bad).

    To the OP - this sounds like something, you need to trigger an SR for (after a search of MOS).

    Concerning

    Jonathan Lewis

  • Problem with MERGE INTO setting

    Oracle Hello community,

    Server: 11.1.0.7

    My MERGE statement is very slow. I cut again and made a single update and a single insert statement, and it is much faster, the cause of a suspicion / * + rule * / use. When I try to use the same trick for the MERGE statement, it won't work, it still takes much too long. Before I post my Merge statement, is the problem with advice and FUSION?

    Ikrischer

    Thanks for all the entries that you have provided.

    What intrigues me is the fact that your cardinalities are always 1.
    (Unfortunately I have no available DB 11.1)

    When I run the routine, all the tables are empty and all tables are analysed.

    Can you describe your routine more in detail?
    What measures are being processed?
    Is it a kind of ETL process? At what point in your process are you collecting statistics and how?
    Are you really using the command "scan table", or are you using "dbms_stats.gather_table_stats?

  • Problem with diagram State Toolkit 1.0 - LV 8.2 upgrade to 2014

    I'm in transition a large amount of code from Labview 8.2 to 2014, and I'm having a problem with state diagrams have been added using the state diagram Toolkit V1.0.

    The figure below shows the question, Labview knows the loop and its components are associated with a state diagram, but it option to change the schema, "change the state diagram," is not available.  In Labview 8.2, which I am currently running on older machines, I would simply select "Change the state diagram" and another window of each State and arrows between States appears, allowing the mounting of the diagram.

    I think I have to install the state diagram Toolkit V1.0 software, but it is no longer available on the Web site of NOR.  There are new States transitions module I installed, but it is significantly different from the old Toolbox and does not support.  Any recommendations?

    Thank you very much
    Phil

    Good news:

    (1) SDE still works with SP1 LV2014.

    (2) I have the installer and I'm ready to send it to you. Please send me a private message with your email address.

    Be sure to support this idea.

  • Problem with the State showed up in BB10

    Hello

    After the upgrade of my DevAlpha to the latest version, 10.0.9.1675, I have problems with 2-State buttons.

    Example code:

    #myBtn{
        background-image: url(btn/myBtn.png);
        background-repeat: no-repeat;
        background-position: 0px 0px;
    }
    #myBtn:hover{
        background-position: 0px -124px;
    }
    

    So, when I click the button it stay frozen until steady-state, does not return to the default position. All my apps of ww are affected by this problem.

    Anyone can attempt to reproduce this problem?

    If so, what is the solution?

    This is sort of the standard: hover behaviour I noticed in mobile browsers. Since then no cursor, hover is only simulated.

    The simplest solution (and the one I use in my projects) is to use: active instead of: hover.

    #myBtn:active{
        background-position: 0px -124px;
    }
    
  • problem with loop module_data liquid with if statement

    I'm having a problem to the below statement inside the loop function for. I works very well outside the loop on a single post, but don't seem to take the entitlement when inside.

    {module_data resources = "blogposts' version ="v3"field model = 'PostFeaturedImage, release to id Date, postTitle, postBody,' =" "order =" "-id" limit = "5" skip = '3' = 'blogPosts' collection}

    {% for section in blogPosts.items%}

    {% If item.postFeaturedImage == "" %}}

    {% assign item.postFeaturedImage = ' / _assets/img/default_blog_picture.jpg '-%}

    {% endif %}

    < div class = "row" >

    < div class = "great-4 columns" >

    < p > < a href = "{{item.postUrl}}" title = "Read more" > < img src = "{{item.postFeaturedImage}}? Action = thumbnail & width = 1200 & height = 600 & algorithm = fill_proportional"alt ="{{item.postTitle}}"/ > < /a > < /p >

    < / div >

    < div class = "big-8 columns" >

    < h5 > < a href = "{{item.postUrl}}" title = "{{item.postTitle}}" > {{item.postTitle: capitalize}} < /a > < / h5 >

    < p > {{item.releaseDate | date: "dddd, MMMM yyyy"}} {{item.CAT}} < /p >

    < p > {{item.postBody | truncate: 220}} < /p >

    < a href = '{{item.postUrl}}' class 'more' = > read more < class i 'icon-angle-right' = > < / i > < / a >

    < / div >

    < / div >

    < hr >

    {% endfor %}

    Thanks in advance for any input.

    Not to assign the same name value.

    Assign a value with a new image name recommended before the, then this name within the FI, or just do an else if.

    {% If item.postFeaturedImage == ""-%}

    {% assign itemImage = ' / _assets/img/default_blog_picture.jpg '-%}

    {%-%}

    {assign = item.postFeaturedImage-% itemImage %}

    {endif %}

    {{itemImage}} to your image

  • Major audio problem with merged Clips

    Try this once again, having a major problem since update works with merged clips.  I merge all my video and audio clips into a project of prior work flow in first pro.  I'll be shooting my images, tagged and synchronized in the project.

    Because the first does not have more than 1 project open at the same time, I copied the files, closed before workflow project and opened my feature film project that I worked for.  Copied clips merged bin, I click on a clip, video plays well, but there is no audio playback.

    I try to import the project files of prior workflows by using the import project feature, keep that real merged clips (like the rest of my project is this way) still no sound.  I cleaned my cache of media, reset preferences, even uninstalled first and redownloaded.  Problem persists.

    Can you help me understand what the question is whether I can go back to making progress on this feature of finishing project?

    Here's my workflow and no problems so far.  I do it this way because I found after all files in the project was originally crash constantly when I was working.  I have a new I7' processor IMac with 24 GB of RAM.  And since the first does not allow to open multiple projects at the same time (wish it would change.  Avid and FCP both allowed several projects) that I have to do things this way.

    Before workflow project file

    Label all the video and Audio files to match the scene #' / takes

    The value in points on all the video and audio in order to reflect the slate

    Merge Clips

    Functional project file

    Import only Clips merged into Project.  Import or copy/paste

    Now, I did this workflow from the beginning about.  Removing all the source video and all the audio clips of my work project remain while my bins containing my merged clips.  Had no problem and edit has been smooth.  Did a day pickup last week, followed the same steps as I did in the past, imported clips merged into my work project and clips have audio, set to none by default.  Now, once I'm in the sequence I can manually set and this is, but I can't read the audio data in the source monitor, which is how to change, there is no reason, I should have to go back in the manner of the crappy editing with FCP copy and paste from a sequence.

    Able to repro.  Bug was noted.

  • Problem with merged webhelp

    Dear Sir.

    My problem is with the merged Webhelp project. links to external topics are not active in the main project, although these links work fine in the HTML help output.

    Thank you.

    Have you tried immediately to the notice to this link?

  • Different result by using the MERGE statement

    I have 2 SQL statements:

    MERGE INTO PT_CQS_AGGR APC

    With the HELP of PT_CQS_AGGR_TEMP Lady

    WE (concat (concat(pca.from_city_id,pca.to_city_id), pca.query_timestamp_hh) = concat (concat(pcah.from_city_id,pcah.to_city_id), pcah.query_timestamp_hh))

    WHEN MATCHED THEN

    Setting a DAY SET pca.search_count = pca.search_count + pcah.search_count

    WHEN NOT MATCHED THEN

    VALUES of INSERTION (to_city_id, query_timestamp_hh, from_city_id, search_count) (pcah.from_city_id, pcah.to_city_id, pcah.query_timestamp_hh, pcah.search_count);

    AND

    MERGE INTO PT_CQS_AGGR APC

    With the HELP of PT_CQS_AGGR_TEMP Lady

    WE (pca.from_city_id = pcah.from_city_id AND pca.to_city_id = pcah.to_city_id AND pca.query_timestamp_hh = pcah.query_timestamp_hh)

    WHEN MATCHED THEN

    Setting a DAY SET pca.search_count = pca.search_count + pcah.search_count

    WHEN NOT MATCHED THEN

    VALUES of INSERTION (to_city_id, query_timestamp_hh, from_city_id, search_count) (pcah.from_city_id, pcah.to_city_id, pcah.query_timestamp_hh, pcah.search_count);

    First statement correctly the merged data, but use FULL TABLE SCANS, so it's rather slow. Second statement using a UNIQUE INDEX on the columns from_city_id, to_city_id, and query_timestamp_hh on the MAP of EXPLAIN, but during the execution of I've got ORA-00001: unique constraint (PODOWNER. IDX_CQS_AGGR_3COL) violated. What is the problem with the second statement - especially with this line:

    WE (pca.from_city_id = pcah.from_city_id AND pca.to_city_id = pcah.to_city_id AND pca.query_timestamp_hh = pcah.query_timestamp_hh)

    Can I use a more complex condition in the MERGE statement? Because it seems that not all the conditions have been taken...

    ???

    Select pcah.from_city_id, pcah.to_city_id, PT_CQS_AGGR_TEMP Lady pcah.query_timestamp_hh

    less

    Select pca.from_city_id, pca.to_city_id, pca.query_timestamp_hh PT_CQS_AGGR pca

    somewhere the conditions limiting the time.

    (or whatever the columns make up the stress of failing)

    In addition, select for each column in the constraint of failure where the column is null.  If one of these columns is null, equality fails, even if both are null, because null <> null.  So you will get a "no match" if all values are the same and it is set to null.

    Edit: Oh, slap forehead, that is why one works and the complete analysis.  As SomeoneElse said, it normalizes the type of data and concatenates, comparison null to no effect and refusing all usual index.

Maybe you are looking for