Alternative to find unique records with 60 character in selection string.

Hi,
We have to find out the values from the Infoobject. When we try to display data from an master object, the maximum length of selection it accepts 45 characters only but we need to input data around 60 characters in selection.
Thing we tried:
1. Selecting complete data without any condition but it did not work due to large volume of data.
2. We tried to extract data from RSA3 but it did not work due to large volume of data.
Please suggest me alternative to find unique records with 60 character in selection string.
Regards,
Himanshu Panchal.

This sounds a bit strange. Are you perhaps mistakenly storing text data incorrectly as the primary key of the master data? I can't think of any actual data that is that length to ensure usinqueness - even GUIDs are maximum 32 characters - but GUIDs don't count as actual "readable" data although you do need to be able to select it from time to time. Perhaps you have a super secure password hash or something like it ?
Also are you expecting to have a unique single record returned by your selection? To do this would in general REQUIRE that ALL the data is read because master data is not stored in the DB sorted by the data itself, but stored instead sorted by the it's SID.
When you say you are selecting data from master data, which master data tables are you using? I have been able to select data from very large MD table (15 million unique records) using SE16 with no problems. Just enter the table name, and before you execute just count the number of records - it helps to know what you want to end up with.
Have you tried using wild cards (the *) to preselect a smaller number of records : * a bit of your 60 character string *
If you are trying to select from a non-key field you will encounter performance issues, but you can still use the wildcards, and get a result.
Don't use RSA3 it was designed to make selections and group them into datapackets. It's not the same as selecting directly on the table in SE11 or SE16

Similar Messages

  • How to retrieve unique records with more than one column

    I have a table sps_prod as described below -
    POGNAME VARCHAR2(1500)
    INDEX#VERSION VARCHAR2(200)
    POG_MODEL_STATUS VARCHAR2(100)
    POG_LAYOUT_TYPE VARCHAR2(500)
    POG_MARKET_SPECIFIC VARCHAR2(500)
    POG_CONTACT_NUMBER VARCHAR2(100)
    AREA_SUPPORTED VARCHAR2(500)
    POG_COMMENTS VARCHAR2(1500)
    POG_FOOTER_COMMENTS VARCHAR2(1500)
    POG_ELECTRICAL_LIST_1 VARCHAR2(1500)
    POG_ELECTRICAL_LIST_2 VARCHAR2(1500)
    POG_CARPENTRY_1 VARCHAR2(1500)
    POG_CARPENTRY_2 VARCHAR2(1500)
    INSTALLATION_INSTRUCTION_1 VARCHAR2(1500)
    INSTALLATION_INSTRUCTION_2 VARCHAR2(1500)
    FIXTURE_REORDER_NUMBER VARCHAR2(200)
    FIXTURE_ID VARCHAR2(200)
    FIXTURE_NAME VARCHAR2(500)
    FIXTURE_IMAGE VARCHAR2(500)
    PART_REORDER_NUMBER_9 VARCHAR2(500)
    PART_FIXTURE_ID_9 VARCHAR2(500)
    PART_FIXTURE_NAME_9 VARCHAR2(500)
    PART_FIXTURE_IMAGE_9 VARCHAR2(500)
    UPC VARCHAR2(50)
    ITEM_NUMBER VARCHAR2(50)
    DESCRIPTION VARCHAR2(700)
    MERCH_TYPE VARCHAR2(20)
    HEIGHT VARCHAR2(100)
    WIDTH VARCHAR2(100)
    DEPTH VARCHAR2(100)
    CREATE_TS DATE
    There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. There are no keys defined on the table.
    I guess this is a simple problem but the fact that I am trying to retrieve all the columns is stumbling me.
    Thanks in advance.

    Hi,
    Sanders_2503 wrote:
    ... There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. I don't see a column called reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?
    So you want only one row for each distinct combination of fixture_name and some other column (I'll assume that's fixture_reorder_number). Does it matter which row? They won't necessarily have the same values for the other columns.
    The query below returns the one with the first pogname (in sort order):
    WITH     got_r_num     AS
         SELECT  pogname, index#version, pog_model_status, pog_layout_type
         ,     pog_market_specific, pog_contact_number, fixture_name
         ,     ROW_NUMBER () OVER ( PARTITION BY  fixture_name
                                   ,                    fixture_reorder_number
                             ORDER BY        pogname
                           )         AS r_num
         FROM    sps_prod
    SELECT  pogname, index#version, pog_model_status, pog_layout_type
    ,     pog_market_specific, pog_contact_number, fixture_name
    FROM     got_r_num
    WHERE     r_num     = 1
    ;If there happens to be a tie (that is, two or more rows with the same fixture_name, fixture_number, and first pogname) then one of the will be chosen arbitrarily.
    Instead of "ORDER BY pogname", you can ORDER BY any other columns or expressions, but you must have an analytic ORDER BY clause. You can make it "ORDER BY NULL" if you really want to pcik an arbitrary row.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data (or a couple of examples of acceptable results).
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • Find all records that have character alone in a string

    Oracle 10g Enterprise Edition
    Hi all,
    I must select from a varchar2 field, all the records that have a character (number or char) alone in the string.
    For example.
    ASDF BHGR H RR (yes, cause "H")
    ASDF BHGR H4 R (yes, cause "R")
    ASDF B H4 DDR (yes, cause "B")
    ASDF B H4 DDR (yes, cause "B")
    ASDF BC 1 DDR (yes, cause "1")
    ASDF BC / DDR (yes, cause "/")
    ASDF BHGR H4 RR (no)
    ASDF (no)
    I'm trying by SubStr, but I cannot generally solutions.
    Thank's for any suggestion.
    Ciao

    Ok, just a try :
    SQL> with tbl as
      2  (select 'ASDF BHGR H RR' str from dual union all
      3   select 'ASDF BHGR H4 R' str from dual union all
      4   select 'ASDF B H4 DDR' str from dual union all
      5   select 'ASDF BHGR H4 R1' str from dual union all
      6   select 'ASDF BHGR H4' str from dual union all
      7   select 'ASDF - H4' str from dual union all
      8   select 'a1 ASDF BHGR H4' str from dual union all
      9   select 'ASDF B H4 DDR' str from dual union all
    10   select 'ASDF BC 1 DDR' str from dual union all
    11   select 'ASDF BC / DDR' str from dual)
    12  select str,
    13         decode(regexp_instr(str,'^. | . | .$'),0,'no',decode(regexp_instr(str,'^- | - | -$'),0,'yes','no')) res
    14  from tbl;
    STR             RES
    ASDF BHGR H RR  yes
    ASDF BHGR H4 R  yes
    ASDF B H4 DDR   yes
    ASDF BHGR H4 R1 no
    ASDF BHGR H4    no
    ASDF - H4       no
    a1 ASDF BHGR H4 no
    ASDF B H4 DDR   yes
    ASDF BC 1 DDR   yes
    ASDF BC / DDR   yes
    10 rows selected.May is there is a simpler way.
    Nicolas.

  • Finding the record with the latest date

    Post Author: sconlon
    CA Forum: General
    Hi,I am using CR 8 with an Access database which has a table that holds (multiple) sales records for each of our clients. I want to create a report that lists only the latest sale from each client.  I am thinking that I first need to group by client and then create a sub-report that prints the necessary details of sales record with the latest date of sale.  It's this last bit that I cannot figure out how to do.  Can anyone suggest a way of doing this?Many thanks,sconlon

    Post Author: Jagan
    CA Forum: General
    Charliy's suggestion if fine, and does require sorting and displaying in the group header/footer according to the sort order. In case it's not clear, when you print in the group header you are using the first record's data; when you print in the group footer you are using the last record's data (first and last within the group that is).
    Personally, I'd group on the client have a group selection formula of:
    {table.date_field} = maximum({table.date_field}, {table.client_id})
    so that there's no date sort required as you'll only get one record per client group - assuming that each record has a unique date of course. I'd probably still suppress the details section and display in the group footer, but it wouldn't matter if you use the details section either.
    I believe the benefit with the group selection formula is that any summary formulas, running totals etc. you use would only have the one record per client to work on, rather than including all of the suppressed records too.

  • Query Unique Records WITH ROWID

    Hi All,
    I have 2 columns which returns records like this Say Column A and Column B.
    A B
    1 1
    1 1
    2 2
    2 2
    3, 3
    I need only distinct records from these columns. So i executed DISTINCT Clause in my query and it returned unique records. Issue is I need to execute a query like this i.e compulsorily use ROWID in my select list.
    i.e SELECT DISTINCT ROWID A, B from TEST;
    But this query we will give duplicated records only when we give rowid, how to achieve a output like this using rowid in the column select list of my query.
    A B
    1 1
    2 2
    3, 3
    Please Help.
    Thanks in advance.

    If you want just one rowid for each (a, b) couple:
    SQL> select a, b, min(rowid)
      2  from y
      3  group by a, b;
             A          B MIN(ROWID)
             1          1 AAAfoUAAEAAA7T0AAA
             2          2 AAAfoUAAEAAA7T0AAC
             3          3 AAAfoUAAEAAA7T0AAEIf you want all rowid's for each couple:
    SQL>select a, b, rtrim(extract(xmlagg(xmlelement("a",rowid||',')),'//text()'),',') rowids
      2  from y
      3* group by a, b
             A          B ROWIDS
             1          1 AAAfoUAAEAAA7T0AAA,AAAfoUAAEAAA7T0AAB
             2          2 AAAfoUAAEAAA7T0AAC,AAAfoUAAEAAA7T0AAD
             3          3 AAAfoUAAEAAA7T0AAEThanks Buga for posting sample data ;)
    Max
    [My Italian Oracle blog| http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • How to find out how many space character in setence (string var) ?

    Dear all Master,
    I need Your help please.
    Topic:
    Script Editor.
    My System:
    -CUCM 7.0
    -UCCX 7.0 premium
    -Nuance recognizer 9.0
    Question:
    ABC = string var.
    ABC = "this is sample"
    2 space character in ABC string var.
    How to find out how many space character in ABC var ?
    Regards,
    Susanto

    Hi
    Create a int variable called whatever you want, then insert a SET step.
    Set the variable to the new int you created, and then paste this into the 'value' field:
    String[] myarray = teststring.split(" ");
    return myarray.length -1 ;
    Basically it splits the string into chunks each time it hits the " " character.
    This results in an array of the resulting chunks (i.e. words), which is one more than the number of spaces. -1 from that, and you have your int variable set to the number of spaces.
    Regards
    Aaron
    Please rate helpful posts...

  • Find unique row with max func

    I am really stupid of this right now. Have not tried the regular SQL for long time, so my question is that I have a table- Cost
    A     B     C     D     E     F
    0002     6002     5     55     68.35     6.12
    0003     6003     5     99.26     89.33     8.23
    0004     6004     5     78.85     4.4     7.42
    0004     6004     6     78.85     8.1     1.7
    0004     6004     7     78.85     70.9     6.73
    0005     6005     5     49.88     76.1     68.53
    0005     6005     6     49.88     93.7     18.57
    0005     6005     7     49.88     255.7     63
    How can I get the column E and F, when I want to get the row with highest order in C as result in
    A     B     C     D     E     F
    0002     6002     5     55     68.35     6.12
    0003     6003     5     99.26     89.33     8.23
    0004     6004     7     78.85     70.9     6.73
    0005     6005     7     49.88     255.7     63
    I used the max () and group by in query as
    select A, B, max(C), D
    from cost
    group by A,B,D
    If I added the max(E) and max(F) in the SELECT, I got correct row in E but not the F.
    Please help me out. Thanks.

    an alternative using analytic fiunctions would be:
    select "A","B",max("C"),"D","E","F" from
    (select "A","B","C",last_value("D") over (partition by "A","B" order by
    "A","B","C" rows between unbounded preceding and unbounded following) "D",
    last_value("E") over (partition by "A","B" order by
    "A","B","C" rows between unbounded preceding and unbounded following) "E",
    last_value("F") over (partition by "A","B" order by
    "A","B","C" rows between unbounded preceding and unbounded following) "F"
    from test1)
    group by "A","B","D","E","F"
    order by "A","B"
    this appears to give a better plan on the test data but you would want to test with a larger volume, we have reduced to numbet of buffer gets but added two sorts currently these fit in memory but you may find with a larger dataset these result in disk sorts.
    Chris
    Autotrace output:
    SQL> select * from test1 where "A"||B||"C" in (select "A"||B||Z from (select "A", B, max("C") Z from test1 group by "A",B));
    A    B             C          D          E          F
    0002 6002          5         55      68.35       6.12
    0003 6003          5      99.26      89.33       8.23
    0004 6004          7      78.85       70.9       6.73
    0005 6005          7      49.88      255.7         63
    Execution Plan
    Plan hash value: 2706139598
    | Id  | Operation             | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |          |     1 |    50 |     8  (25)| 00:00:01 |
    |*  1 |  HASH JOIN            |          |     1 |    50 |     8  (25)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL   | TEST1    |     8 |   192 |     3   (0)| 00:00:01 |
    |   3 |   VIEW                | VW_NSO_1 |     8 |   208 |     4  (25)| 00:00:01 |
    |   4 |    HASH UNIQUE        |          |     8 |   104 |     4  (25)| 00:00:01 |
    |   5 |     HASH GROUP BY     |          |     8 |   104 |     4  (25)| 00:00:01 |
    |   6 |      TABLE ACCESS FULL| TEST1    |     8 |   104 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("$nso_col_1"="A"||"B"||TO_CHAR("C"))
    Statistics
              0  recursive calls
              0  db block gets
             64  consistent gets
              0  physical reads
              0  redo size
            795  bytes sent via SQL*Net to client
            381  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL>
    SQL> select "A","B",max("C"),"D","E","F" from
      2  (select  "A","B","C",last_value("D") over (partition by "A","B" order by
      3  "A","B","C" rows between unbounded preceding and unbounded following) "D",
      4  last_value("E") over (partition by "A","B" order by
      5  "A","B","C" rows between unbounded preceding and unbounded following) "E",
      6  last_value("F") over (partition by "A","B" order by
      7  "A","B","C" rows between unbounded preceding and unbounded following) "F"
      8  from test1)
      9  group by "A","B","D","E","F"
    10  order by "A","B";
    A    B      MAX("C")          D          E          F
    0002 6002          5         55      68.35       6.12
    0003 6003          5      99.26      89.33       8.23
    0004 6004          7      78.85       70.9       6.73
    0005 6005          7      49.88      255.7         63
    Execution Plan
    Plan hash value: 3359524756
    | Id  | Operation            | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |       |     8 |   496 |     5  (40)| 00:00:01 |
    |   1 |  SORT GROUP BY       |       |     8 |   496 |     5  (40)| 00:00:01 |
    |   2 |   VIEW               |       |     8 |   496 |     4  (25)| 00:00:01 |
    |   3 |    WINDOW SORT       |       |     8 |   192 |     4  (25)| 00:00:01 |
    |   4 |     TABLE ACCESS FULL| TEST1 |     8 |   192 |     3   (0)| 00:00:01 |
    Statistics
              0  recursive calls
              0  db block gets
              7  consistent gets
              0  physical reads
              0  redo size
            802  bytes sent via SQL*Net to client
            381  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              4  rows processed
    SQL>

  • Unable to find any record with GUID/Deleting old users from the Proxy DB

    It seems that I have old users in my proxy db that need removing as per the below post.
    http://discussions.apple.com/thread.jspa?messageID=8062329&#8062329
    The problem, I have is that after I have ran the python script as per this link:
    http://trac.calendarserver.org/wiki/ProxyCleanup
    I get the following response:
    +diary:~ root# sudo python /Users/admin/Desktop/proxyclean+
    +CalendarServer proxy DB clean-up tool+
    =====================================
    +Parsed: /etc/caldavd/caldavd.plist+
    +Found DS Node: /Search+
    +Found proxy DB path: /Library/CalendarServer/Calendar Files/principals/.db.calendaruserproxy+
    +Loading /Users records from OD: /Search+
    +Found 104 /Users records+
    +Reading proxy DB: /Library/CalendarServer/Calendar Files/principals/.db.calendaruserproxy+
    +Found 1 proxy DB records+
    +Failed: need more than 1 value to unpack+
    Could this have something to do with the fact that I have my iCal Server bound to my ODM?

    Additionally, can you confirm that all server components are running the latest updates, as are the clients / phones involved in the conference?
    I've seen this exact behavior when the invite / adding of additional participants was being performed ad-hoc on a CX3000. It transpired that a firmware upgrade on that device rectified the problem.
    Kind regards
    Ben
    Blog:www.gecko-studio.co.uk/ 
    Twitter:
      LinkedIn:
      Facebook:
    Note: If you find a post informative, please mark it so using the arrow to the left. If it answers a question you've asked, please mark the thread as answered to aid others when they're looking for solutions to similar problems
    or queries.

  • Find the count of the character in a string

    Hi,
    i have a scenario like i have one string in that character is repeated for more than one time.
    i want to know how many times that character is appeared in that string by using sql query.
    example: "Hello welcome to oracle world" In this i want to know how many time "e" is appeared..
    i think we can achieve by using instr and substr but i am not clear can any body please help me by using sql query to solve this issue

    regexp_count() function.
    Better answers available on the SQL-PLSQL forum. PL/SQL
    Edited by: SK1 on May 24, 2012 11:30 AM

  • Help needed to get unique record from an internal table

    Hi Everybody,
    I have to get unique record from an internal table. i know we can use read statement with key condition .
    But the problem is i have to use some relational operators like GE or LE.
    eg
    read table itab into wa with key width GE itab-widthfrom
                                                       width LE itab-widthto
                                                       machno eq itab-machno.
    Its giving me error when I use the operators GE , LE.( I think since it can't find a unique record with those relational
    operators in the with key statement)
    Is there any other way to get unique record from internal table without using the loop?
    Thanks,
    Sunny

    Using the read statement you will need some kind of loop. For example.
    DO.
    READ TABLE......
      WITH KEY ......
                        READ = SPACE
    IF SY-SUBRC EQ 0
      TABLE-READ = 'X'.
      MODIFY TABLE
      ADD 1 TO W_FOUND.
    ELSE
      EXIT.
    ENDIF
    ENDDO.
    IF W_FOUND EQ 1.
    ...record is unique.
    ENDIF.

  • Read Document in FileUtilities  cannot search a file with french character in the file name

    Hi,
    I am trying to search a file with french character in the file name like 'captures écran.doc' in my unix server directory, and Write the file somewhere, say in a list of documents or, write on file system to another directory.
    I am using to Read Document in FileUtilities of Foundation, but it cannot read the file due to french character in its name. Although it can find any other file name without these french characters.
    Tried renaming but that also cannot find the file with french character name.
    Please provide any idea to solve it using LC operation.
    Regards,
    Rohan Raj.

    Hi Thomas,
    Thanks for the post, but I have already found a solution to it a month ago. Sorry for not posting the solution.
    You just have to set the '-Djava.property.file.encoding=ISO8859-1' into JVM argument of your server startup, and bounce the server back to pick the new JVM arg set. And now the service Read Document in FileUtilities of Foundation will read all french characters.
    ISO8859-1refers to "Latin alphabet no. 1," consisting of 191 characters from the Latin script. This character-encoding scheme is used throughout The Americas,Western Europe, Oceania, and much of Africa. It is also commonly used in most standard romanizations of East-Asian languages.
    regards,
    Rohan Raj.

  • Problem with a character in an external table

    I have Unix Sun OS 5.8
    I received 1 file with data. The problem is that this file has a character ' ' in the end file then the charge has an error. The character in the end file is in hexadecimal: 0A, 1A.
    Then I have an External table and I put the the clause LOAD WHEN (COMARC != ' ') but when I edit the external table I see LOAD WHEN (COMARC != '.').
    And the last record with the ' ' character doesn’t filter.
    Note: the character isn't a space ' '. It is the hexadecimal: 0A, 1A
    What I have to put in the LOAD WHEN (COMARC != '??????????') to filter this character?

    I put LOAD WHEN (COMARC != x'0A1A') but I receive the error:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "single-quoted-string": expecting one of: "and, not, or, )"
    KUP-01007: at line 3 column 26
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    If I put:
    LOAD WHEN (COMARC != ' ') for example I don't received any error!
    What happens?
    Thanks!

  • DTP error: No Message: Filter Out New Records with the Same Key

    Hello SDN,
    I have looked up solutions for this problem, but didnt find anything suitable. I am getting this error in multiple places: when i load pure master data into IOs like 0VENDOR, 0PLANT etc. or when I load DSOs like 0FIAP_O03.
    When I checked the load in sdn, one of the solutions was to apply note: 1489178 , but in this case, the user had nothing selected in his 'semantic key' list. Whereas, in my case.. 0PLANT is checked ...eventhough the other fields are disabled. So, I think my DTP is accurate.. as 'plant' is the only key field here.  But it still fails .. and so does 0VENDOR load. Moreover... the DSO load is crucial for our reports in Prod and its failure is a bigger issue for us.
    Has anyone seen this problem? Is there another solution other than the above note?
    Regards.

    Hello Arvind,
    If I select that option, will it delete one record if it finds 2 records with the same semantic key in 1 data packet. Also, will it delete a record if it finds that there is already a record existing in the data target with the same semantic key.
    I think, both of the above scenarios will result in incorrect data. From my understanding, 'Handle Duplicate Keys' is mostly used to filter out master data.. as in some instances.. you might get duplicate entries.
    But, in my case, the same error is happening in the case of data load from 0fi_ap_4 --> 0fiap_o03. What happens is... the overall status of the DTP becomes green.. but when you look at details section, the process stops at this message which is in yellow. Because of this, the DTP status in the PC remains yellow.. and finally turns red.. and the PC turns red.
    From my knowledge, it appears more like a bug. I was hoping to find a SAP NOTE which has some manual instructions that can resolve the issue, since the above NOTE asks for a support pack upgrade.. which would need a whole lotta testing.
    Regards.

  • Counting Unique Records: very urgent

    Hi,
    I have to create a query for which i have to count the unique records appearing for a particular selection. For that i created a CK and in its agregation set Count all values <> 0 For customer. we are having Modality in my rows and CK in column. Now what happens if for 4 different records there is one customer then output appears one against that modality but it should show 4. As such there is no unique field in the cube that i can count. But we have maintined a Count key figure against each record in the cube that has value 1 for each row. But as it is a Key figure i cannot use it in aggregation. Is there any way to solve this situation....
    Please help. Its very urgent..
    Thanks
    Points assured.

    Hello,
      Use Exception Aggregation as Customer. It will work.
    Crearte CKF
            Assign 1 initial value
           Count all properties
          Exception aggretion is Customer.
    I think It should work
    Thanks,
    Kishore
    @KR

  • Find first record starting with most extensive ability

    Hi,
    This question might have been asked before but I don't know how to describe it in the search field.
    There are 3 records with 2 fields (id, name). These records are:
    1,Amsterdam
    2,Amster
    3,Am
    I want to find the record that holds the most possible information:
    searching Amsterdam must return 1; searching Amsterdamned must return 1; searching America must return 3; searching United must return 0 (or null).
    So the logic is to search for the whole string and return the id when found. If not found remove the most right character and search until found or a empty string.
    Since this logic has to be a part of SQL I wonder if there is a smart way (without writing a PL/SQL function) to solve this?
    I'm curious.
    Geert.

    Hi, Geert,
    So you're only interested in strings that start the same way? That is, the fact that 'Amsterdam' and 'United' have the substring 'te' in common doesn't matter, because 'te' comes in the middle of those strings.
    If that's so, you can use LIKE to compare the strings.
    WITH   got_r_num    AS
         SELECT     p.place_name
         ,     a.place_id
         ,     a.place_name     AS a_place_name          -- Not needed, nut may be nice
         ,     RANK () OVER ( PARTITION BY  p.place_name
                               ORDER BY          LENGTH (a.place_name)  DESC
                        )  AS r_num
         FROM          possible_places  p
         LEFT OUTER JOIN      actual_places       a  ON  p.place_name LIKE a.place_name || '%'
    SELECT       place_name
    ,       NVL (place_id, 0)     AS place_id     -- or, if you want NULL, just place_id
    ,       a_place_name                       -- if wanted
    FROM       got_r_num
    WHERE       r_num     = 1
    ORDER BY  place_name
    ;Whenever you have a problem, please post CREATE TABLE and INSERT statments for some sample data, like this:
    CREATE TABLE     actual_places
    (   place_id     NUMBER (6)     PRIMARY KEY
    ,   place_name     VARCHAR2 (20)     
    INSERT INTO actual_places (place_id, place_name) VALUES (1,  'Amsterdam');
    INSERT INTO actual_places (place_id, place_name) VALUES (2,  'Amster');
    INSERT INTO actual_places (place_id, place_name) VALUES (3,  'Am');
    CREATE TABLE     possible_places
    (   place_name     VARCHAR2 (20)     PRIMARY KEY
    INSERT INTO possible_places (place_name) VALUES ('Amsterdam');
    INSERT INTO possible_places (place_name) VALUES ('Amsterdamned');
    INSERT INTO possible_places (place_name) VALUES ('America');
    INSERT INTO possible_places (place_name) VALUES ('United');Also, post the results you want from that data, exactly as you want to see them. The query above produces this output:
    PLACE_NAME             PLACE_ID A_PLACE_NAME
    America                       3 Am
    Amsterdam                     1 Amsterdam
    Amsterdamned                  1 Amsterdam
    United                        0See the forum FAQ {message:id=9360002}

Maybe you are looking for