Replacement of the space with joker

I have a table with names as follows-

() AS T

SELECT THE NAME OF "JOHN M SMITH" DOUBLE

UNION

SELECT "ANDREW SMITH" DOUBLE

UNION

SELECT "A CARREY AND MIKE M N SMITH" DOUBLE)

SELECT * FROM T

My requirement is that if the name is a single character, then attach a joker with it, if it's more than a single space character, and then attach a single space followed by a wildcard character, so the final result should be like this: -.

JOHN M % SMITH

% OF ANDREW SMITH

CARREY-MIKE % M % N % SMITH

probably, it will be done with regular expressions, but don't know how.

Thanks in advance

Hello

Here's one way:

SELECT name

, REGEXP_REPLACE (REPLACE (name, ' % ',' '))

, '((^| ) [[: alpha :]])]] %'

, '\1%'

) AS wild_name

T

;

Output:

NAME WILD_NAME
--------------------------- ------------------------------------
A CARREY AND MIKE M N SMITH CARREY MIKE % M % N % SMITH
ANDREW SMITH ANDREW SMITH %
JOHN M % M % SMITH JOHN SMITH

Here's how it works:

REPLACE replaces all space space generic space.  It's almost what you want: the only problem is that, immediately after a single letter word, you want generic-space instead of space-credits-space.  REGEXP_REPLACE finds all occurrences of SingleLetterWord-the space-credits and modifies them to SingleLetterWord-wildcard.

Tags: Database

Similar Questions

  • Replace the spaces with a sign +.

    Hello

    On of my items, I have a text... I want to replace the spaces with a plus (+) sign... something linke this


    Select
    text_field,
    Function_replace (text_field, "", "+") new_field
    Of
    table_A

    Like this?

    select regexp_replace('Please replace, me','[ ,-]+','+') replaced_txt from dual;
    
    REPLACED_TXT
    -----------------
    Please+replace+me
    
    Elapsed: 00:00:00.00
    

    HTH,
    Prazy

  • How to calculate the mask with joker to ACL

    Dear,

    I know it may seem a question very bacis, but frankly I've searched the net, books & asked many friends and no one could help you.

    I want to create one or two access list to hit the following ip prefix.

    192.168.2.0

    192.168.6.0

    192.168.11.0

    192.168.15.0

    192.168.18.0

    may well want to explain to me in binary computing.

    concerning

    I think your question is asking questions about the means to have a single line in the list ACL correspond to more than one address, so that with one or two lines of ACL you could match to these 5 addresses. The way to start is to understand what these addresses have in common. they all 192.168 in the first two bytes and 0 in the last byte. So the third byte is the place where there is no variation. We must therefore start with the value of the third byte in binary:

    2 is 00000010

    6 is 00000110

    11 is 00001011

    15 is 00001111

    18 is 00010010

    If you examine the binary and see what numbers have many BITS in common that we see that 2 and 6 have in common the 7 of the 8 bits and could be grouped. We see that the 11 and 15 have in common the 7 of the 8 bits and could be combined.

    Then the Group 2 and six that we want a mask which says that bit positions 1, 2, 3, 4, 5, 7 and 8 must match and bit position 6 does not. The mask with 0 to 1, 2, 3, 4, 5, 7 and 8 is 00000100 (4 in decimal). The Group 11 and 15, we also have bits 1, 2, 3, 4, 5, 7 and 8 to match while we would use this mask still 00000100.

    There is not a way to combine 18 very well with the other addresses. So an ACL have 3 statements to match these 5 addresses.

    permit 192.168.2.0 0.0.4.0

    permit 192.168.11.0 0.0.4.0

    Allow 192.168.18.0 0.0.0.0

    HTH

    Rick

  • Advanced search and replace. How to replace the space with carriage return?

    10.9.13.0/24, 10.9.4.2/32, 10.9.4.3/32

    in

    10.9.13.0/24
    10.9.4.2/32
    10.9.4.3/32

    Find replace them ',' with carriage return.

    I still find articles on an advanced search and replace, but I can't seem to locate it.

    OS X El Capitan 10.11.3

    3.6.1 the numbers

    HI Brendan,

    You don't need an advanced find and replace for it.

    In the search box, press, then space.

    In the box replace by, press option-return.

    Then click Find and replace and find until you are finished.

    Kind regards

    Barry

  • problems with the replacement of the trial with the full released version

    So invited a new Member of the team and the members is now showing as active. Downloaded as required but the message of the trial has not disappeared and it does not appear that the fully released version has updated correctly / replaced the trial.

    Are passed through the same thing with another Member of the team and everything worked well.

    What is going on?

    Hi Ewa,

    Please see this document to activate it:

    https://helpx.Adobe.com/creative-cloud/help/sign-in-out-activate-apps.html

    Let us know if that helps.

    Concerning

    Megha Rawat

  • Replacement of the nodes with duplicates

    I can't find out how to write an XQuery query which can essentially 'jump' a replacement when I said to. I don't know who makes no sense, so here's a better explanation.

    I have an XML file that is stored in an Oracle XML DB that looks like this:
    <bookstore>
        <book title="Analytical Chemistry" publish_date="198710">
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Particle Physics" publish_date="199202">
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Applied Biophysics" publish_date="201005">
           <author>...
           <publisher>....
           <etc.>
        </book>
    </bookstore>
    We get the update commands that look like the same thing, with a 'command' attached to add the book to the store or drop:
    <bookstore>
        <book title="Analytical Chemistry" publish_date="199210">
           <order>merge</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Particle Physics" publish_date="199202">
           <order>drop</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Chaos Theory" publish_date="199102">
           <order>merge</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
    </bookstore>
    The rule is should I replace or add a book in the store if I have a book of the same title, and the order is "merge", or drop it if the order is to 'drop '. I have a request XQuery Update function now makes what looks like this:
    declare updating function local:book_merge($old, $book_merge)
    {
         for $orderEntr in $book_merge/book
         let $chgCd := $orderEntr/order
         let $orderTitle := $orderEntr/@title
            let $oldBooks := $old/bookstore
         let $oldBookEntr := $oldBooks/book[@title=$orderTitle]
         return
            if( $chgCd = "drop" and exists($oldBookEntr) )
            then delete node $oldBookEntr
            else if( exists($oldBookEntr) )
            then replace node $oldBookEntr with $orderEntr
            else insert node $orderEntr into $oldBooks
    };
    This works very well for commands like above, but once from time to time, we receive a command like this:
    <bookstore>
       <book title="Analytical Chemistry" publish_date="199210">
           <order>merge</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Analytical Chemistry" publish_date="199210">
           <order>merge</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Particle Physics" publish_date="199202">
           <order>drop</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
        <book title="Chaos Theory" publish_date="199102">
           <order>merge</order>
           <author>...
           <publisher>....
           <etc.>
        </book>
    </bookstore>
    Notice how the first entry is duplicated. In this case, the requirement must only enter the book in the library once. Can someone give me an idea of how I would go about implementing that? I am struggling to understand how to ask the right question, so please forgive me.

    You can add a predicate that will filter the next (or previous) duplicates of a given input:

    where not($orderEntr/following-sibling::book[@title = $orderTitle])
    

    Full test case:

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> create table tmp_xml of xmltype;
    
    Table created.
    
    SQL> insert into tmp_xml values (
      2  xmltype('
      3      
      4         XXX
      5         
      6      
      7      
      8         YYY
      9         
     10      
     11      
     12         ZZZ
     13         
     14      
     15  ')
     16  );
    
    1 row created.
    
    SQL> var orders clob
    SQL> begin
      2
      3   :orders := '
      4      
      5         merge
      6         XXX
      7         123
      8      
      9      
     10         merge
     11         XXX
     12         123
     13      
     14      
     15         drop
     16         YYY
     17         
     18      
     19      
     20         merge
     21         ZZZ-2
     22         
     23      
     24  ';
     25
     26  end;
     27  /
    
    PL/SQL procedure successfully completed.
    
    SQL> set long 5000
    SQL> set pages 100
    SQL>
    SQL> select /*+ no_xml_query_rewrite */
      2         xmlserialize(document
      3           xmlquery(
      4           'copy $d := $old
      5            modify (
      6              for $orderEntr in $orders/bookstore/book
      7              let $chgCd := $orderEntr/order
      8              let $orderTitle := $orderEntr/@title
      9              let $oldBooks := $d/bookstore
     10              let $oldBookEntr := $oldBooks/book[@title = $orderTitle]
     11              where not($orderEntr/following-sibling::book[@title = $orderTitle])
     12              return
     13                 if( $chgCd = "drop" and exists($oldBookEntr) )
     14                   then delete node $oldBookEntr
     15                 else if( exists($oldBookEntr) )
     16                        then replace node $oldBookEntr with $orderEntr
     17                      else insert node $orderEntr into $oldBooks
     18            )
     19            return $d'
     20           passing object_value as "old"
     21                 , xmlparse(document :orders) as "orders"
     22           returning content
     23           )
     24           indent
     25         ) as result
     26  from tmp_xml ;
    
    RESULT
    --------------------------------------------------------------------------------
    
      
        merge
        XXX
        123
      
      
        ZZZ
        
      
      
        merge
        ZZZ-2
        
      
    
    

    It's another question, you probably already have the answer: I guess you must also remove the nodes of the newly merged books?

  • Replacement of the CD with DVD

    I just got a refurbished Dell DVD player yesterday by post to replace my CD for my Dimension 2400 drive. The drive came with no instructions, hardware or software driver. I'm having a problem making my point through the Dell support e-mail system and I hope someone here can help you.

    • The material is a CD-RW/DVD 48 X Combo half-height TSST, 01. I need the driver. What is the name of the driver that I download online? It is quite a few drivers for 48 X DVD on the Dell website, but I don't know who it is.
    • Is the wiring (s) harness that is connected to the same CD player to the DVD? Just he move?

    Thanks for your help if I can move


  • Replacement of the vectors with the best collection

    Hello

    My Netbeans IDE gives me a hint that the vectors (which I use to build custom table of AbstractTableModel models) are outdated.

    What should I replace vectors with, or which collection should I use to build custom table models, any example will be appreciated.

    Thank you

    jverd wrote:
    Use ArrayList instead of vector.

    However, interaction with the legacy GUI APIs is a common place where you have to use Vector. I don't know if AbstractTableModel falls into this category, but you can easily find enough.

    Unlike DefaultTableModel, AbstractTableModel made no assumptions on how the data should be stored. That is why it is useful. It can be used to adapt the other data structures to TableModel without needing to copy data.

  • Its replacement by the view with a physical table... and then perhaps change its name

    Hi all

    Let's say I have a vision of "Select" as a source on the physical layer. Some time later, I decide to replace it with an ordinary table

    (1) simply changing Select for the physical Table won't be enough in table properties?

    (2) what will happen if I decide to go with a different name for this new table? (I guess that the administration tool would pick up the change and spread throughout of the MDB and presentation - but I try just to make sure)

    Well either you keep the fully qualified name of the object (i.e. change just where it points to the bottom) - in which case there is no need even to touch whatever it is above the physical layer - or otherwise you put the new table/view in place and then use the Admin Utility tool "replace column or logical Table Source Table" for let the wizard remapping for you.

    See you soon,.
    C.

  • Replacement of the other with Microsoft Essentials security programs

    I need to be convinced that the removal of my Norton internet security and its replacement by Microsoft Essentials are a good idea. How do they compare? Make ME all that makes Norton? Help, please.

    Why do you "need to be convinced? I don't consider my work to convince them that nothing, but I don't mind give you my opinion. Most of the technicians that I know and I did not recommend Norton for many years. The last good version was 2003 Norton Antvirus and it was 7 years ago. IMO the only security solution worse than Norton's McAfee. Bloated, invasive and ineffective. I recommend NOD32 (commercial) or Avast, Avira or MS Security Essentials if you want something for free instead. MS - MVP - Elephant Boy computers - don't panic!

  • Remove the left and right spaces with calculation

    I read in this forum that I can create a SQL expression calculation after 'Send' to remove the spaces to the left. I put in the source: ltrim(:P209_DESCRIPTION), but it did not work. You have another idea to achieve this? Thank you.

    Let us first find what you really use the following to replace all tabs with ' ~' and all the spaces with "%". This will give us a clearer picture of the characters that we have

    Select translate ('asd fd, chr (9) |) Chr (32),'~ %') of the double

    Then, we can use

    Select ltrim (: P209_DESCRIPTION, chr (9) |) Chr (32)) of the double

    for trim tabs and spaces

    Kind regards

    Vishal

    Oracle APEX 4.2 reports | Packt Publishing

    Vishal blog

    Please mark the reply as useful/correct if it solves your problem

  • When generating layers it replaces spaces with underscores

    Hi all

    I'm working currently with RH8 and when I am saving projects and give the name, let's say "my file.chm" it replaces the space with an underscore, and the name became "my_file.chm." Is it possible to do something about it?

    Thank you

    I think what I said means that you can't generate with spaces.

    Bug? He did this for several versions and I think it's important if you're creating merged CHM Help.

    Submit a request for a bug or a feature change request according to your point of view.

    Please follow this link.

    http://www.Adobe.com/cfusion/mmForm/index.cfm?name=wishform&product=38

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Adobe has replaced all of the icons with the Adobe icon when I try to open programs.

    How I would fix a problem where adobe has replaced all the icons with an adobe icon and when I open the adobe programs is where I must say that it can't open the program?

    Always, always, start by telling us what operating system you use to describe your problem.

    Use it for Vista...

    http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html

    Scroll down to exe - executable application files.
    Click on the exe

    Follow the instructions in #1 à #7 at the top.

    Scroll to lnk - shortcut link (LNK) files.
    Click on lnk

    Follow the instructions in #1 à #7 at the top.

    For Windows 7, use this:

    http://www.SevenForums.com/tutorials/19449-default-file-type-associations-restore.html

    Scroll down to exe - executable application files.
    Click on the exe

    Follow the instructions from #1 to #6 in the upper part.

    Scroll to lnk - shortcut link (LNK) files.
    Click on lnk

    Follow the instructions from #1 to #6 in the upper part.

  • How to fill the space between the brush strokes, like you can with a direct trace of paint?

    Hello

    I'm currently under OS X El Captain on my Mac, v. 10.11.1. I use the version of Illustrator 2015.

    I imported a sketch and drawn on a calligraphic brush. (I've created a new for the effects of pulling on my Tablet pressure sensitivity). I assumed that I would be able to use live paint tool to fill in the spaces with the color as you can with a path created from the pen tool. I do not speak only to fill a closed shape, but when the incomplete paths touch. Except when I'll make the paint option, it is up to my strokes applied to regular paths - the pen tool. I used the brush to get the effects, so I really want that stay the same and not be uniform in the thickness of line.

    Basically, is it possible that I can use paint dynamic to fill the white spaces between the lines created with a brush, while keeping the effects of this brush? If I can't use the live paint is there another way I can fill in these spaces as I'm using live paint?

    Thank you very much!

    You will need to develop stories, or duplicate your layer, expand that, make your form of direct painting and delete everything on your new layer, but your new form.

  • ADF in the configured with SSO WebCenter spaces

    Hi experts,

    I configured SSO with soa/Webcenter/ucm 11.1.1.6.0 using OAM/OID.

    Now, I want to use my adf application in WCSpaces and wants to also apply to the standards body which is already there in the spaces, with my adf application which will be displayed in WCSpaces.

    How can I achieve this requirement?

    could you please any suggestions on this. I can't able to go further.


    Thank you and best regards,
    S.Shashidhar goud.

    1006534 wrote:
    Now, I want to use my adf application in WCSpaces and wants to also apply to the standards body which is already there in the spaces, with my adf application which will be displayed in WCSpaces.

    What do you mean by "use my adf application in WCSpaces?

    You add ADF Taskflows starting from a shared library directly in the pages of the spaces? If so, then why would apply you SSO to the application of the ADF?

    or

    You deploy the ADF application as a portlet via WSRP producer? If so, read the following sections http://docs.oracle.com/cd/E28389_01/webcenter.1111/e10148/jpsdg_security.htm#CHDHGIFF and http://docs.oracle.com/cd/E12839_01/webcenter.1111/e12405/wcadm_security.htm#CHDHGIFF. Make sure you read the surrounding literature in these pages to understand the concepts.

    Alternatively, if you really want to enable SSO for ADF - http://docs.oracle.com/cd/E17904_01/doc.1111/e15478/opssadf.htm application

    Edited by: Jean-Philippe Guillaume on May 20, 2013 16:33

Maybe you are looking for

  • Apple Watch display time + 1 hour

    Yesterday when upgrade SO 2.2.2 Cairo time displayed on the watch do not match the iPhone (one more hour). I tried to restart, UN-pair & pair the same a time difference between iPhone & watch Thank you

  • Saying of pop-up window I have a virus and call immediately

    I was reading my email and a message pop up came in saying I have a virus and immediately call 1-844-307-5972.  It's for real?

  • Network drivers for Compaq 6720 s

    Hi all. I tried similar topics before posting, finding nothing; so I apologize if I was wrong and a similar thread already exists. I formatted my Compaq 6720 s, re-installation of Windows Vista (the same system before formatting). After that, I notic

  • HELP: I can't support from Dell

    I bought a laptop computer to the top-of-the-line Dell M6800 used by Amazon in late December 2015 and find that the Service Dell number was not registered. After many phone calls long at Dell, I tells me that I can't buy an extended warranty so I can

  • Windows 7 not genuine after the restoration of backup_activation error 0x80070005

    After a virus attack, I reformatted the drive and brought the whole system from a backup external drive (my drive C by BounceBack Ultimate clone). I started from the external drive, then restored, all on the internal drive. It was restored, but some