Using Merge In BO Edge 3.0 wi an XL Spreadsheet

I have a quey written against our data warehouse and I am trying to use an Excel 07 Spreadsheet to "filter" the data.  I have followed every thread I can find on the subject, downloaded the BO Edge PDF and read over the section on Merging data more times than I care to mention and I still connot get the merge to work!  When I view my report in Edge, it does not seem to be restricting the data to what is in both sources, however, when I save the report as an XL spreadsheet, the correct data is there.  Anybody experience this, and more importantly, anyone have a solution????

Hi Mohan,
there is no difference between Edge and Enterprise regarding the Client/Server Tool separation. Your client tools are in both cases part of the server download package.
After unzipping the files, there ought to be some folders which include the files of the client tool installation. The Universe Designer is also part of the Edge Client tools.
Best regards,
Sebastian

Similar Messages

  • When I use Merge duplicate Values

    Hi
    When I use MERGE for to INSERT It is duplicating values, I put condition in ON
    MERGE                         /*+  append nologging */ INTO sysadm.ps_loc_item_sn_zz2 t3
       USING (WITH tmp_ps_loc_item AS
                   (SELECT loc_cntr_id_sn, setid, companyid, effdt, setid_product, loc_product_sn,
                           ROW_NUMBER () OVER (PARTITION BY loc_cntr_id_sn, setid, companyid, effdt, setid_product, loc_product_sn ORDER BY linha)
                                                                                          seqno_item_sn,
                           loc_item_status, NULL ken_data_ativ_sn, NULL inactive_date_sn,
                           'LO' cntrct_origin_sn, SYSDATE row_added_dttm,
                           'CARGA PS 29052007' row_added_oprid, SYSDATE row_lastmant_dttm,
                           'CARGA PS 29052007' row_lastmant_oprid, 0 syncid, NULL syncdttm,
                           ken_component_sn
                      FROM (SELECT t1.*, ROWNUM linha
                              FROM sysadm.tmp_equip_crm t1,
                                   (SELECT     LEVEL l
                                          FROM DUAL
                                    CONNECT BY LEVEL <= 100)
                             WHERE l <= t1.qtd) )
              SELECT t2.loc_cntr_id_sn, t2.setid, companyid, effdt, setid_product, loc_product_sn,
                     t2.seqno_item_sn, loc_item_status, t5.ken_data_ativ_sn, inactive_date_sn,
                     cntrct_origin_sn, row_added_dttm, row_added_oprid, row_lastmant_dttm, syncid,
                     syncdttm, t2.ken_component_sn
                FROM tmp_ps_loc_item t2, sysadm.tmp_data_ativa t5
               WHERE t2.loc_cntr_id_sn = t5.loc_cntr_id_sn(+)
                 AND t2.ken_component_sn = t5.ken_component_sn(+)
                 AND t2.loc_item_status = t5.loc_item_status_sn(+)
                 AND t2.seqno_item_sn = t5.seqno_item_sn(+)) t4
       ON (    t3.loc_cntr_id_sn = t4.loc_cntr_id_sn
           AND t3.setid = t4.setid
           AND t3.companyid = t4.companyid
           AND t3.effdt = t4.effdt
           AND t3.setid_product = t4.setid_product
           AND t3.loc_product_sn = t4.loc_product_sn
           AND t3.seqno_item_sn = t4.seqno_item_sn)
       WHEN MATCHED THEN
          UPDATE
             SET t3.syncid = 0
       WHEN NOT MATCHED THEN
          INSERT (loc_cntr_id_sn, setid, companyid, effdt, setid_product, loc_product_sn, seqno_item_sn,
                  loc_item_status_sn, ken_data_ativ_sn, inactive_date_sn, cntrct_origin_sn,
                  row_added_dttm, row_added_oprid, row_lastmant_dttm, row_lastmant_oprid, syncid,
                  syncdttm)
          VALUES (t4.loc_cntr_id_sn, t4.setid, t4.companyid, t4.effdt, t4.setid_product,
                  t4.loc_product_sn, t4.seqno_item_sn, loc_item_status, t4.ken_data_ativ_sn,
                  t4.inactive_date_sn, t4.cntrct_origin_sn, t4.row_added_dttm, t4.row_added_oprid,
                  t4.row_lastmant_dttm, t4.ken_component_sn, t4.syncid, t4.syncdttm);

    I don't understand what you mean exactly?
    When an SQL statement encounters an error then all
    its work is rolled back ...
    So why do you expect that it worùs otherwise?simply
    WHEN MATCHED THEN      UPDATE         SET t3.syncid = 0Only

  • Inserting values using merge

    Hi everyone,
    I need help with inserting values using merge.
    * I need to check all the units in a parent category. For example, NF_ARTICLECATEGORYID = 7462 is a parent category.
    * Im going to compare all the units in the parent category(7642) to the units in a subcategory (8053).
    * If the units in parent category(7642) is not present in the subcategory(8053) then the units will be inserted in the same table.
    table structure:
    Table name : ARTICLECATEGORYACCESS
    Fields: IP_ARTICLECATEGORYACCESSID
    NF_ARTICLECATEGORYID
    NF_UNITID
    NF_USERID
    N_VIEW
    N_EDIT
    Sample data:
    CREATE TABLE articlecategoryaccess (
    IP_ARTICLECATEGORYACCESSID NUMBER(5),
    NF_ARTICLECATEGORYID NUMBER (10),
    NF_UNITID NUMBER (10),
    NF_USERID NUMBER (10)
    N_VIEW INT,
    N_EDIT INT);
    INSERT INTO articlecategoryaccess VALUES (255583, 7642, 29727, NULL, 1 ,1);
    INSERT INTO articlecategoryaccess VALUES (243977,7642,29728, NULL, 1 ,1);
    INSERT INTO articlecategoryaccess VALUES (240770,7642,29843, NULL, 1 ,1);
    INSERT INTO articlecategoryaccess VALUES (243413,7642,29844, NULL, 1 ,1);
    INSERT INTO articlecategoryaccess VALUES (274828,7642,44849, NULL, 1 ,1);
    INSERT INTO articlecategoryaccess VALUES (274828,8053,44849, NULL, 1 ,1);
    Units ID 29727, 29728, 29843, 29844, 44849 has access to parent category 7642.
    The units id 29727, 29728, 29843, 29844 dont have access to subcategory 8053.
    29727, 29728, 29843, 29844 should be inserted in the same table and will have an access to 8053.
    After they are inserted, it should look like this
    IP_ARTICLECATEGORYACCESSID     NF_ARTICLECATEGORYID     NF_UNITID NF_USERID N_VIEW N_EDIT
    255583     7642     29727 null 1 1
    243977     7642     29728 null 1 1
    240770     7642     29843 null 1 1
    243413     7642     29844 null 1 1
    274828     7642     44849 null 1 1
    new value     8053     44849 null 1 1
    new value     8053     29843 null 1 1
    new value     8053     29844 null 1 1
    new value     8053     29728 null 1 1
    new value     8053     29727 null 1 1
    NOTE: IP_ARTICLECATEGORYACCESSID is a sequence and it should be unique
    DECLARE
    BEGIN
    MERGE INTO articlecategoryaccess b
    USING (SELECT *
    FROM articlecategoryaccess c
    WHERE nf_articlecategoryid = 7642
    MINUS
    SELECT *
    FROM articlecategoryaccess c
    WHERE nf_articlecategoryid = 8053) e
    ON (1 = 2)
    WHEN NOT MATCHED THEN
    INSERT (b.ip_articlecategoryaccessid, b.nf_articlecategoryid, b.nf_unitid, b.NF_USERID, b.N_VIEW, b.N_EDIT)
    VALUES (articlecategoryaccessid_seq.nextval, 8053, e.nf_unitid, null, 1, 1);
    END;
    i got an error after running the script:
    *Cause:    An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you may see
    this message if a duplicate entry exists at a different level.
    *Action:   Either remove the unique restriction or do not insert the key.
    why would it be duplicated? its a sequence and its unique.. I dont know, maybe there is something wrong my script..
    Any help is appreciated..
    Ed

    Ed,
    1. What is the current value of the Sequence? Does the current value of sequence exist in the table? If yes, then increment the sequence to a value that is not present in the Table.
    2. Do you have any unique constraint on any of the columns that you are inserting?
    I have to ask you again, Why are you insisting on Merge statement when a simple Insert can do the job for you? Don't you feel that the below specified Merge statement is making things look more Complicated than they actually are, do you?
    Think on it and then proceed. I hope these pointers help you to resolve the issue.
    Regards,
    P.

  • #SYNTAX error while using Merge Dimension in webi report

    Hi All,
    # Syntax error when using merge dimension in webi report
    screen shot has been attached.
    iam using BO 4.0 SP6
    checked the datatypes in BW
    they are same in BW in both the queries
    i followed the given links but no result.
    https://websmp230.sap-ag.de/sap%28bD1lbiZjPTAwMQ==%29/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3138343530303526
    https://websmp230.sap-ag.de/sap%28bD1lbiZjPTAwMQ==%29/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3136323339323126
    https://websmp230.sap-ag.de/sap%28bD1lbiZjPTAwMQ==%29/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3137353438313026
    http://scn.sap.com/thread/3592588#15241008
    Need Help!!!!!
    Regards
    Sushma

    Hi Mark,
    Thanks for the reply,
    I did not use any formula,
    I used merge dimension
    Anyways i tried in other system,it s working fine.
    Regards
    sushma

  • EMOD - Parse error while using merge fields

    Hello Everyone,
    We are using EMOD for email campaigns. We have renamed "Contact" object to "Rep Contact". When I insert merge fields on Rep Contact object, I get parse error message...
    Parse error in file at line 40: Could not find matching '}' for reference to variable at line 39
    Has anyone else come across this? Are there any restrictions in EMOD for using merge fields?
    Thanks.

    Thanks VK. I checked the source code and it is still perplexing why this error is coming up. It works fine without merge fields. I am pasting the section of html code with merge fields...
    <tr>
    <td valign="top" width="25" bgcolor="#ffffff"> </td>
    <td valign="top" bgcolor="#ffffff"><font face="Arial, Helvetica, sans-serif" style="font-size: 12px">Hello</font> ${Rep Contact.First Name} 
    <p><font face="Arial, Helvetica, sans-serif" style="font-size: 12px">What if there&rsquo;s another flash crash? What if we enter a double dip? These are just a few fears weighing heavily on investors&rsquo; minds in today&rsquo;s environment of uncertainty. <sup>1</sup> </font></p>
    <font face="Arial, Helvetica, sans-serif" style="font-size: 12px">
    <p>View or download: <a>3 ways to address risk-averse clients&rsquo; needs</a>.</p>
    </font>
    </td>
    </tr>

  • Is it possible to use MERGE with sql*plus and if yes how?

    Hello everybody,
    I have an xls file and I have to load its data with sql*loader, but instead of "APPEND" operation stated in the control file I need MERGE operation.Here is what my control file contains:
    LOAD DATA
    INFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\data.csv'
    BADFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\p_badfile.txt'
    APPEND
    INTO TABLE D_ACCOUNT_NAMES_TMP
    FIELDS TERMINATED BY ";"
    TRAILING NULLCOLS
    (account_number , consignment, sub_consignment, consign_sub_consign, account_name_bg, account_number_2, consign_parent_2, account_name_bg_2, account_number_3, account_name_bg_3, account_number_4, account_name_bg_4, account_number_5 , ACCOUNT_NAME_BG_5 ).
    How can I use merge in this case , instead of insert ?
    Regards,
    Maria

    I'm not sure if there is any MERGE thing in SQL*Loader, but you can have a backup table which gets loaded by SQL*Loader and then use MERGE statement from backup to the original table, if your data is not huge to become a performance barrier. This is just a suggestion, may be you can try some reading of SQL*Loader here.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/part2.htm#436160
    Cheers
    Sarma.

  • Error in merge statement when trying to impliment SCD type 2 using merge...

    Hi ,
    I'm trying to impliment SCD type 2 using Merge using below blog as reference but sime how it is erroring out with error
    http://www.made2mentor.com/2013/08/how-to-load-slowly-changing-dimensions-using-t-sql-merge/
    Msg 207, Level 16, State 1, Line 40
    Invalid column name 'Current'.
    Msg 207, Level 16, State 1, Line 38
    Invalid column name 'Current'.
    Msg 207, Level 16, State 1, Line 47
    Invalid column name 'Current'.
    Here is the code below...
    --Create Temporaty table to hold dimension records
    IF OBJECT_ID('tempdb..#DimVirtualQueue') IS NOT NULL
    DROP TABLE #DimVirtualQueue;
    CREATE TABLE #DimVirtualQueue
    ( [VQ_name] [varchar](50) NULL,
    [contact_type] [varchar](50) NULL,
    [center_node_id] [int] NULL,
    [sed_id] [datetime] NULL,
    [eed_id] [datetime] NULL,
    [insert_date] [datetime] NULL,
    [Current] [char](1) NOT NULL
    INSERT INTO #DimVirtualQueue(VQ_name, contact_type, center_node_id, sed_id, eed_id, insert_date,[Current] )
    SELECT VQ_name, contact_type, center_node_id, sed_id , eed_id,GETDATE(),'Y'
    FROM
    ( --Declare Source and Target tables.
    MERGE dbo.tblSwDM_dim_VQ_test AS TARGET
    --Source
    USING (SELECT
    RTRIM(LTRIM(Stage.RESOURCE_NAME)) AS VQ_name,
    'Unknown' AS contact_type,
    0 AS center_node_id,
    CONVERT(INT,CONVERT(VARCHAR(8),GMT_START_TIME,112)) AS sed_id,
    CONVERT(INT,CONVERT(VARCHAR(8),ISNULL(GMT_END_TIME,'2070-01-01'),112)) AS eed_id,
    GETDATE() AS insert_date
    FROM dbo.tblGenesys_stg_RESOURCE_ Stage
    WHERE resource_type = 'queue'
    AND resource_subtype = 'VirtualQueue'
    AND NOT EXISTS (SELECT 1 FROM dbo.tblSwDM_dim_VQ AS dim
    WHERE RTRIM(LTRIM(stage.RESOURCE_NAME)) = RTRIM(LTRIM(dim.vq_name))) ) SOURCE
    ON TARGET.VQ_name = SOURCE.VQ_name
    WHEN NOT MATCHED BY TARGET
    THEN
    INSERT ( VQ_name, contact_type, center_node_id, sed_id, eed_id, insert_date,[Current] )
    VALUES (SOURCE.VQ_name,SOURCE.contact_type,SOURCE.center_node_id,SOURCE.sed_id,SOURCE.eed_id,SOURCE.insert_date,'Y')
    WHEN MATCHED AND TARGET.[Current] = 'Y'
    AND EXISTS (
    SELECT SOURCE.VQ_name
    EXCEPT
    SELECT TARGET.VQ_name
    --Expire the records in target if exist in source.
    THEN UPDATE SET TARGET.[Current] = 'N',
    TARGET.[eed_id] = SOURCE.eed_id
    OUTPUT $Action ActionOut, SOURCE.VQ_name,SOURCE.contact_type,SOURCE.center_node_id,SOURCE.sed_id,SOURCE.eed_id) AS MergeOut
    WHERE MergeOut.ActionOut = 'UPDATE';
    --Insert data into dimension
    INSERT tblSwDM_dim_VQ_test
    SELECT VQ_name,contact_type,center_node_id,sed_id,eed_id,insert_date,[Current] FROM #DimVirtualQueue
    Any help to resolve issue is appreciated...
    Thanks,
    Vishal..

    You need to show the DDL of your target table: dbo.tblSwDM_dim_VQ_test.
    Do you have a column named [Current] in this table?

  • Deploying Crystal Reports runtime using merge module failed

    Hi,
    I am having a problem when deploying Crystal Reports using merge module runtime, included into MS Visual Studio web setup project, when installing my *.msi with CR runtime on a completely clean PC (with only MS Windows installed). Error: Failed to register one of the Crystal Reportsu2019 *.dll because it could not find Microsoft visual C++ runtime (msvcr71.dll was not in Windows\System32 folder)
    I am using Crystal Reports runtime merge modules, which I downloaded from here: https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
    I tried both cr120_mm.zip (Crystal Reports 2008) and cr121_mm.zip (Crystal Reports 2008 SP1)
    cr120 could not find msvcr71.dll, cr121 could not find msvcp80.dll.
    Steps to reproduce:
    -          In MS Visual Studio 2008 create a new empty Web Setup Project.
    -          Add Crystal Reports merge module CRRuntime_12_0.msm or CRRuntime_12_1.msm
    -          Build *.msi
    -          Try to install this *.msi on a completely clean PC. I tried it on Windows Server 2003 R2 SP3, which did not have msvcr71.dll or msvcp80.dll files in C:\Windows\System32 or in any other PATH folders.
    -          During installation there is an error u2013 failed to register one of the Crystal Reportsu2019 *.dll
    I am looking forward to hear from you.
    Thank you.

    I believe these threads have the answer for you:
    https://forums.sdn.sap.com/click.jspa?searchID=19475295&messageID=6558989
    https://forums.sdn.sap.com/click.jspa?searchID=19475295&messageID=6559113
    Ludek

  • After using Merge Clips in CS6, the resulting file now has two audio tracks

    Hey guys,
    I'm running into a weird problem after using the Merge Clips option. I have my video and audio selected, I've already moved the audio so they're both synced. It looks like this:
    Then I use Merge Clips and pull the new file into a new sequence which in turn looks like this:
    I checked the audio channels for both and apparently the merged file separated the left and right audio channels into two separate streams as opposed to using the single stream for both channels like the original.
    Anyway to prevent it from doing this?

    So according to Adobe's website: http://help.adobe.com/en_US/premierepro/cs/using/WS2bacbdf8d487e582-73725e6a12e5a6165d0-7f ff.html
    At the very bottom they list limitations, one of which being "Merged clip audio results in mono track audio only."
    Which I was familiar with before posting this. It doesn't seem however that the two tracks are mono it looks like they are two separate stereo tracks. If I mute one I still get audio in both speakers even though I muted the "right" track.
    Here's what they look like in the audio mixer
    The original only has the left most track.
    I guess the only thing to do is just deal with it or render out each clip uncompressed to have that single audio channel.

  • #Error & #Syntax when we are using merged dimension in BO4.1 SP3

    Dear All,
    We are using BO4.1 SP3 and Bex query as datasource.
    When we are trying to take merged dimensions in Report block its giving #Syntax Error.
    When we are defining variable with merged dimension, its giving #Error message and the merged dimension is deleted from the definition.
    Please guide how can I use merged dimension.
    Kindly let us know if there are some update required in the current BO version.
    Warm Regards,
    Sonal

    First things abt merge dimension is that merge is applicable only on dimension not on measures.
    And other is dimension that are going to be merge should have same data type.
    I think you should check these conditions then it will works.
    Merge is nothing but full outer join between two data providers. It helps joining two result sets on webi level.
    Kindly attach your screen shots so that it would be helpful.

  • Missing keyword when try to use MERGE

    I have COUNT_STATISTICS table that needs to be updated daily.
    MODEL
    NEW_COUNT
    NEW_DATE
    OLD_COUNT
    OLD_DATE
    PRNCT_CHANGE
    XEDHRD
    5206358
    21-AUG-13
    0
    19-AUG-13
    (null)
    XLIMS
    72669230
    21-AUG-13
    72669230
    20-AUG-13
    0
    XEDHRD
    5206358
    22-AUG-13
    5206358
    21-AUG-13
    0
    XLIMS
    72859644
    22-AUG-13
    72669230
    21-AUG-13
    0.262
    so on and so forth...
    Sometimes I have a new MODEL name coming in and I have to account for that and create a row in the table in that case.
    Other times, all I have to do is INSERT new row in the table with new values.
    Simple right?
    Well, I was trying to use MERGE INTO but it is giving me problems...
    This is what I did assuming I manually went in the table and added a new MODEL name and zeros for other columns before I did insertion...
    #!/bin/bash
    MODEL=$1
    sqlplus -S username/password << EOF
    whenever sqlerror exit 1;
    set echo on
    set verify off
    INSERT INTO SEMANTIC.COUNT_STATISTICS(MODEL,NEW_COUNT,NEW_DATE,OLD_COUNT,OLD_DATE)
    SELECT MODEL,
            SELECT COUNT(*)
            FROM TABLE(SEM_MATCH(
                    ?s ?p ?o
             }',SEM_Models('$MODEL'),NULL,
            SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL))
        SYSDATE,
        NEW_COUNT,
        NEW_DATE
    FROM SEMANTIC.COUNT_STATISTICS
    WHERE MODEL = '$MODEL'
    AND NEW_DATE = (
                    select max(NEW_DATE)
                    from SEMANTIC.COUNT_STATISTICS
                    where MODEL = '$MODEL'
    update SEMANTIC.COUNT_STATISTICS
    set prnct_change =
       (NEW_COUNT-OLD_COUNT)/NULLIF(OLD_COUNT,0)*100
    where model = '$MODEL'
    AND NEW_DATE = (
                    select max(NEW_DATE)
                    from SEMANTIC.COUNT_STATISTICS
                    where MODEL = '$MODEL'
    COMMIT;
    exit;
    EOF
    Now I added MERGE in front of INSERT so it checks if the MODEL name doesn't exist-it creates it:
    MERGE INTO SEMANTIC.COUNT_STATISTICS s
    USING (SELECT '${MODEL}' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE,
      0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
    on (s.MODEL = t.MODEL)
    when not matched then
    INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
    VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
    My code combined...
    #!/bin/bash
    MODEL=$1
      sqlplus -S username/password << EOF
      whenever sqlerror exit 1;
      set echo on
      set verify off
      MERGE INTO SEMANTIC.COUNT_STATISTICS s
      USING (SELECT '${MODEL}' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE, 0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
      on (s.MODEL = t.MODEL)
      when not matched then
      INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
      VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
      exit;
    EOF
    model_exists () {
      sqlplus -s username/password <<!
        set heading off
        set feedback off
        set verify off
        set pages 0
        SELECT count(MODEL)
        FROM SEMANTIC.COUNT_STATISTICS
        where MODEL ='$MODEL' AND TO_DATE(NEW_DATE, 'DD-MON-YY') = TO_DATE(SYSDATE, 'DD-MON-YY');
        exit;
    modelcount=$(model_exists $1)
    if [ "${modelcount:-0}" -ne 0 ]; then
        sqlplus -S username/password << EOF
        whenever sqlerror exit 1;
        set echo on
        set verify off
        INSERT INTO SEMANTIC.COUNT_STATISTICS(MODEL,NEW_COUNT,NEW_DATE,OLD_COUNT,OLD_DATE)
        SELECT MODEL,
      SELECT COUNT(*)
      FROM TABLE(SEM_MATCH(
      '{?s ?p ?o }',SEM_Models('$MODEL'),NULL,
      SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL))
        SYSDATE,
        NEW_COUNT,
        NEW_DATE
        FROM SEMANTIC.COUNT_STATISTICS
        WHERE MODEL = '$MODEL'
        AND NEW_DATE = (
      select max(NEW_DATE)
      from SEMANTIC.COUNT_STATISTICS
      where MODEL = '$MODEL'
      COMMIT;
      exit;
    EOF
    else
       sqlplus -S  username/password << EOF
      whenever sqlerror exit 1;
      set echo on
      set verify off
      UPDATE COUNT_STATISTICS
      SET  MODEL = '$MODEL',
      NEW_COUNT = (SELECT COUNT(*) FROM TABLE(SEM_MATCH('{?s ?p ?o}',SEM_Models('$MODEL'),NULL,
      SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL))
      NEW_DATE  = SYSDATE,
      OLD_COUNT = NEW_COUNT,
      OLD_DATE  = NEW_DATE
      WHERE MODEL = '$MODEL'
      AND NEW_DATE = (
      select max(NEW_DATE)
      from SEMANTIC.COUNT_STATISTICS
      where MODEL = '$MODEL'
      COMMIT;
      exit;
    EOF
    fi
    sqlplus -S username/password << EOF
      whenever sqlerror exit 1;
      set echo on
      set verify off
      update COUNT_STATISTICS
      set prnct_change =
        (NEW_COUNT-OLD_COUNT)/NULLIF(OLD_COUNT,0)*100
      where model = '$MODEL'
      AND NEW_DATE = (
      select max(NEW_DATE)
      from SEMANTIC.COUNT_STATISTICS
      where MODEL = '$MODEL'
      COMMIT;
      exit;
    EOF
    But this is creating two rows if it is a new MODEL, ie:
    ./load_myScript.sh  MODELNAME
    MODEL
    NEW_COUNT
    NEW_DATE
    OLD_COUNT
    OLD_DATE
    PRNCT_CHANGE
    MODELNAME
    72669230
    22-AUG-13
    0
    22-AUG-13
    (null)
    MODELNAME
    0
    22-AUG-13
    0
    22-AUG-13
    (null)
    This is not what I want. I want to create a new row if it doesn't exist and then update that same one for that day. But tomorrow it should INSERT a new one for that same MODEL name.
    Does anyone see what I am doing wrong?

    Hi,
    MODEL is an Oracle keyword, so it causes confusion to have a column named MODEL.  Errors like "Missing Keyword" can occur when  Oracle thinks you're talking about the MODEL clause, rather than the column.
    The best solution is not to use Oracle keywords (as found in v$reserverd words) for you own column names, or other identifiers.  MODEL_NAME and MODEL_ID are good names for columns
    If you really must use that column name, qualify it with the table name, and/or put the column name in double-quotes (case-sensitive), e.g.
    count_statistics."MODEL"

  • SCD type 2 using merge

    Hi ,
    I'm trying to impliment SCD type 2 using Merge but unlike typical Merge where you have target and source table,  my Inserts come from one table and updates/changes are determined from another table.. I have issue with updates.
    below is structure of three tables :
    Dimension Table : 
     VQ_id, VQ_name,
    contact_type, center_node_id,
    sed_id, eed_id,
    IsCurrent, insert_date  
    VQ_Id is dimension ID based on which Inserts and undates are determined.
    VQ_Name : type 1 change
    Contact_type , Center_node_ID : type 2 changes
    is Current : flag
    sed_id , eed_id are start and end effective date ID's
    Insert table :
    VQ_id,VQ_Name ,Contact_Type , Center_node_ID , Sed_id , eed_id , Insert_date
    from the above table, based on VQ_ID , new records are determined .
    Updates/history records :
    Type 2 changes are tracked based on below table..
    VQ_ID, contact_type,
    center_node_id, Start_Effective_Date,
    CT_ID, Submit_Date
    Based on VQ_ID ,  contact_type, center_node_id,
    Start_Effective_Date , end effective date are determined.
    Any help in this regard is appreciated...
    Thanks ,
    Vishal.

    -- This is dimension table
    CREATE TABLE [dbo].[tblSwDM_dim_VQ](
    [VQ_dim_id] [int] IDENTITY(1,1) NOT NULL,
    [VQ_id] [int] NOT NULL,
    [VQ_name] [varchar](50) NOT NULL,
    [contact_type] [varchar](50) NULL,
    [center_node_id] [int] NULL,
    [sed_id] [int] NULL,
    [eed_id] [int] NULL,
    [IsCurrent] [bit] NOT NULL,
    [insert_date] [datetime] NULL,
    [Start_Effective_Date] AS (CONVERT([datetime],CONVERT([varchar](8),[sed_id],(0)),(0))),
    [End_Effective_Date] AS (CONVERT([datetime],CONVERT([varchar](8),[eed_id],(0)),(0))),
    CONSTRAINT [Pk_tblswDM_dim_VQ] PRIMARY KEY CLUSTERED
    [VQ_dim_id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    -- THis ifrom where updates/type2 changes would be loaded
    CREATE TABLE [dbo].[tblSwDM_stg_change_control_next_gen](
    [row_id] [int] IDENTITY(1,1) NOT NULL,
    [VQ_id] [int] NOT NULL,
    [contact_type] [varchar](50) NOT NULL,
    [center_node_id] [int] NOT NULL,
    [Start_Effective_Date] [datetime] NOT NULL,
    [CT_ID] [int] NULL,
    [Submit_Date] [datetime] NOT NULL,
    [isValid] [bit] NULL,
    [Remarks] [varchar](100) NULL
    ) ON [PRIMARY]
    Example...
    for a Record in dimention table... [dbo].[tblSwDM_dim_VQ]
    Before Updates :
    VQ_dim_id VQ_id VQ_name contact_type center_node_id sed_id eed_id IsCurrent insert_date Start_Effective_Date End_Effective_Date
    2203 376946 Fraud_Span_Det_VQ RFD USCC Detection 4536 20131018 20700101 1 2014-03-21 12:02:42.750 2013-10-18 00:00:00.000 2070-01-01 00:00:00.000
    Final Result :
    VQ_dim_id VQ_id VQ_name contact_type center_node_id sed_id eed_id IsCurrent insert_date Start_Effective_Date End_Effective_Date
    2203 376946 Fraud_Span_Det_VQ RFD USCC Detection 4536 20131018 20140423 0 2014-03-21 12:02:42.750 2013-10-18 00:00:00.000 2014-04-23 00:00:00.000
    2605 376946 Fraud_Span_Det_VQ RFS USCC Spanish 4537 20140424 20700101 1 2014-05-07 11:51:00.543 2014-04-24 00:00:00.000 2070-01-01 00:00:00.000

  • Need Help Can i use Merge command along with exist function in oracle?

    I am using Merge command to update the destination table and updating the rows which are already in the destination table.
    But what i want is to delete the existing rows from the destination table and insert fresh rows instead of updating the existing rows in the destination table.
    So can we use exist function to check the existing rows and delete them and use merge command to insert the rows in the table.

    You definitely need to do a DELETE then INSERT since MERGE will not delete rows, although I'm not really sure what that gets you since the net effect would be the same as a MERGE over the same pair of tables.
    If you really want to do it this way, then I would likely do something like:
    DELETE FROM target_table
    WHERE (columns_you_would_match_on) IN (SELECT columns_you_would_match_on
                                           FROM source_table
                                           WHERE predicate_you_would_use_in_using);
    INSERT INTO target_table (column_list)
    SELECT column_list
    FROM source_table
    WHERE predicate_you_would_use_in_using;John

  • Migration of million rows from remote table using merge

    I need to migrate (using merge) almost 15 million rows from a remote database table having unique index (DAY, Key) with the following data setup.
    DAY1 -- Key1 -- NKey11
    DAY1 -- Key2 -- NKey12
    DAY2 -- Key1 -- NKey21
    DAY2 -- Key2 -- NKey22
    DAY3 -- Key1 -- NKey31
    DAY3 -- Key2 -- NKey32
    In my database, I have to merge all these 15 million rows into a table having unique index (Key); no DAY in destination table.
    First, it would be executed for DAY1 and the merge command will insert following two rows. For DAY2, it would update two rows with the NKey2 (for each Key) values and so on.
    Key1 -- NKey11
    Key2 -- NKey12
    I am looking for the best possible approach. Please note that I cannot make any change at remote database.
    Right now, I am using the following one which is taking huge time for DAY2 and so on (mainly update).
    MERGE INTO destination D
      USING (SELECT /*+ DRIVING_SITE(A) */ DAY, Key, NKey
                   FROM source@dblink A WHERE DAY = v_day) S
      ON (D.Key = S.Key)
    WHEN MATCHED THEN
       UPDATE SET D.NKey = S.NKey
    WHEN NOT MATCHED THEN
       INSERT (D.Key, D.NKey) VALUES (S.Key, S.NKey)
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;Edited by: 986517 on Feb 14, 2013 3:29 PM
    Edited by: 986517 on Feb 14, 2013 3:33 PM

    MERGE INTO destination D
      USING (SELECT /*+ DRIVING_SITE(A) */ DAY, Key, NKey
                   FROM source@dblink A WHERE DAY = v_day) S
      ON (D.Key = S.Key)
    WHEN MATCHED THEN
       UPDATE SET D.NKey = S.NKey
    WHEN NOT MATCHED THEN
       INSERT (D.Key, D.NKey) VALUES (S.Key, S.NKey)
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;The first remark I have to emphasize here is that the hint /*+ DRIVING_SITE(A) */ is silently ignored because in case of insert/update/delete/merge the driving site is always the site where the insert/update/delete is done.
    http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#more-809
    Right now, I am using the following one which is taking huge time for DAY2 and so on (mainly update).The second remark is that you've realised that your MERGE is taking time but you didn't trace it to see where time is being spent. For that you can either use the 10046 trace event or at a first step get the execution plan followed by your MERGE statement.
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;The third remark is related to the DML error logging : be aware that unique keys will empeach the DML error loggig to work correctly.
    http://hourim.wordpress.com/?s=DML+error
    And finally I advise you to look at the following blog article I wrote about enhancing an insert/select over db-link
    http://hourim.wordpress.com/?s=insert+select
    Mohamed Houri
    www.hourim.wordpress.com

  • Insert with Select while Using Merge

    Actual Query
    MERGE INTO schema1.employees D
       USING (SELECT employee_id, salary, department_id FROM schema2.employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN
       UPDATE
       SET D.bonus = D.bonus + S.salary*.01
       WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
       VALUES (S.employee_id, S.salary*.01)
       WHERE (S.salary <= 8000) Is there a possible way to write a select Query in Insert Statement while using Merge.
      WHEN NOT MATCHED THEN
       INSERT
       SELECT * FROM schema2.employees
       WHERE S.salary <= 8000;

    it works:
    MERGE INTO fifapps.tes2
    using dual
    on (1=2)
    when not matched then insert values(59,'yes');
    commit;or
    MERGE INTO fifapps.tes2
    using dual
    on (1=2)
    when not matched then insert values ((select 99 from dual),(select'weii' from dual));
    commit;Edited by: ʃʃp on Jun 13, 2012 2:03 AM
    Edited by: ʃʃp on Jun 13, 2012 2:03 AM

Maybe you are looking for

  • Access policy issues and daylight savings

    I have the WRVS4400N. I have purchased a few Linksys routers in the past and have been happy with their operation. The wireless access however, was mediocre until I purchased this model. This model has great a great wireless connection. I like the fa

  • Pagenumber on outside of the page

    I like to print a Pages document in book-style, with the pagenumbers on the outside of the page. So left aligned on the odd pages, right aligned on the even pages. In the previous version of Pages this was possible; I cannot find how to do this in ve

  • ICal on mac not getting iCloud data

    Hi, I'm having trouble with iCal on my macbook air syncing with iCloud. When i add an event to iCal on my macbook it syncs with icloud.com and the calender on my iphone perfectly. However, if i add an event on icloud.com or the Calendar on my iphone

  • Error Console Removed?

    I can no longer bring up the Error Console by typing Ctrl + Shift + J and then I looked under Tools-->Web Developer and do not see the Error Console listed there. Has it been removed? On the other hand, I don't recall Firefox updating in the last cou

  • How to check exposed table or class etc in SAP_BASIS 700

    Hi Colleague ,                      I want to check whether a table or a class is exposed by SAP for customer use ,in SAP BASIS 700 . Can anyone help me how to do that . For 710 or higher i know there is a package interface where they are defined but