Match Condition

Hi,
I have two tables where I will be comparing a column that exists in both tables and that contains the same values but can be worded different e.g. (Case Sensitive, LTD Missing etc.)
I am using database version 11.2.0.3.0
Below is some sample data:
CREATE TABLE t1(
NAME VARCHAR2(255));
CREATE TABLE t2(
NAME VARCHAR2(255));
INSERT INTO T1 VALUES('ABC');
INSERT INTO T2 VALUES('ABC Ltd');
INSERT INTO T1 VALUES('Solutions UK Ltd');
INSERT INTO T2 VALUES('SOLUTIONS LTD');
INSERT INTO T1 VALUES('Associates Dawner Ltd');
INSERT INTO T2 VALUES('Dawner LTD');
INSERT INTO T1 VALUES('Equity (PVL)');
INSERT INTO T2 VALUES('EQUILIBRIUM PVL');
INSERT INTO T1 VALUES('Abacus PLC');
INSERT INTO T2 VALUES('Abacus T/A ABC');
INSERT INTO T1 VALUES('Asset Solutions Ltd');
INSERT INTO T2 VALUES('Asset (Kingsley) Ltd');
INSERT INTO T1 VALUES('Hunt Windows Ltd');
INSERT INTO T2 VALUES('Joe Hunt Ltd');
Can anyone help with a query that provides the closest match on the columns in both tables?
Thanks

Hi
You can play with function SOUNDEX. It give good result (>75% match). Example:
select n1, n2
from (select q.*,
             min(tp) over (partition by n1) mtp1,
             min(tp) over (partition by n2) mtp2
      from (select t1.name n1, t2.name n2, 1 tp
            from (select name, soundex(name) snd
                  from t1) t1,
                 (select name, soundex(name) snd
                  from t2) t2
            where t1.snd = t2.snd
            union all
            select t1.name, t2.name, 2
            from (select name, soundex(name) snd
                  from t1) t1,
                 (select name, soundex(name) snd
                  from t2) t2
            where t1.snd != t2.snd
            and substr(t1.snd, 1, 1) = substr(t2.snd, 1, 1)
            and substr(t1.snd, 2) between substr(t2.snd, 2) - 10 and substr(t2.snd, 2) + 10
            union all
            select t1.name, t2.name, 3
            from (select name, soundex(name) snd
                  from t1) t1,
                 (select name, soundex(name) snd
                  from t2) t2
            where t1.snd != t2.snd
            and substr(t1.snd, 1, 1) != substr(t2.snd, 1, 1)
            and substr(t1.snd, 2) between substr(t2.snd, 2) - 10 and substr(t2.snd, 2) + 10) q) q
where q.mtp1 = q.mtp2
and q.mtp1 = q.tp
Abacus PLC               Abacus T/A ABC
ABC                       ABC Ltd
Asset Solutions Ltd       Asset (Kingsley) Ltd
Equity (PVL)               EQUILIBRIUM PVL
Hunt Windows Ltd       Joe Hunt Ltd
Solutions UK Ltd          SOLUTIONS LTDEdited by: ---Brodyaga--- on Mar 5, 2013 11:27 PM
Edited by: ---Brodyaga--- on Mar 6, 2013 12:34 AM

Similar Messages

  • Feature Request : provide a way to create access policies or identities with matching condition based on the HTTP header's "Referer" field

    Hello,
    I have a use-case I would like to share with you. When a customer configures its WSA with highly restrictive internet access like in the example below, it may trigger some issues :
    1- allow internet access only for URLs defined in whitelist.
    2- block ALL other requests.
    Let's take the following example :
    1- the customer only allow requests to www.siteA.com. siteA.com is the only URL included in its whitelist.
    2- www.siteA.com contains many embedded objects (such as facebook like tags, youtube videos, links to partners sites, ...)
    In this configuration, the end user will be allowed to reach siteA but the page will not be fully displayed. All the embedded objects not directly located on siteA will be missing.
    With WSA, the easiest way I can imagine to solve the issue is to list all the embedded objects present on siteA, get back their URL and also add these URLs to the whitelist. But this solution if of course far to be really convenient since it involves to know exactly how each HTTP page you want to consult is built.
    With other proxies, such as Bluecoat proxies or McAfee Web Gateway proxies for example, I used to solve this kind of issue by using the HTTP referer field (the URL you come from). For example with Bluecoat :
    <Proxy>
        ALLOW request.header.Referer.url.domain=//www.siteA.com/
    => All requested objects from siteA.com will be automatically allowed by the proxy, even if they are not part of my whitelist.
    - Do you have a better suggestion than the one I'm currently using with WSA (adding each sites in whitelist) ?
    - Would it be possible to add the field HTTP referer as a matching condition for Identities and access policies in your next release ?
    Thanks in advance
    Best regards

    As far as I'm aware this functionality is still not available... would be an awesome feature to have, but could also be abused at the same time by a user writing their own "middleware" proxy and setting the referrer header to that allowed site..  could be done in like ~15 lines of perl / python.
    Either way... would still be a cool feature to have.

  • Select one record for the first matching condition only in four where condi

    I need your suggestion to write one tricky SQL query to select only one record from database on the following condition.I explained simple table structure below.I have a table temp with four columns a,b,c,d in it.
    I have to select column d from this temp table based on the following four conditions.If it matches any condition, It should skip other conditions, that's the tricky thing.
    Conditions order is like shown below.
    1) a='argument1' and b='argument2' and c='argument3'(If it matches this condition, it should stop selecting below 3 conditions)
    2) a='argument1' and b='argument2' and c='none'(If it matches this condition, it should stop selecting below 2 conditions)
    3) a='argument1' and b='none' and c='argument3'(If it matches this condition, it should stop selecting below condition)
    4) a='argument1' and b='none' and c='none'(this is last condition)
    If I use OR operator , it matches all of those other conditions too.I never wrote query like this before.
    I greatly appreciate if somebody sheds light on me to start writing this query with a simple suggestion.
    Thanks,
    GD

    This forum might help you out, as they are experienced SQL developers, however, this forum is primarily for queries about the tool, SQL Developer. I recommend you post this on the SQL & PL/SQL forum where they focus on these queries:
    PL/SQL
    Sue

  • Updating values with in the same table for other records matching conditions

    Hi Experts,
    Sorry for not providing the table structure(this is simple structure)
    I have a requirement where i need to update the columns of a table based on values of the same table with some empid and date  match. If the date and empid match then i have take these values from other record and update the one which is not having office details. I need the update query
    Before update my table values are as below
    Sort_num     Emp_id   office      start_date
    1                      101     AUS    01/01/2013
    2                      101                01/01/2013
    3                      101               15/01/2013
    4                      103     USA    05/01/2013
    5                      103               01/01/2013
    6                      103                05/01/2013
    7                      104     FRA    10/01/2013
    8                      104               10/01/2013
    9                      104                01/01/2013
    After update my table should be like below
    Sort_num     Emp_id   office      start_date
    1                      101     AUS    01/01/2013
    2                      101     AUS    01/01/2013
    3                      101               15/01/2013
    4                      103     USA    05/01/2013
    5                      103               01/01/2013
    6                      103    USA     05/01/2013
    7                      104     FRA    10/01/2013
    8                      104     FRA     10/01/2013
    9                      104                01/01/2013
    Thanks in advance

    I do not have time to create the table with data but basically you should be able to code the following
    update table a
    set office = ( select office from table b where b.emp_id = a.emp_id
                                                                 and     b.start_date = a.start_date
                                                                 and     b.office is not null
    where exists ( [same query as in set]  )
    and a.office is null
    I believe that will do the trick.
    HTH -- Mark D Powell --

  • Xpath condition in Receiver Determination

    Hi  Gurus -
    I want to implement a condition, For QUALF=01 AND ORGID=ORG1, then only it should go to some receiver and otherwise some other Receiver.However when i implement this using context object/Xpath, The condition happens to be true which should not be true for following structure as No segment contain "QUALF=01 AND ORGID=ORG1".
    It happens to be true probably because one of the QUALF=01 and one of the ORGID=ORG1, however i doesnt want like that
    - <E1EDK14 SEGMENT="1">
      <QUALF>01</QUALF>
      <ORGID>ORG2</ORGID>
      </E1EDK14>
    - <E1EDK14 SEGMENT="1">
      <QUALF>02</QUALF>
      <ORGID>ORG1</ORGID>
      </E1EDK14>
    - <E1EDK14 SEGMENT="1">
      <QUALF>01</QUALF>
      <ORGID>ORG2</ORGID>
    Expert opinions are invited.
    Regards.
    Jeet,

    Hi Jeet,
    Your Condition should be as
    <b>/p1:ORDERS05/E1EDK14/QUALF=01 AND /p1:ORDERS05/E1EDK14/ORGID=ORG1</b>
    and not as <b>(/p1:ORDERS05/E1EDK14[QUALF="01" and ORGID="ORG1"] EX )</b>
    To acheive this,
    1. Go to condition editor in the RD
    2. Insert a new expression clicking on the + button at the top left.Now u will find the operation AND between the two condition
    3. In both the condition line select the respective XPath of the node and specify the matching condition.
    It should look like..
    Left Operand                                     OP    Right Operand
    /p1:ORDERS05/E1EDK14/QUALF       =           01                   AND
    /p1:ORDERS05/E1EDK14/ORGID        =          ORG1                 
    Regards
    San

  • Creating condition records in product

    hi,
    I am trying to create condition records for a product.For a sales order (TA) i create, the pricing procedure determined is RVCXUS. But i dont see any of the condition type which matches condition type for a product (in F4) and condition type maintained in RVCXUS.
    Please let me know where from the condition type(in F4) comes in a product. It will not include all condition type we see in spro?
    Regards,
    Rahul

    Hi Rahul,
    To see a particular codition type in F4 help, you need to assign your "condition type/(s) in pricing procedure" to condition group being used for your application area. try following:
    1. check condition group being used to the application SAP CRM in SPRO > Customer Relationship Management> Master Data>  Products>  Special Settings for Sales Operations-->  Assign Condition Group to Application CRM
    2.Assign the condition types in your pricing procedure to the above condition group by choosing SPRO>Customer Relationship Management> Master Data  --> Conditions and Condition Technique --> Condition Technique: Basics  Create Maintenance Group
    Let me know if this works....!!
    Best Regards,
    VIshant Jain

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • Regex matching bug?

    it seems like j2sdk1.4.2b has some serious regex matching bug with strings that contain unicode characters. In my case, the string contained some Turkish chars.
    regex is simple <[^>]*> which matches string runs that are enclosed in <>
    (ex. <field>)
    although the matching is successful with j2sdk1.4.1_02, it just doesn't match unicode containing text with 1.4.2b
    What do you think? Is this a bug or could I be missing something?

    ahmeti, did you submit a bug report on this? Because it definitely is a bug in the Pattern class, I finally figured out. They added a new node type to make matching ASCII characters in character classes more efficient, but they screwed up the match condition: it always returns false if the character it's looking at is not ASCII, even if the class has been negated. I'll go ahead submit a report myself unless I hear from you.

  • Creating condition(Price) records in product

    hi,
    I am trying to create condition records for a product.For a sales order (TA) i create, the pricing procedure determined is RVCXUS. But i dont see any of the condition type which matches condition type for a product (in F4) and condition type maintained in RVCXUS.
    Please let me know where from the condition type(in F4) comes in a product. It will not include all condition type we see in spro?
    Regards,
    Rahul

    Hi Rahul,
    I got your problem, actually the condition pr00 is not a CRM condition ( all standard CRM conditions start with "0" like 0PR0), it is a condition type of connected R/3 system, hence, for this condition type, there are no maintanable tables in the CRM system, hence, you can not maintain it in CRM. If maintenance for such condition records is required in CRM system, this must be set up in Customizing:
    Customer Relationship Management -> Basic Functions -> Pricing -> Pricing in the Business Transaction ->Define Mapping for Condition Types from Application BBP to Application CRM
    or
    I guess, you can maintain them in R/3 & do a delta download for your product master..!!!
    Best Regards,
    Vishant Jain

  • Two query result rows in single report according to condition

    Is it possible to have a report where the first rwo of the report will display the result of query1 and second row will display the result of query2.
    The query1 and Query2 are as follows:
    SELECT BNO, DATA1 FROM TABLE1 ;
    SELECT RNO, DATA2 FROM TABLE2
    The matching condition is BNO = RNO(+)
    Kindly suggest ?
    Sanjay
    CREATE TABLE TABLE1
    BNO          NUMBER,
    DATA1        VARCHAR2(20)
    CREATE TABLE TABLE2
    RPNO           NUMBER,
    RNO         NUMBER,
    DATA2       VARCHAR2(20)
    INSERT INTO TABLE1(BNO, DATA1) VALUES(111,'200');
    INSERT INTO TABLE1(BNO, DATA1) VALUES(112,'400');
    INSERT INTO TABLE1(BNO, DATA1) VALUES(113,'500');
    INSERT INTO TABLE2(RPNO,RNO,DATA2) VALUES(10,111,'100');
    INSERT INTO TABLE2(RPNO,RNO,DATA2) VALUES(11,111,'100');
    INSERT INTO TABLE2(RPNO,RNO,DATA2) VALUES(12,111,'100');
    INSERT INTO TABLE2(RPNO,RNO,DATA2) VALUES(13,112,'400');
    INSERT INTO TABLE2(RPNO,RNO,DATA2) VALUES(14,113,'500');

    One option can be UNION ALL
    SELECT
         BNO,
         DATA1
    FROM
              SELECT
                   BNO, DATA1,rownum as rn
              FROM
                   TABLE1
              UNION ALL
              SELECT
                   t2.RNO as BNO, t2.DATA2 as DATA1, rownum as rn
              FROM
                   TABLE2 t2
              WHERE
                   EXISTS
                        SELECT
                             1
                        FROM
                             table1 t1
                        WHERE
                             t1.bno = t2.RNO
              ORDER BY
                   1,3
    BNO                    DATA1               
    111                    200                 
    111                    100                 
    111                    100                 
    111                    100                 
    112                    400                 
    112                    400                 
    113                    500                 
    113                    500                 
    8 rows selected

  • VLD-2754 - attributes of update matching criteria are not mapped

    For some reason, when we define a cube that uses a particular dimension, the mapping always fails with the error:
    "If an attribute is used in the matching criteria but is not mapped, then the matching condition cannot be determined. For the attributes (DIM_CT) to be used for matching, they must be mapped for TEST_CUBE. To deselect an attribute as a matching criteria, set Update Use For Matching to No."
    I can't seem find an option for Update Use For Matching. On my source table, I have some options for matching keys but I don't understand exactly how that pertains to the mapping target.

    Hi,
    You must be dealing with an update, upsert or insert update mapping here. Check the attribute properties of the fields on your target table. You should find the 'Update Use For Matching' property there.

  • Look up ESB Cross-Reference within ODI

    We have a need to look up ESB cross reference table that is populated by AIA PIPs. I saw ESB Cross-Reference KM mentioned in "Oracle Data Integrator Knowledge Modules Reference Guides 10.1.3". My question is that can this KM be used to do ESB cross reference table look up. We don't need to populate xref table, just need to look up.

    Hi Ace2-
    Thanks for your quick response!
    I can able to reterive unmatched records by using “Left outer join” but it will multiple the record counts for “matching condition”.
    PRODUCT_ID,PRODUCT_NAME,SALES_QTY,SALES_AMT
    101,SEGATE-HD,10,100
    101,SEGATE-HD,10,100
    102,TOSHIBA-HD,20,5000
    103,TRANSCEND-PENDRIVE,10,2000
    104,SONY ERICSSON,10,100000
    105,NOKIA-7710,20,20000
    106,TOSHIBA-HD,10,9000
    107,NULL,NULL,NULL
    The above records will be the output of outer join. If you see the 2nd record it is getting duplicated as 1st record. I have to exclude the 2nd record as it increases the record count of “PRODUCT_SALES.csv” file.
    Thanks, Prabhu

  • IF..THEN..ELSE...not working properly

    Hi experts,
    iam facing trouble with IF ..THEN..ELSE function.
    condition is  IF the salearea = 'AB'
    THEN  date trans DDMMYY------>YYYYMMDD
    ELSE date trans MMDDYY----
    >YYYYMMDD
    here always the only  ELSE part working. but if use IF WITHOUT ELSE  like below
    IF the salearea = 'AB'
    THEN  date trans DDMMYY------>YYYYMMDD
    then above condition is working
    iam really not understand the behaviour of IF..THEN..ELSE
    could please suggest how can i resolve the issue
    Thanks
    vasavi

    Hi,
    Check the OSS note 1090369.
    https://service.sap.com/sap/support/notes/1090369
    From SAP Note----
    Symptom
    The behaviour of functions 'if' and 'ifWithoutElse' in Message-Mapping has been changed. We have changed it after we've become aware of the fact that both functions behave inconsistently with the documentation.
    This change has some important consequences, which are described in this note.
    Let us consider the function 'if'. The situation with 'ifWithoutElse' is analogous to it.
    There are, in fact, two distinct use-cases for the function 'if':
    1. One is when the function is used as an if statement. For example, consider this pseudocode:
    if <condition>
      value = <expression1>
    else
      value = <expression2>
    end
    In this case, one expects that the <condition> expression is evaluated first and then, depending on the value of the condition, one of the branch expressions is evaluated and assigned to variable 'value'.
    2. The second use case is when the function is used as a procedure. In pseudocode:
    value = if (<condition>, <expression1>, <expression2>)
    In this case, all three expressions (<condition>, <expression1> and <expression2>) whould be evaluated first and the results of this expressions would be passed to function 'if', which in turn, would return one of them, depending on condition value, to be assigned to 'value' variable. This second use-case is also known in some programming languages as function 'iif'.
    In Message-Mapping, the analog of evaluating an expression is advancing a pointer on one of the argument queues of a function. It turned out that the function 'if' did not consistently work either way and that the customers need both variants of the function. The SAP Note 1053706 has delivered the first patch to the function 'if'. This patch was not functionally complete and the function 'if' was patched again. The SAP Note 1085331 has delivered the finally fixed function 'if'. With this Note, the function always works as in use-case 2 above. That is, all arguments are evaluated first, then value of one of them is returned. To minimize compatibility problems with old usages, the function makes one exception to this rule: in case when evaluating one of the branches throws an Exception, the function ignores it, if the exception is in the branch that is not selected by condition.
    This change in behaviour can lead to some of the Message-Mappings producing different results than before implementing the patch.
    One common problem situation is when one of the branches of function 'if' contains a User-Defined function that produces side-effects. Like increments and stores a counter in 'GlobalContainer', for example. Such functions will be executed more times than before and will cause the numbering to go awry.
    Other terms
    Message Mapping, XI, PI, IF,IFS IFSWIthoutElse Boolean functions
    Reason and Prerequisites
    See above.
    Solution
    To provide customers with functions to use in use-case 1 above, SAP will deliver new standard functions 'ifS' and 'ifSWithoutElse'. The 'S' in the names states for 'Statement'. The new functions will be delivered in
    Patch level 1 of SP21 of XITOOLS 3.0,
    and SP22 onwards
    Patch level 1 of SP14 of XITOOLS 7.0,
    Patch level 2 of SP15 of XITOOLS 7.0
    and SP16 onwards
    SP05 of SAPXIESR 7.1 and SAPXIPCK 7.1,
    and subsequent Support Packages of each corresponding major release.
    It is not recommended to install the patches between SAP Note 1053706 and 1085331. If you decide to install a patch from Note 1085331 or any subsequent release, carefully test Message-Mappings before deploying the patch in productive systems.
    In case the upgrade is necessary and Message-Mappings do not work as before, there is a possibility to workaround the problem. There's no known generic workaround for all kinds of problems that can arise.
    Note :
    IFS and IFSWIthoutElse functions have a Limitation.
    When the The IFS and IFSWIthoutElse functions have the UDF of type Queue or Context, it will be executed unconditionally.
    i.e the Queue UDF will be executed once even it does not have a matching condition in the input queue and the Context UDF will be executed once for every Context in the input queue, even if there is no matching condition in the input context.
    For situation with functions leaving side-effects described above, we recommend to add a new argument to the User-Defined Function and create the side-effect conditionally based on that argument. Most probably you will want to put in this additional argument the same queue that you use in condition for function 'ifS'.
    Please read the relevant Note 1158485 also.
    END of Note -
    Thanks
    SaNv...

  • HT204486 Sharing Photo library with family members with different iCloud accounts?

    How might one share Photos library with family members with their own Apple IDs?

    I would try the following:
    1. Create a smart album. Match condition as "Album" is "Any". That should capture all your photos and videos as of now.
    2. Share that Album via iCloud photo sharing, sending invitations to the family members.

  • Error while updating Ship to Address on Sales Order form

    hi ,
    A user is trying to update the ship to address on a standard sales orders screen, this is pretty common and never caused any issues. However with one particular order the user gets the following error :
    "You cannot update Ship To Location; the standard value rule set prevents override. "
    This is an Oracle shipped message and not custom code. The message name is OE_SEC_UPDATE_VIOLATION whose text is : You cannot update &ATTRIBUTE; &REASON
    Seems like REASON is the message : OE_SEC_SV_VIOLATION, whose text is
    " the standard value rule set prevents override. "
    This is a message shipped by Oracle Order entry. I am not able to locate this message since the oracle shipped files are not available to us and this is not in any database code(i searched the code)
    Does anyone know when this message is thrown. It seems like some value set error but am not able to figure out where it is being set.
    Any help in this will be appreciated.
    Thanks

    Did you check if any Processing rule is defined for Ship to location update :
    Setup> Rules > Security > Processing constraint ?
    Maybe this order matches condition that prevents this field from being updated.

Maybe you are looking for

  • 6233 message recipient choices

    When starting a new text message on a 6233 to choose a recipient you are presented with the list of options below Recently used Open log Contact Contact group As most text message recipients are going to be in your contacts list it would more sense f

  • ICal pops up automatically when edited reminder on iPhone

    hi, I have calendars/reminder on iCal and iPhone synced to the same iCloud account. The problem is that whenever I finish editing a reminder item on my iphone, the desktop iCal automatically opens (app previously closed). Why and how to solve? Thanks

  • Is After Effects a better option for Chroma???

    Hi all, For some time I have not been happy with the quality of our finished chroma key output. I am using a green screen, professional lighting and camera operator, as well as Color Smoother, 8 Point Garbage Matte etc etc In a previous life I used A

  • Can I download the instrument Control and Data Aquisition Device Driver CD for 7.1?

    Greetings, Can I download the instrument Control and Data Aquisition Device Driver CD for 7.1? I'm trying to find out if I can download the instrument Control and Data Aquisition Device Driver CD for 7.1. Instead of downloading all the upgrades? Is t

  • Iphone 6 cracked screen replacement in Greece

    Recently my (3 months purchased) iphone 6 fell of my hand and the screen cracked. I got in contact with the official distributor in Greece (INFOQUEST, www.infoquest.gr) and they informed me that a screen replacement is not possible through their Serv