Need help with a simple regular expression replacement

Hello everyone,

He comes to the table that I have to work with.
CREATE TABLE "TBL_ACCOMMODATION" ("ACCOMMODATION_ID" NUMBER, "HOTEL_NAME" VARCHAR2(100), "ADDRESS" VARCHAR2(200), "LOCATION" VARCHAR2(100), "PHONE" VARCHAR2(50), "EMAIL_ADDRESS" VARCHAR2(60), "CONTACT_PERSON" VARCHAR2(60), "STATUS" CHAR(1), "CREATED_BY" VARCHAR2(10), "CREATED_DATE" DATE, "MODIFIED_BY" VARCHAR2(10), "MODIFIED_DATE" DATE, "MOBILE" VARCHAR2(50))
REM INSERTING into TBL_ACCOMMODATION
Insert into TBL_ACCOMMODATION (ACCOMMODATION_ID,HOTEL_NAME,ADDRESS,LOCATION,PHONE,EMAIL_ADDRESS,CONTACT_PERSON,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MOBILE) values (147,'Testt','Auckalnd','Henderson','565756776','[email protected]','Jasmine','A',null,null,'JEEJJ',to_date('23/10/12','DD/MM/RR'),null);
Insert into TBL_ACCOMMODATION (ACCOMMODATION_ID,HOTEL_NAME,ADDRESS,LOCATION,PHONE,EMAIL_ADDRESS,CONTACT_PERSON,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MOBILE) values (129,'Kirby Hotel','25A Aitken Street
Wellington','Wellington','04 918 8513','[email protected]','Deahdoow Maharg','A',null,null,'LEAN',to_date('14/02/13','DD/MM/RR'),'027 356 4333');
Insert into TBL_ACCOMMODATION (ACCOMMODATION_ID,HOTEL_NAME,ADDRESS,LOCATION,PHONE,EMAIL_ADDRESS,CONTACT_PERSON,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MOBILE) values (167,'Avenue ee','10 Wellington Street
Wellington','Wellington','4444444','[email protected]','James','A',null,null,'LEAN',to_date('21/02/13','DD/MM/RR'),null);
Insert into TBL_ACCOMMODATION (ACCOMMODATION_ID,HOTEL_NAME,ADDRESS,LOCATION,PHONE,EMAIL_ADDRESS,CONTACT_PERSON,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MOBILE) values (185,'Quadrant Hotel','10 Waterloo Quadrant,
 Auckland','Auckland','9555555','[email protected]','Quentin QQ','A',null,null,'LEAN',to_date('04/03/13','DD/MM/RR'),null);
My select statement is
SELECT acc.hotel_name || '(' || replace(replace(acc.address,chr(13),', '),',,',',') || ')'
FROM TBL_ACCOMMODATION acc
  inner join ijs_seminar s ON acc.accommodation_id = s.accommodation_id 
where s.seminar_id = :P27_SEMINAR_ID
I have to use the function replace twice. One is to replace the Chr (13) a comma is second band a comma where there are two commas.

I don't know much about regular expressions.
If someone can show me a better way to handle this using the regular expression rather than a heavy means above.

Thanks in advance
Ann

Hi, Ann.

Ann586341 wrote:
Hello everyone,

He comes to the table that I have to work with.

CREATE TABLE "TBL_ACCOMMODATION" ("ACCOMMODATION_ID" NUMBER, "HOTEL_NAME" VARCHAR2(100), "ADDRESS" VARCHAR2(200), "LOCATION" VARCHAR2(100), "PHONE" VARCHAR2(50), "EMAIL_ADDRESS" VARCHAR2(60), "CONTACT_PERSON" VARCHAR2(60), "STATUS" CHAR(1), "CREATED_BY" VARCHAR2(10), "CREATED_DATE" DATE, "MODIFIED_BY" VARCHAR2(10), "MODIFIED_DATE" DATE, "MOBILE" VARCHAR2(50))
REM INSERTING into TBL_ACCOMMODATION
Insert into TBL_ACCOMMODATION (ACCOMMODATION_ID,HOTEL_NAME,ADDRESS,LOCATION,PHONE,EMAIL_ADDRESS,CONTACT_PERSON,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MOBILE) values (147,'Testt','Auckalnd','Henderson','565756776','[email protected]','Jasmine','A',null,null,'JEEJJ',to_date('23/10/12','DD/MM/RR'),null);
...

Thanks for posting the sample data. You post the results, but the validation of the existing query which I suppose, produced good results. I can't run this query, because it requires the ijs_seminar table and a connection variable that also has no post, but I can just comment on the join and the WHERE clause.

Is this really the best set of sample data for this question? This problem involves Chr (13) and repeated commas, but I don't see any s CHR (13) or repeated commas in the sample data. In addition, it seems that there are a lot of columns that play no role in this issue and just to make things difficult to read.

My select statement is

SELECT acc.hotel_name || '(' || replace(replace(acc.address,chr(13),', '),',,',',') || ')'
FROM TBL_ACCOMMODATION acc
inner join ijs_seminar s ON acc.accommodation_id = s.accommodation_id
where s.seminar_id = :P27_SEMINAR_ID

I have to use the function replace twice. We need to replace the Chr (13) by a comma,.

As posted, inside REPLACE replaces Chr (13) with a comma and a space which could be important if you then pick up consecutive commas.

second is the band a comma where there are two commas.

I don't know much about regular expressions.
If someone can show me a better way to handle this using the regular expression rather than a heavy means above.

Assuming you want to replace Chr (13) with just a comma, then an equivalent would be:

SELECT    acc.hotel_name || '('
                  || REGEXP_REPLACE ( acc.address
                                      , '[,' || CHR (13) || ']{1,2}'
                            , ','
                            )
                || ')'            AS h
FROM        tbl_accommodation acc
INNER JOIN  ijs_seminar       s   ON   acc.accommodation_id = s.accommodation_id
WHERE s.seminar_id = :P27_SEMINAR_ID
;

In the argument to REGEXP_REPLACE 2nd

[xy]{1,2}

medium 1 to 2 characters of set of x and y. This could be
x or
there or it could be 2 characters
XY or the other way
YX or it could be the same characters 2
XX or
YY

REGEXP_REPLACE is slower that REPLACE. Even if your original expression is longer, it may be more effective. (Performance may be not a problem in this case.)

Tags: Database

Similar Questions

  • Need help with a simple basketball game.

    Hi im new here and I need help with what makes this simple basketball game.

    Im trying to recreate this this video game. I'm not sure if it uses as2 or as3

    If someone could help me make a game like this or point me to a link on how to do it would be greatly appreciated.

    AS2 is used in the video.  If you have other issues, please post in the forum AS1/AS2.

  • New to Adobe Flash, need help with a simple coding

    I'm new using Adobe Flash and need help. That means class static type?

    static text is entered in the authoring environment.  This is the text that will not change (that's why static) during execution.

    This is in contrast to the dynamic text, which is text that is assigned using actionscript and can change at any time actionscript runs.

  • Need help with the OSB Assign and replace the

    I have a proxy service that receives the SOAP message:

    " < = xmlns:soapenv soapenv:Envelope ' http://schemas.xmlsoap.org/SOAP/envelope/ "xmlns:SOAP - ENC =" " http://schemas.xmlsoap.org/SOAP/encoding/ "container =" " http://www.w3.org/1999/XMLSchema ">

    " < = xmlns:soapenv soapenv:Header ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

    < / soapenv:Header >

    < soapenv:Body >

    " < pidx:OrderChange pidx:transactionPurposeIndicator = 'Replace' xmlns:pidx = ' http://www.API.org/pidXML "xmlns =" http://www.API.org/pidXML "" xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance "xsi:schemaLocation="C:\shareIt\OrderChange_1-2.xsd" > ""

    ...

    < / pidx:OrderChange >

    " < = Xmlns:ocp DeliveryInformation ' http://www.digitaloilfield.com/OCP ">

    ...

    < / DeliveryInformation >

    < / soapenv:Body >

    < / soapenv:Envelope >

    I need to take the OrderChange element and place it in a SOAP body and the DeliveryInformation element and place it in the SOAP of the same SOAP message header.

    The SOAP message is then sent to a business service that makes an HTTP POST of the SOAP XML.

    I created the service of the company and he sent some data test SOAP and it works very well, but cannot create a bridge between the Proxy and the Business Service.

    In the stream of messages of Proxy I tried to do an assignment in a routing. I tried to do the following:

    1. an XQuery query transform to generate the XML SOAP just described

    2. not the entitlement where the "Expression" is the transformation and the Variable is a variable based on a schema for SOAP.

    I can see that the company is trying to be invoked, but the SOAP data does not have to be formatted or passed.

    It is the right approach or is their a better way of

    1. create the SOAP wrapped XML

    2. call the Business Service.

    Any suggestions are appreciated. I can provide more detail if necessary.

    Kind regards.

    Thank you Vlad...

    I think I'm getting in that direction now. Just do some debugging.

    Appreciate the input. I will update with final results.

    Again, your help is greatly appreciated.

    Kind regards.

  • Need help with the Simple Question of coding (substring or charAt())

    Hello

    I have what I believe to be a simple matter of coding I was hoping that someone could help answer. I know how to do a decent amount of things but I'm pretty new to Livecycle and trying to change one of our PDF files so that if a certain field has a number starting with number 6 a certain button will become visible. I already have a set of code which is to control the visibility of this button, but I wanted to add this clause. Can someone help me to do this?

    Here are the existing code:

    If ((QuestionsPage2.COIQuestions.COIYN.rawValue == "1" & &))

    QuestionsPage2.EmailButtons.NSFCheck.rawValue == '1') & &

    (QuestionsPage2.ManagerSignature.ManagerDate.rawValue! = null & &)

    QuestionsPage2.ManagerSignature.ManagerCheckBox.rawValue! = null & &

    QuestionsPage2.ManagerSignature.ManagerSignature.rawValue! (= null))

    {

    QuestionsPage2.PasswordSection.RiskPassword.presence = "visible";

    QuestionsPage2.PasswordSection.PurchUseOnly.presence = "visible";

    QuestionsPage2.PasswordSection.HRPassword.presence = "visible";

    QuestionsPage2.EmailButtons.EmailContractsAndRisk.presence = "visible";

    }

    I would like to add at the top to look at the specific area of the first character to see if it is a 6 or not. Here's what I tried to do, but it did not work.

    If ((QuestionsPage2.COIQuestions.COIYN.rawValue == "1" & &))

    QuestionsPage2.EmailButtons.NSFCheck.rawValue == '1' & &

    ContractInfo.AgreementDetails.Org.substring (0.1)! = '6' )

    The type of field, that I'm looking is a field "Digital field" 4 characters.

    Can someone help me fix my code to make it work?

    Thank you!!

    you don't need to make such a work autour, everything you did not notice, this is NumericField isn't a string is always a numeric (number)

    If you can use substring on a whole or decimal number... unless it's a chain... then use the toString() after the .rawValue like this

    ContractInfo.AgreementDetails.Org. rawValue.toString (). Substring (0.1)! = « 6 »

    It should work.

  • Need help with a simple calculation.

    I will apologize to the front. I have no knowledge of writing Javascripts. I can use them if someone writes to me, but that's all. I created a simple form with money dealing. I have boxes of different text for the user to enter a number based on what type of coin it is.Currency.jpg

    In the left column, they will enter a number. I would like for the right column counting from that. However, the quantity of money (ie. 100, 50, 20, etc.) is not a text field. It is simply the text entered in another program. I'm looking for is a way to do this without having to do the amounts in currency a text field. Something along the lines of X * 100 is.

    If you can give any help or suggestion, I'd be very happy.

    Thank you.

    You will have to hard code the quantity of money in the script.

    In the first line, create 2 text, Text1 and Text2 fields. Use what the calculation script personalized to Text2:

    If (this.getField ("Text1") ".value! == ' ') {}
    This.getField("Text1").value = Event.Value * 100;
    }

    Clears Text2 if nothing is in Text1
    else event.value = «»

    The second pair of text fields would be "50" instead of "100" in line 2, etc.

  • Need help with the implementation of a replacement airport Time Capsule

    Hi... Recognizing the help. My 1 TB airport Time Capsule (ATC) crashed and I bought a new 2 TB ATC to replace. In my preference system, Time Machine reflects that my ATC 1 TB is still active. How to pay safely my 2 new cases of tuberculosis ATC to replace the 1 TB ATC?

    Assuming that you 1. already connected the new TC on your network, and/or 2. you were able to save all data on TC 1 TB, or simply do not take care of him You can just open Time Machine preferences, turn the Time Machine off, and then select the disk in the new time Capsule. A brand-new first backup starts to run, and it will certainly take time.

    Another option is to connect the new TC on ethernet directly on your Mac and then select the Time Machine preferences, this will speed up the first backup.

    In case you were able to archive the old backup and transfer it to your new TC, you will continue your backup schedule by simply selecting the new TC in Time Machine preferences.

    I hope this helps.

  • I need help with something simple [How do I Center my webpage?]

    Hello

    I followed the lessons to make my own site. I managed (with the help of you all) but I have a stupid thing that I can't understand. How do I Center the page 1000px. I have now with each thing on the left.

    small page.png

    The 1000px width setting (any id, class or element that has put on in your css), where to add in the next "BOLD" song...

    {#whatever_id}

    Width: 1000px;
    others: attributes;
         Auto margin: 0;

    }

  • Need help with the simple action

    I want to create an action in Photoshop when I return in the next layer and goe later in the previous layer, using shortcuts:

    ALT +]

    [Alt +]

    However, I am Danish and my keyboard using Alt + 9 to create a [ ]

    So I can't create my action... perhaps a kind soul could record this action and post it here?

    (You can also send to me, if that's easier. My address is kasperhviid Insert the @ here gmail.com)

    Hey Kasper,

    Always happy to help a developer to other actions...

    http://Noel.ProDigitalSoftware.com/ForumPosts/For_Kasper.zip

    Recorded in Photoshop CC.  Let me know if you need saved in an older version.

    -Christmas

  • Need help with a simple technique

    I use CS4 on Mac. It's my image:

    Screen Shot 2014-12-12 at 10.14.40 AM.png

    It is 9 tiles in distinct, although I don't know if that's relevant or now.

    The turquoise color is a solid turquoise path that lies at the back of the stack on each tile. I have the inside of the diamonds or the contours of the petals in his own way, so that I can introduce a new color. In other words, turquoise diamond contours interiors/white petal, or vice versa.

    What is the technique to do this?

    Mary,

    How about live paint?

    http://www.Graphics.com/article-old/Illustrator-fundamentals-live-paint

  • Need help with a simple list of question numbers

    I have an ArrayCollection, a collection of whose columns is a price: number. I want to get the price max() and min() in this column. I created a temporary table that contains just the price; It looks like this:

    Temp = Array()

    [0] = 13.95

    [1] = 32,50

    [2] = 23.45... etc.

    When I try to pass the array to max() like that, Math.max (temp), I get an error on the table on the number of force.

    The temp table contains the correct data. How can I activate it in a list of values that the methods Math.min () and max() will accept?

    Any ideas? Thank you

    Carlos

    Math.max.Apply (null, temp);

  • Need help with query between 2 dates

    Hello

    I did not SEE in a long time and need help with a simple query.

    I have a table of DB access with 3 fields, name, date and number

    What I want is to create a query to retrieve all the names between 2 dates

    When I ask the date field, the results are showing in this formats 2013-07-12 00:00:00

    Here's my query

    < cfquery datasource = 'mydb' name = 'test' >

    SELECT name from myTable

    where edate between ' 2011-01-01 00:00:00 ' AND ' 2013-01-01 00:00:00 '

    < / cfquery >

    < cfoutput query = 'test' >

    #name #.

    < / cfoutput >

    What I get is this error

    ODBC = 22005 (assignment error) error code

    [Microsoft] [ODBC Microsoft Access driver] Type mismatch of data in the expression of the criteria.

    Don't know what I'm doing wrong here.

    Please let me know.

    Thank you

    SELECT ename

    FROM MyTable

    WHERE edate BETWEEN

    AND

    #ename #.

  • [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an auto update that's simple to install, just get this error every time

    [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an automatic update that's simple to install, just get this error at each time HHHHEEEELLLPPPPP! Thank you

    I had the same problem.  But finally found a solution.  If your listing is similar to mine, then keep.  XP Media Center Edition 2005 (sp2).  AMD Athlon 64 x 2 Dual-Core, HP a1630n desktop computer.

    Go to the HP website, search for sp37394-XP sp3 Upgrade utility Microsoft for systems equipped with AMD processors.

    I had the same 0 x 80240036, 0x8024400a error, but realize my problem was really get manually downloaded sp3 and installed without continue loop crashing and not error messages.

  • I need help with a problem of file softdub.dll any answers or how to replace it?

    I need help with a problem of file softdub.dll all the answers, or how to replace it?  Yes, it's a problem of Vista vs itunes and apparently I lost? This file somehow.  I have no idea how blessed remedy.  I tried all the normal fixes / easy I know, but I am a novice at best.  so please, be gentle and try to guide me through a response.  Please, I beg you!

    Hello

    Did you download and save iTunes on the desktop > then right-click > select run as administrator to install?

    If you don't have anything done, see if this information helps you.

    "Not to install iTunes or QuickTime for Windows"

    http://support.Apple.com/kb/HT1926

    «Remove and reinstall iTunes, QuickTime, and other software components for Windows Vista or Windows 7»

    http://support.Apple.com/kb/HT1923

    If the advice already given does not, please contact Apple for assistance.

    "iTunes support-how to use iTunes.

    http://www.Apple.com/support/iTunes/

    "Contact iTunes Support.

    http://www.Apple.com/support/iTunes/contact/

    Or ask in the community Apple iTunes:

    https://discussions.Apple.com/community/iTunes

    See you soon.

  • Need help with the data storage store, local array and network connections

    Need help with my ESXi 4.1 installation

    My hardware:

    I built a server with an Asus P6T whitebox, i7 920, 12 Gig RAM, NIC, Intel Pro1000 PT Quad, 3ware 9650SE-12ML with 8 1.5 TB SATA green in a raid 6 array gives me about 8 + TB with a spare drive all housed within a NORCO RPC-4220 4U Rackmount Server chassis.  I also have a 500 GB SATA drive which will hold the ESXi and virtual machines.

    The network includes a firewall, Netgear Prosafe FVS336G, GS724Tv of Netgear ProSafe 24 port Gigabit Managed Switch on a dhcp cable modem internet service provider.

    I also have 2 old NetGear SC101T NAS disks (4to) I want to connect to the system how some - at a later date have... data on them and want to transfer to the new storage array. I always looking into the question of whether they will work with ESXi 4.1, or I might have to only access it through Windows XP.

    My Situation:

    I have already installed ESXi 4.1 and vsphere client with no problems and it is connected to a dhcp cable internet service.  I've set up host via a dynamic DNS service name give me a static hostname on the internet.  I installed three machines to virtual OS successfully at the moment and now want to first start by creating a multimedia storage server which will use some of this new 8 TB array, then separate data storage for use with a web server small overhead storage and a backup.  It is a domestic installation.

    Help with the data store and network:

    I was doing some reading, because I'm new to this, and it looks like I'll probably want to set up my table via ESXi as a nfs disk format.  Now, the data store is usually in another physical box from what I understand, but I put my readers and ESXi all in the same box.  I'm not sure that the best way to put in place with grouped network cards, but I want to make this work.

    I understand that in ESXi 4.1 using iSCSi LUN must be less than 2 TB, but nfs - I should be able to add a bigger partition then 2 TB (for my multimedia) in nfs, right? or should I still add it separately as a separate 2 TB drives and then extend them to get the biggest space.

    Any suggestions or direct resources showing examples on how to actually add some parts of the table as data warehouses separate nfs.  I know that to go to the configuration tab, and then select Add to storage, and then select nfs. I have not my picture, but it's here that I don't know what to do because ESXi 4.1 system already has an address, should I put the same thing to the new data store array also (will it work?), and what should I use for the name of the folder and the store of data... just do something to the top.  I thought to later install Openfiler (for a multimedia storage using this table server) as a virtual machine, use the table with esxi so that I can access the same storage space with widows and linux-based systems.

    I also know I have to find a way to better use my quad nic card... put in place of virtual switches, grouping, etc HELP?

    Any direction, assistance, similar facilities to sample, suggestions or resources that would help would be great. I did a lot of hunting, but still a little confused on how to best to put in place.

    You must think of VMDK files of large databases with records of random size guest go read some data (a DLL or an INI file), maybe write some data back, then go read other data. Some files are tiny, but certain DLLs are several megabytes. It's random i/o all and heavy on the search time. IO Opsys is small random operations that are often sequential (go read data, write data, go read other data,...) so that deadlines are critical to the overall performance. That's why people say OPS are / s of reference and forget the MBs flow. The only time where you bulk transfers are when you read media (ISO files).

    Well, now forget all this. Actually the disk activity will depend on the specific applications (database? mail server? machines compiler?), but the above is true for boots, and whenever applications are idle. You should see the profile to know.

    RAID 10 is faster (and often more reliable) than RAID 5 or RAID-6 except in certain specific cases. In General RAID 10 is ideal for many random writes, since the calculation of parity for RAID-5 and - 6 adds to the overall latency between command and response - latency is cumulative if a little slow here and a little slow it adds up to a lot of overall slow synchronous especially with e/s on a network. OTOH RAID-5 and -6 can produce faster readings due to the number of heads, so you can use it for virtual machines that transfer bulk. Test. You may find that you need several different types subdashboards for best results.

    You said 3ware, they have some good grades on their site, but don't believe it. With my 9650 that I found myself with only a couple of their recommendations-, I put the (simple) table for allocation size 256 k, nr_requests at 2 x the queue_depth and use the planner date limit. I had the habit for the Ext4 file system formatted with stride and stripe-width synced to the table and used the options large_files with fewer inodes (do not use the huge_files option unless you plan to have single VMDK files in the terabyte range). Use a cache of great reading in advance.

    Virtual machines use VMDK files in all cases except raw iSCSI LUN that they treat native disks. VMDK is easier to manage - you can make a backup by copying the file, you can move it to a PC and load it into another flavour of VMware, etc. There could be some features iSCSI to your San as a transparent migration but nothing for me. NFS has less chatter of Protocol if latency lower times to complete an operation. NFS is good to read and write a block of data, that's all it boils down to.

    UPS is good, but it won't help if something inside the machine explodes (UPS does nothing if the PC power supply goes down). If the RAID card has an option for a battery backup module, so it can contain some writings in memory and may end up the disk i/o after replacing the power supply. 3ware also limits the types of caching available if help is not installed, and you get just the right numbers with the module.

Maybe you are looking for

  • IOS10, Coast stars, purchased playlist, iTunes

    I am running IOS10.0.1 on an iPhone 6. I am a subscriber of Apple's music. Where are the freekin' star ratings (?) on Apple's music application? I spent a decade meticulously curating my collection of music using the coast to stars provided. I have a

  • Tecra M4 - does not recognize my printer more

    I recently started having problems of recognition of my Canon IP4500 printer. Reinstall printer driver worked once, no more. When I checked the Device Manager I couldn't see any lpt ports, only a number of "Toshiba BT Ports".This would perhaps indica

  • turn on bluetooth

    I would like to know how to activate the bluetooth from a pc samsung r.620? not of he preaches and I can't access to longitudinal

  • can not connect with the server.

    I can't connect to the internet. WI - FI connected and at full power. This just happened and it's never happened before.

  • Error "Could not load the page" when you click the backup and Restore Center

    Original title: Save reestore center problems OK so I need to restore my pc and when I click on the backup center and restoration he always says "Unable to load the page"... . How can I fix