Replace several abbreviations in a string

Hello

I have no solution to replace more than one abbreviation in a string at a time.

I have a table has with a "name" attribute, which contains some abbreviations e.g. 'article no. s. p.'.
I have a table with abbreviations b with the columns 'abbreviation' and 'replace_string' e. g.
don't. | number
s. | section
p. | page

Now, I want to replace all abbreviations in 'name' with the good replace_string e. g.
"article no. p. s."-> "page section number section.

Can someone give me a clue how to proceed?

Kind regards
Detlef

You must set these columns as measures:

SCOTT@soti_10> desc names
 Name
 -------------------------------------------------------------------------------
 NAME
 ID
 MONTH                                                                                                          

SCOTT@soti_10> select * from names;

NAME                                                                 ID MONTH
------------------------------------------------------------ ---------- ----------
qwe DW ff DB hhh                                                      1 22.01.2009
qwe EEE ff DB hhh                                                    33 01.01.2008

SCOTT@soti_10> with Iterations as (
  2    select rn, n, id, month
  3    from names n, abbreviations a
  4    where instr(n.name, a.abbreviation) > 0
  5    model
  6      partition by (n.name)
  7      dimension by (row_number() over (partition by n.name order by n.name) rn)
  8      measures (n.name n, a.abbreviation, a.replace_string,
  9                n.id id, n.month month)
 10      rules (
 11        n[ANY] ORDER BY rn DESC = REPLACE(
 12                                    PRESENTV(n[cv() + 1], n[cv() + 1], n[cv()]),
 13                                    abbreviation[cv()],
 14                                    replace_string[cv()]
 15                                  )
 16      )
 17  )
 18  select n, id, month
 19  from iterations
 20  where rn = 1
 21  ;

N                                                                    ID MONTH
------------------------------------------------------------ ---------- ----------
qwe Data Warehouse ff Database hhh                                    1 22.01.2009
qwe KKKK ff Database hhh                                             33 01.01.2008

Kind regards
Dima

Tags: Database

Similar Questions

  • Replace an abbreviation in the non-consecutive fields and keep the rest of the text

    I need to replace an abbreviation that is no longer used in the office with a new text. I need to keep the rest of the information in the field. Length fields vary, and the new text is longer than the former. I use Oracle 8i. This is what I have for now but does not work.

    UPDATE OF ICA
    the value of LIC. DETAL = substr ('ALPHA BET' |) DETAL, 4, length (detal)-3);
    where UPPER (substr (DETAL, 1, 3)) = 'AB-';

    Hello

    Whenever you have a problem, please post a small example of data (CREATE TABLE and INSERT statements) and also publish outcomes from these data.

    user8647598 wrote:
    I tried this:

    update of ICA
    the value of LIC. DETAL = replace (lic.detal, '- HO', ' HOME OCC' |) Trim (detal));

    but I got an error saying that it was too big.

    ERROR on line 1:
    ORA-01401: inserted value too large for column

    Published by: user8647598 on January 13, 2011 07:32

    It is one of thopse error messages that acually means what he says. After replacing the text, the chain grew more time, and it will fit is no longer in the column.

    Are you sure you are doing what you want?

    REPLACE ( lic.detail
         , 'HO-'
         , 'HOME OCC' || TRIM (lic.detal)
         )
    

    Means "where detal contains the 3 - character substring"HO -"replace it with the 8 'HOME OCC" string * followed by the original text of the detal.»
    So if detal
    {code}
    HO-1 XYZ
    {code}
    then REPLACE them back:
    {code}
    XYZ OCCXYZ HO-1 HOUSE
    {code}

    That is what you want, or do you want something like that?
    {code}
    REPLACE (lic.detail
    "HO -"
    , 'HOME OCC-' or maybe 'HOME OCC", with a space at the end
    )
    {code}
    You can use the expression above as an argument for the TOPPING.

    When you want to write an UPDATE statement, you can test it in the first place, like this:
    {code}
    SELECT detal
    TRIM (REPLACE (detal
    "HO -"
    , 'HOME OCC '.
    )
    )
    ICA
    WHERE detal LIKE ('% HO %')
    AND ROWNUM<=>
    ;
    {code}

  • DRM function to replace the comma in a string

    Hello

    I'm new to the DRM. I have a requirement to replace insérent in a string with the semicolon (-). Is it all built in function to achieve.

    For example -.

    input string is s1, s2, s3

    Output string should be s1, s2, s3.

    I tried to use the ReplaceStr function. This works well for replacing any other, but for the comma, it does not work.

    Appreciate your help.

    It works for me with the formula below to do a global search of replacement that uses properties to store the string the comma (s) must withdraw and a global property to contain the decimal point itself:

    ReplaceStr (PropValue (Custom.String), (Custom.Comma) PropValue,, T)

    You've been do not add commas directly in the formula contained in the definition of the property you have? That would by way too many parameters in the function when the formula is analyzed for you would end up with something like ' DRM-25620: number of parameters for the function "ReplaceStr" invalid. " 4 expected, found 5. »

    Concerning

    Craig

  • Find and replace all occurrences of a string within the current paragraph.

    I did so much work, and it's my last method to implement.

    I want to get the current active doc the current paragraph and replace all occurrences of a string inside this paragraph with another string.

    For example, say I have the following paragraph in a document:

    «This is a sentence that.» This is another sentence. It is also another sentence. The sentence ".

    If the user opens the document containing the paragraph and goes to this paragraph by clicking in any place in there, I want to replace e.g.g "another punishment" with "phrase.

    But only in the current active paragraph in the active document.

    I found a code with F_ApiFind and F_ApiGetTextRange to get the current text selection, but I can't think of a way to do it.

    Post edited by: Efstathios Chatzikyriakidis

    Problem solved people. Thank you.

  • REGEXP replace several Chr (10) by simple Chr (10)

    Hello

    I can replace multiple spaces with a space
    SELECT REGEXP_REPLACE('#  #','( )* ',' ') x FROM dual;
    X
    ---
    # #
    But how can I replace several CR?
    SELECT REGEXP_REPLACE('#'||CHR(10)||CHR(10)||'#','('||CHR(10)||')* ',CHR(10)) x FROM dual;
    does not work. How should I write the model?

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    Concerning
    Marcus

    example:

    with t as (
              select '#'||CHR(10)||CHR(10)||'#' str from dual union all
              select rpad('#',10,chr(10))||'#' from dual
              )
    SELECT str
          ,REGEXP_REPLACE(
                            str
                           ,CHR(10)||'+'
                           ,CHR(10)
                           ) x
    FROM t
    

    Kind regards
    Malakshinov Sayan

  • Replacement of several commas in a string

    Hello

    Hello

    I have a string similar to the following.
    1, Accenture, EDS, Sun, training partner
    2, United States
    3.Canada,

    I want to have the chain as follows as a result of the query.
    1 Accenture, EDS, Sun, workout partner
    2. the United States
    3 Canada

    Help is appreciated.

    _PS

    Here is the script to create the table and insert the script.
    create table time
    (val varchar2 (1000));

    insert into time values (' ', Accenture, ed., Sun, workout partner ");
    insert into time values ('United States,');
    insert into time values ("Canada");
    insert into time values (', Canada ');
    commit;

    Please provide your db version to see if the solutions of regexp_ apply too ;)

  • Replace several tags in the xml file

    Hello

    I have a donnees_xml in the test_xml_table of the table in the format

    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < CLASS > XII has < / CLASS >
    KATE < TEACHER > < / TEACHER >
    < STUDENT_STRENGTH > 30 < / STUDENT_STRENGTH >
    < 50 OFFICES > < / DESKS >
    < / ROW >
    < ROW >
    B XII < CLASS > < / CLASS >
    < STUDENT_STRENGTH > 40 < / STUDENT_STRENGTH >
    < NUMBER OF GIRLS 15 > < / NUMBER OF GIRLS >
    < NUMBER_OF_BOYS > 25 < / NUMBER_OF_BOYS >
    < / ROW >
    < / LINES >

    Need to replace some tags with a new tag (< TEACHER > with < CLASS_TEACHER > and < CLASS > with < CLASS_AND_DIVISION >), the method used is currently
      select regexp_replace(regexp_replace(xml_data,'TEACHER>','CLASS_TEACHER>'),'CLASS>','CLASS_AND_DIVISION>')from test_xml_table ;
    version of database
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Solaris: 11.2.0.2.0 - Production Version
    NLSRTL Version 11.2.0.2.0 - Production


    Problems I'm here, it's that this returns me a string that I have to convert to XML again and having to use
    the regexp_replace function0 several times. Is there a function XML to aid that can be used to do this, if there is
    no other option like this, is there any function to replace alternative can replace all the necessary tags at once?

    Thanks in advance

    Edited by: M. 13 on October 26, 2012 01:40

    One possible way using XSLT:

    SQL> select xmltransform(xml_data
      2         , xmlparse(document
      3  '
      4    
      5      
      6        
      7      
      8    
      9    
     10      
     11        
     12      
     13    
     14    
     15      
     16        
     17      
     18    
     19  ')
     20  ) as result
     21  from test_xml_table
     22  ;
    
    RESULT
    --------------------------------------------------------------------------------
    
    
     
       XII A 
       KATE 
       30 
       50 
     
     
      XII B
       40 
       15 
       25 
     
    
     
    
  • How REGEXP_REPLACE used to replace the part of the string?

    Hello

    How can I replace the portion of string as follows, I want to replace the space as by ' - '.

    SELECT
    REGEXP_REPLACE (superior ("' Laura bought stuff from 2000 USD on 12 September 2012 to KL and kl left on September 20, 2012"),)
    ' [0-9] {1,2} [^ 0-9](JAN|) FEB | MAR | APR | JUN | JUL | AUG | MS | OCT | NOV | DEC) [^ 0-9] [0-9] {4}',
    (','-') "REGEXP_REPLACE.
    FROM DUAL;

    the output will be like this

    Laura bought of the stuff of 2000 USD on 12-Sep-2012 of KL and kl left on 20-Sep-2012

    concerning

    Something like that?

    SELECT
    REGEXP_REPLACE('Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012',
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})',
    '\1-\2-\3',1,0,'i') "REGEXP_REPLACE"
    FROM DUAL;
    

    Explanation:

    You group the parts of the date de-construct with (additional).
    You can use expressions, backreference \1 \2 \3 and add '-' between \1-\2-\3 signs.

    You should not user upper ('...') in the first parameter. If you cannot recover the original state of the letters.
    If you want to case-insensitive matching you should use 'I' in the last parameter of regexp_replace.

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions130.htm

    Published by: hm on 25.09.2012 00:38

  • Replace the text in the string

    I would like to know how I could continue to write something that would allow a string of variable length to replace in a longer string, subject 'inner chain' is bounded by something.

    In other words, assume the string is something like
    Tiger Woods +15/09/2010+
    where the character was more used as a delimiter. I would like to extract this possibility to leave Tiger Woods. I can't do a simple substr, because the string can be
    +15/09/2010+ Tiger Woods
    . It could even be
    Tiger +15/09/2010+ Woods
    . Or it could be
    Tiger Woods +September 2010+
    . In all cases, the correct return is plain Tiger Woods.

    Point is, I want to remove everything between the two more brands wherever they appear and return what is left.

    I'm guessing that maybe that's a job for regular expressions, but I dread, so yes, because I'm not very good for them!

    Any help appreciated, so. :-)

    and to be complete - as says hoek - regular expressions can do it well.

    SQL> with t as (
      2      select 'Tiger Woods +15/09/2010+' str from dual union
      3      select '+15/09/2010+ Tiger Woods'  from dual union
      4      select 'Tiger +15/09/2010+ Woods' from dual union
      5      select 'Tiger Woods +September 2010+' from dual
      6      )
      7  select regexp_replace(str,'\+.+\+')
      8    from t;
    
    REGEXP_REPLACE(STR,'\+.+\+')
    --------------------------------
     Tiger Woods
    Tiger  Woods
    Tiger Woods
    Tiger Woods
    
    4 rows selected.
    

    Although you will notice let outdoor spaces, you can do another to delete extra spaces.

  • How to replace each--------with / in a string

    I have a link to a local file and befor flash sends out it converts the web path.

    var link: string = c:\\somewher\file.jpg

    TO

    www.somesite.com/Somewhere/file.jpg

    How to replace the------with / in the link?

    :

    var pat: RegExp = / \ / g;
    Link.Replace (pat, "/");

  • Replace and calculate a formula string...

    Hi guys,.

    I have a string of the formula to evaluate and calculate... for example...
    ex1 :- 1.[R_H]<=2.[R_R]
    
    ex2 :- 1.[R_FT]=2.[R_FT]
    
    Here I need to replace the variables such as 1.[R_FT] with numbers...
    
    numbers are defined in two tables... (values can have 1. or 2. only)
    
    Table_1 = for numbers starting with 1.
    
    Constant  Value
    R_H         2
    R_R         3
    R_FT        1
    
    Table_2 = for numbers starting with 2.
    
    Constant  Value
    R_H         1
    R_R         1
    R_FT        4
    
    So now I neet the program to evaluate the ex1 or ex2 and return me a TRUE or FALSE...
    
    
    1.[R_H]<=2.[R_R] ---> 2<=1 = should return TRUE 
    
    1.[R_FT]=2.[R_FT] ----> 1=4 = should return FALSE
    Thank you...

    Well, my request will not handle this.

    It would be best to describe all possible cases and all possible operators that can be used too.
    There are always 2 tables (table_1 and table_2), or there could be more?

    [edit]
    Suppose the following versions:
    -There will be more than 2 tables of constant value
    -number constant (as long as the decimal separator. (dot)
    -the names of the constants will be formed only of uppercase letters and _ (underscores stroke)
    -operators are made of symbols thos 3: equal, greaterThan, showed (and their combinations)
    -etc...

    with
    --- sample tables
    expr as (
    select 1 expid, '1.[R_H]<=2.[R_R]' expr from dual union all
    select 2, '1.[R_FT]=>2.[R_FT]' from dual union all
    select 3, '20>=2.[R_H]' from dual union all
    select 4, '13.4325 = 11' from dual
    )
    , t1 as (
    select 'R_H' cons, 2 val from dual union all
    select 'R_R', 3 from dual union all
    select 'R_FT', 1 from dual
    )
    , t2 as (
    select 'R_H' cons, 1 val from dual union all
    select 'R_R', 1 from dual union all
    select 'R_FT', 4 from dual
    )
    , tn as (
    select 1 t, t.* from t1 t union all
    select 2 t, t.* from t2 t
    )
    -- end of samples
    select expid, expr,
    nvl((select to_char(val) from tn where tn.t=substr(ml,1,1) and tn.cons=regexp_substr(ml,'[_A-Z]+')),ml)
    ||op
    ||nvl((select to_char(val) from tn where tn.t=substr(mr,1,1) and tn.cons=regexp_substr(mr,'[_A-Z]+')),mr) nexpr
    from (
    select expid, expr,
    regexp_replace(expr,'^([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)\s*([><=]{1,2})\s*([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)$','\1') ml,
    regexp_replace(expr,'^([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)\s*([><=]{1,2})\s*([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)$','\2') op,
    regexp_replace(expr,'^([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)\s*([><=]{1,2})\s*([12]\.\[[_A-Z]+\]|[0-9]+?\.?[0-9]*)$','\3') mr
    from expr
    )
    /
    

    Works for me on 11 GR 2:

    Scott@my11g SQL>@Q
    
         EXPID EXPR               NEXPR
    ---------- ------------------ ----------
             1 1.[R_H]<=2.[R_R]   2<=1
             2 1.[R_FT]=>2.[R_FT] 1=>4
             3 20>=2.[R_H]        20>=1
             4 13.4325 = 11       13.4325=11
    
  • Replace special characters in a string

    Let's say that someone copies the list as follows and the glue in a Javascript dialog box:

    302304

    305678

    245675

    How do I manipulate the string so that it reads:

    302304 305678 245675

    In other words, how to replace manual line breaks in a string with spaces?

    Thank you!

    It's the cleanest method that you are looking for:

    /[\n\r]/
    

    In this case, even a simple \s would work, but it's maybe not what the OP...

    Substances

  • Do find / replaces several at the same time?

    In PhotoShop, there is a practical tool, called 'ACTIONS' that allows you to automate several tasks. And in Microsoft Word, it is relatively easy to record a Macro that will do the same. Is there something similar in InDesign? Whenever I work with text, I do the following so often I want to automate:

    1. replace all quotation marks simple quotes

    2. place all the quotation marks double quotes

    3. change the entire multiple single space

    4 remove the trailing white space

    Right now, I open the FIND/REPLACE box and run all 4 tasks manually.

    Thank you

    There is a findchangebylist script that will do this for you.

    Bob

  • replace all the ',' inside the string

    I have a long string and pl/SQL, I want to replace all the ',' with ', null, '.

    Can I use replace function as:
    prepare_insert: = replace (prepare_insert, ', ', ', null,');

    but it will not replace Prime ',' not all. How can I replace all?

    It works fine in your case also.

    ',' replace will replace the first ',' to ', null, ', and then he would find the second ',' and to replace it ', null,'.

    select replace(',,,,',',,',',null,') from dual;
    
    ,null,,null,
    

    There is no combination of 2nd & 3rd "," for the replacement.
    but only one, 1st & 2nd, 3rd & 4th. That's all.

    Doing twice replace() will give you what you want:

    select replace(replace(',,,,',',,',',null,') ,',,',',null,') from dual;
    
    ,null,null,null,
    

    Published by: PhoenixBai on August 24, 2010 23:43

  • Replace several subsets of table

    I have a 1 d table that I want to manipulate.

    I want to replace the n-th element to the nth + j with zero element... and repeat this replacement to an integer multiple of n.

    So, for example if n = 5 and j = 2, beginning with an array of 1s and then manipulation table might look like:

    1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1, etc.

    So n = 5 to n = 7, n = 12, n = 15 n = 17 n = 10... etc is equal to zero.

    I if the value of n and j with controls on the front panel.

    I'm coming from a background of Matlab and slowly get into Labview.

    Appreciate the help!

    Joe_Le wrote:

    I'd appreciate really indications at this point, I solution mathscript work and would really like to know the 'labview solution '.

    As you will see, a LabVIEW solution will be much simpler. The most important part would be to learn more about the shift registers. This is one of the basic tools.

    Here's a very rough draft of 2 minutes. Modify if needed. Of course replace you your real table and allows to get the size of the array size. See how far you get.

Maybe you are looking for

  • How to erase hitory a story much in the coomputer?

    I just can't clear the history on my mac pro. I have try several times, nothing works. I don't want to continue in computer history. So please tell me what I can do, otherwise I will not hesitate to use Firefox. Thank you!

  • Start the Portege 2000 SD

    Anyone know if it is possible start of SD in a Portege 2000.I don't have a DVD USB, I don't have a USB floppy, when I want to reinstall OS I take 1'8 "hard drive and my adapter for the IDE and reinstall the SO in another computer, but it's not comfor

  • How will I know if my airport extreme in bridge mode?

    How will I know if my airport extreme in bridge mode?  My internet provider suggested I check into that and disable the bridge mode for a problem I've had with wireless help all my IP addresses.

  • Hard drive recovery problem

    my hard drive of the computer hp dv6 laptop failed on me. so I ordered a new hard drive with the HP recovery disk because I only did one on mine. I installed the new hard drive along and starts the recovery disc and when everything is done, I get a m

  • CD drive problems.

    Recently, I decided to buy Rise Of Nations Gold Edition. When I put the disc in the CD player it leader for a minute then stopped. I waited a few minutes and then checked my computer to see if he just does not have the automatic start of the disc. To