SQL Query to find out similar names in two tables

Hi,
I want to write a query which will return the records by matching the two table with the similar name.
that is I have two tables table1 and table2, and in table1 the column1 is having data like
ABC INC
The international Company
and in the table2 has the column1 which has the data like
ABC Corp
The Financials Corporation
So as per the requirement now my select query should return 1 row as ABC INC and ABC Corp are similer.
and both the tables have around 50,000 reords so I cannot just take the first word by using substring and tryto match both, this will work only for names like ABC INC and ABC Corp but it will not return the names like
"Instruments International Company" and "International Instruments Company"
Please can any one help me?
Regards,
Chanda

I don't have access to text here so I can't check.Almost. Better to use OR than AND:
SQL> CREATE TABLE t (ID INTEGER, text VARCHAR2(2000))
  2  /
Table created.
SQL> INSERT INTO t
  2       VALUES (1, 'The international Company')
  3  /
1 row created.
SQL> INSERT INTO t
  2       VALUES (2, 'ABC INC')
  3  /
1 row created.
SQL> CREATE INDEX t_txt_idx ON t
  2  (text)
  3  INDEXTYPE IS ctxsys.CONTEXT
  4  /
Index created.
SQL> SELECT *
  2    FROM t
  3   WHERE contains (text,
  4                   REPLACE ('International Instruments Company', ' ', ' & ')
  5                  ) > 0
  6  /
no rows selected
SQL> SELECT *
  2    FROM t
  3   WHERE contains (text,
  4                   REPLACE ('International Instruments Company', ' ', ' | ')
  5                  ) > 0
  6  /
ID TEXT
  1 The international Company
BUT than also :(
SQL> SELECT *
  2    FROM t
  3   WHERE contains (text,
  4                   REPLACE ('Company Instruments', ' ', ' | ')
  5                  ) > 0
  6  /
ID TEXT
  1 The international Company

Similar Messages

  • SQL Query to Find out User has what all resources provisioned !

    Hi Guys ,
    Does any one have a SQL query to find out what resources are provisioned to a particular user ?
    Thanks
    Suren

    Hi,
    Hope this will help you.
    SELECT distinct usr_login as "IdM User ID",
    usr_employeeID as "Employee ID",
    usr.USR_FIRST_NAME as "First Name",
    usr.USR_LAST_NAME as "Last Name",
    usr_status
    as "User Status",
    USR_EMP_TYPE as "Employee Type",
    obj.obj_name as "Application Resource",
    ost_status as "Application Resource Status",
    FROM ost,oiu,obj,usr,obi
    WHERE oiu.ost_key = ost.ost_key AND obj.obj_key = obi.obj_key AND oiu.usr_key = usr.usr_key
    AND ost_status in ('Provisioned','Revoked','Disabled', 'Provisioning')
    AND oiu.obi_key=obi.obi_key
    AND usr_EmployeeID like '11111'
    This query will provide all the resources to which the user is linked with and the resource status is in 'Provisioned','Revoked','Disabled', 'Provisioning' status for a particular employeed ID, I am not completely sure whether I have given the Employee ID column from USR table as correct or not. Verify once and query the DB

  • How to find out the name of a table?

    Hi
    How can I find out the name of a table which doesn't have a record history?
    Regards
    Rahman

    No direct way to know the tables. What you will find on the ABout this page link are the View Object (similar to record sets), Entity objects, controller and Application module. Generally EO is based on a table or the VO can be based on the query which you can find the corresponding xml file. But a button action might be calling a method in AM or CO which in turn call some wrapper method to interact with database. So nothing straight forward. You will have to analyze the all page related code objects.
    They are specific to OA framework and if you are not aware about them, better go through the initial chapters of OAF dev guide.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL query to find out last login for each database

    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    Steve

    Steve wrote:
    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    SteveI'm curious as to how you collect this information from multiple databases into one database, and of what value the data is once you have it.

  • Need sql query to find out same item is used in open po and closed po

    Hi Experts,
    I have an requirement is that, i need to find out the item is used in open po and closed po.
      example: A is the item is used in closed PO and Open PO.
      i need to write down the scripts how many same items is used in open po and closed po.
    if any sql script is there please share.
    Please let us know if any concerns.
    Thanks
    bmn

    Hi
    Please try below query
    select
    distinct c.segment1
    from
    po_lines_all a,
    po_line_locations_all b,
    mtl_system_items_b c
    where
    a.po_line_id= b.po_line_id
    and a.item_id=c.inventory_item_id
    and b.closed_code='OPEN'
    and a.item_id in ( select 
    item_id
    from
    po_lines_all d,
    po_line_locations_all e,
    mtl_system_items_b f
    where
    d.po_line_id= e.po_line_id
    and d.item_id=f.inventory_item_id
    and e.closed_code in ('CLOSED','FINALLY CLOSED','CLOSED FOR INVOICE','CLOSED FOR RECEIVING'));

  • Need sql query to find out Joins attached with folders in Discoverer

    Hi,
    Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
    Actually we have to identify all the joins conditions from folders those are migrated from one instance to others.
    Thanks
    abhishek

    I recommend that you implement the admin EUL supplied by oracle, you can get there a lot of repository information (metalink note: 556932.1).
    Try to use this (maybe you will need some pkg's):
    SELECT
    DECODE(KEYS.FK_MANDATORY,
    1,
    'Always exist in master folder',
    'Might not exist in master folder') "Detail Item values",
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID, 'N') "Join Master --> Detail",
    KEYS.KEY_DESCRIPTION JOIN_DESCRIPTION,
    KEYS.KEY_DEVELOPER_KEY JOIN_IDENTIFIER,
    KEYS.KEY_NAME JOIN_NAME,
    DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') "AutoGen",
    DECODE(DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') ,
    'Yes',
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID),
    KEYS.KEY_NAME) "Actual Join Name",
    KEYS.KEY_UPDATED_DATE JOIN_LAST_UPDATE,
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "One to One join",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) "Outer Join on Detail",
    DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) "Outer Join on Master",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) || DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) ||
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "Optional Join Configurations",
    OBJ.OBJ_NAME "MASTER_FOLDER",
    OBJ_DETAIL.OBJ_NAME "DETAIL_FOLDER"
    FROM EUL10G_US.EUL5_OBJS OBJ,
    EUL10G_US.EUL5_EXPRESSIONS EXP,
    EUL10G_US.EUL5_KEY_CONS KEYS,
    EUL10G_US.EUL5_OBJS OBJ_DETAIL
    WHERE ((KEYS.KEY_ID = EXP.JP_KEY_ID) AND
    (OBJ.OBJ_ID = KEYS.FK_OBJ_ID_REMOTE) AND
    (OBJ_DETAIL.OBJ_ID = keys.KEY_OBJ_ID));

  • Sql query to find out the space issues in not able to allocate next extent

    hi,
    i have oracel 11g on linux.
    my datafiles are autoextend off. i am looking for query to make sure the segments does not stop growing by reaching the maximum segment allocated or no free contigous space available in allocating new extent,.
    i need to know periodically the owner,object_name and object type (table or index) which are suffocating for space.
    any ad-hoc sql query exists?
    thanks in advance.

    Connect as sysdba and try..
    To list all objects >100M in size.
    SQL> select owner, segment_type, segment_name, sum(bytes)/(1024*1021) from dba_segments
    group by owner, segment_type, segment_name
    having sum(bytes)/(1024*1021) > 100
    For tablespaces ..
    select tablespace_name, sum(bytes) tablespace_size
    from dba_data_files
    group by tablespace_name
    union all
    select tablespace_name, sum(bytes) tablespace_size
    from dba_temp_files
    group by tablespace_name
    order by tablespace_name

  • Need sql query to find out Joins attached with folders

    Hi,
    Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
    We dont want to see those from front end(disc admin).
    Thanks
    abhishek

    abhishek - This is the Application Express forum. I have no idea what you are asking but it may need to be directed to a different forum.
    Scott

  • How to Find out the Name of the Table in Data Sources

    Hi All,
    How Can i find out the table names used in data Sources.
    For EX. Suppose I want to find out the table Names  in R3 Used In GL Data Source 0FI_GL_4.
    Thanks in Advance.
    Vaibhav A

    Hi,
    Usefull link:
    https://wiki.sdn.sap.com/wiki/display/BI/BW%20SD%20MM%20FI%20DATASOURCES
    Regards.

  • Find out the name of a table

    Hi Gurus,
    I would like to know the name of the table which is filled with the WPUBON Idoc types.
    The only sales data available to extract to BW is the data generated by the transaction WPUK, but the extractor MC43RK0CAS doesn't get any sales data to 2LIS_43_POSCAS.
    Best Regards,
    Patrício Silva

    Hi Cereal Cerial
    How are you. Hope everything is fine.
    I am also working on 2lis_43_poscas, 2lis_44_posrec data sources.
    I transfer these two datasources and activate thru LBWE still no success.
    I didnt find where we should generate setup tables for these data sources.
    Always 0 data records showing in RSA3.
    If u get any solutions for this, plz let me know.
    Kindly advise me on the procedure. And if you have a document about it it will be greatly appreciated.
    Advanced Thanks
    Chandra

  • Recursive query for finding parents and children against two tables

    Hi I have two tables where the data is stored hierarchially.
    I have found using connect_by, level and other oracle functions doing its job when the data is in one table.
    Can I traverse against two tables by using the same oracle functions.
    My Table A can go 2 levels deep in my hierarchy and level 3 and so forth has to be done against a different table.
    Appreciate your insight..
    Thanks in advance

    The number of levels that I can traverse in the first table is dynamic (sometimes 2 levels and sometimes 3 levels and actually no level limit) and then has to dynamically start looking at second table for finding any more levels in the other table.
    I was able to implement them seperately and union them.
    I was more looking for a comprehensive solution to reduce the number of lines that I have to maintain...
    Thanks in advance
    Edited by: user566193 on Jan 15, 2010 1:58 PM

  • Sql query to find out last update of 6 hours

    i have table emp . for Exp.
    create table emp
    (empno number(5),
    ename varchar2(20),
    last_update date );
    Now i want the all data which is update in last 6 hours

    Assuming an INDEX, WHERE Last_Update > SysDate - 6/24; is better and clearer.
    It is better because it allows INDEX use. That is because it does not manipulate the COLUMN value.
    It is clearer because it clearly states what we want, the records where Last_Update is after a value of six hours before. In the other query, we are checking for records where Last_Updated minus six hours is after current time. Personally, I find that harder to follow.
    SQL> CREATE TABLE Emp(EmpNo NUMBER(5), EName VARCHAR(20), Last_Update DATE);
    Table created.
    SQL> CREATE INDEX Emp_Last_Update ON Emp(Last_Update);
    Index created.
    SQL> INSERT INTO Emp(Empno, EName, Last_Update) SELECT 626, 'user626892', SysDate - Level FROM Dual CONNECT BY Level <= 10000;
    10000 rows created.
    SQL> exec DBMS_STATS.Gather_Schema_Stats(NULL);
    PL/SQL procedure successfully completed.
    SQL> EXPLAIN PLAN FOR SELECT * FROM Emp WHERE SysDate - Last_Update <= 6/24;
    Explained.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |   500 | 11500 |    15  (14)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |   500 | 11500 |    15  (14)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(SYSDATE@!-"LAST_UPDATE"<=.25)
    13 rows selected.
    SQL> EXPLAIN PLAN FOR SELECT * FROM Emp WHERE Last_Update > SysDate - 6/24;
    Explained.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 38459689
    | Id  | Operation                   | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                 |     1 |    23 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMP             |     1 |    23 |     3   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | EMP_LAST_UPDATE |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("LAST_UPDATE">SYSDATE@!-.25)
    14 rows selected.

  • Sql Query To Find Out list of users not having a particular resource provisioned

    Hi,
    I know the query for all the resources tagged to user with their account status.
    Can anybody help me with a query to fetch just the user details for the following scenario:
    1)Active users having  having no instance of a particular resource.
    Condition: Exclude Active users having one provisioned instance of the resource and fetch user details having no provisioned account for that resource .
    it is just for report purposes.So format is not of concern.Just need the list of users not having a single provisioned account for a particular resource.

    Hi,
    Please try the below query :
    select distinct usr.usr_login from USR,OIU where USR.USR_KEY not in (select OIU.USR_KEY from OIU)
    and OIU.APP_INSTANCE_KEY= (select APP_INSTANCE_KEY from APP_INSTANCE where APP_INSTANCE_NAME='ADResource');
    Change the app instance name acording to you need.
    -Saurabh

  • Sql query to find out when was the skillgroup created

    Doees anyone know the field which points to the date time when a skillgorup created?I have refered to the schema document-but most dbtime usually points to The current date and time stamp when the records are written to the DBDATETIME’,’ Date and time the agent logged into the skill group,etc.

    Looking at the first time a call was offered against the skill group, or looking at the time stamp of the first ICM script to reference the SG sound like the best options... but still leave a lot of room for error. They basically give you a "created no later than" date. If your ICM is set to automatically keep only a certain number of script versions, you lose history of skill group creation date after a few new script version saves. Call data has a retention period depending on your setup as well.
    One more date you can look at is the earliest schedule on the Call Type. This will have the longest-held dates, but of course this won't give you anything for call types which you only reference within scripts, and will miss data for any schedules you've previously removed from Call Types. (I typically only schedule Call Types that are assigned to DNs, and use Go To Script nodes for script-to-script movement instead of Requalify Call for ease of viewing call flows)
    Why do you need to see when Call Types were created?
    -Jameson

  • I want a sql query to diffrentiate the column names between two schemas

    The structure of the dba_tab_cols table is owner, table_name, column_name, data_type,.....
    So I have a ACCT_ALT_ID table under owner SEODS01 and in that therse are column names
    IBD_ID
    ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID
    DATA_GRP_CDE
    UPDT_DTE
    AND I have a ACCT_ALT_ID table under owner SEODS02 and in that therse are column names
    IBD_ID
    ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID
    DATA_GRP_CDE
    CRTE_PGM
    CRTE_TSTP
    UPDT_PGM
    UPDT_TSTP
    so I want select query to display like this
    SEODS1_ACCT_ALT_ID SEODS02_ACCT_ALT_ID (COLUMN HEADER)
    IBD_ID IBD_ID
    ACCT_ALT_ID_CNTX_CDE ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID EODS_ACCT_ID
    DATA_GRP_CDE DATA_GRP_CDE
    UPDT_DTE CRTE_PGM
    CRTE_TSTP
    UPDT_PGM
    UPDT_TSTP
    AND ALSO I NEED ONE MORE QUERY THAT I DO NOT WANT DISPLAY HAVING SAME COLUMN_NAME LIKE ACCT_ALT_ID_CNTX_CDE ,EODS_ACCT_ID,IBD_ID
    DATA_GRP_CDE

    Hi,
    Welcome to the forum!
    876793 wrote:
    The structure of the dba_tab_cols table is owner, table_name, column_name, data_type,.....
    So I have a ACCT_ALT_ID table under owner SEODS01 and in that therse are column names
    IBD_ID
    ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID
    DATA_GRP_CDE
    UPDT_DTE
    AND I have a ACCT_ALT_ID table under owner SEODS02 and in that therse are column names
    IBD_ID
    ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID
    DATA_GRP_CDE
    CRTE_PGM
    CRTE_TSTP
    UPDT_PGM
    UPDT_TSTP
    so I want select query to display like this
    SEODS1_ACCT_ALT_ID SEODS02_ACCT_ALT_ID (COLUMN HEADER)
    IBD_ID IBD_ID
    ACCT_ALT_ID_CNTX_CDE ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID EODS_ACCT_ID
    DATA_GRP_CDE DATA_GRP_CDE
    UPDT_DTE CRTE_PGM
    CRTE_TSTP
    UPDT_PGM
    UPDT_TSTPYou may have noticed that this site normally doesn't display multiple spaces in a row.
    Whenever you post formatted text (such as query results) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    That way, your message will look like this:SEODS1_ACCT_ALT_ID SEODS02_ACCT_ALT_ID (COLUMN HEADER)
    IBD_ID IBD_ID
    ACCT_ALT_ID_CNTX_CDE ACCT_ALT_ID_CNTX_CDE
    EODS_ACCT_ID EODS_ACCT_ID
    DATA_GRP_CDE DATA_GRP_CDE
    UPDT_DTE CRTE_PGM
    CRTE_TSTP
    UPDT_PGM
    UPDT_TSTP
    This sounds like a jon for a FULL OUTER JOIN:SELECT     s1.column_name     AS seods1_acct_alt_id
    ,     s2.column_name     AS seods2_acct_alt_id
    FROM          dba_tab_cols     s1
    FULL OUTER JOIN     dba_tab_cols     s2 ON s1.column_name     = s2.column_name
    WHERE     s1.owner     = 'SEODS1'
    AND     s1.table_name = 'ACCT_ALT_ID'
    AND     s2.owner     = 'SEODS2'
    AND     s2.table_name = 'ACCT_ALT_ID'
    AND ALSO I NEED ONE MORE QUERY THAT I DO NOT WANT DISPLAY HAVING SAME COLUMN_NAME LIKE ACCT_ALT_ID_CNTX_CDE ,EODS_ACCT_ID,IBD_ID
    DATA_GRP_CDESorry, I don;t understand.
    Post the results you want (formatted, between \ tags, of course).
    Do you want only the column names that appear in one table or the other, but not in both?
    In that case, you can add a condition like this to the WHERE clause:
    AND       (   s1.column_name  IS NULL
           OR  s2.column_name  IS NULL
           )

Maybe you are looking for

  • Pages 5.0 removing images from tables.

    After upgrading to Pages 5.0 I now receive a message when opening any file with a table that has images in the cells.  Basically Pages is removing all images from table cells.  Anyone having this problem and is there an easy fix?

  • Updating invoice value in po history

    HI gurus,            I have done vendor invoice through F-43, by using PO document no.... but when I see the PO history, It's not updating invoice values.. How could I get the values??

  • How to copy sender ID?

    I got commercial spam in iMessage. I forwarded the content of the spam to 7726 (SPAM) and immediately got a reply from my carrier (AT&T) asking me to send in the spammer's number. The spam's sender id (apparently an email address) is too long to fit

  • New SRID (3857) in 11.2.0.2 (use instead of 3785)

    The new srid epsg:3857 in 11.2.0.2 does not require a tfm_plan or the use case use_spherical to correctly line up with google or bing background maps. The doc wasn't updated in time. See the sample results below. . First geom. In 8307, 2nd in 3785 wi

  • Adobe interactive forms for VA01

    I'm looking for a list of all Adobe interactive forms that are available for ECC Enh4... we are looking to create an adobe template for SAP transaction VA01 (Create Sales Order). I've looked at table FPLAYOUT but the form names are very cryptic. Than