Need help with instr/Regexp for the query

Hi people of Oracle

I use Oracle

Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options

I have a few responses from students and the valid values are + / / (alphabet) o/p and spaces at the end of the scam only not in the middle.

According to my condition, the registration number 2 3.4 must be in the request but I'm alone (chart 3).

Can we use REG_EXP

Help, please.

Thanks in advance.

Rajesh

with x as)
(
SELECT '+-+-POPPPPPP' STUDENT_RESPONSE, 1 numero_enregistrement FROM DUAL Union all the
SELECT ' + --AOPPPPPP++' STUDENT_RESPONSE, 2 numero_enregistrement FROM DUAL Union all the
SELECT "+-+-OPPPPPP -' STUDENT_RESPONSE, 3 numero_enregistrement FROM DUAL union all
SELECT '+-+-9OPPPPPP' STUDENT_RESPONSE, 4 numero_enregistrement FROM DUAL)
)
(SELECT NUMERO_ENREGISTREMENT,
TRIM (STUDENT_RESPONSE) X
WHERE
((INSTR (UPPER (TRIM (STUDENT_RESPONSE)),'-') = 0))
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), '+') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), 'O') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)), 'P') = 0)
OR (INSTR (UPPER (TRIM (STUDENT_RESPONSE)),' ')! = 0)
)
)

Hi, Renon,

Rb2000rb65 wrote:
Hi people of Oracle

I use Oracle

Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options

Thanks for posting this (and the WITH clause for sample data). It is very useful.

I have a few responses from students and the valid values are + / / (alphabet) o/p and spaces at the end of the scam only not in the middle.

You combine several qeustions responses in a single VARCHAR2 column? It would be better to have a separate line for each question.

According to my condition, the registration number 2 3.4 must be in the request but I'm alone (chart 3).

What exactly are your needs? You try to find the rows where the student_response contains one of the forbidden characters, or if it contains a space anywhere, but at the end of the string?

Can we use REG_EXP

Yes, but it's pretty easy and probably more effective, do not use regular expressions in this case:
Here's one way:

SELECT     record_number
,     student_response
FROM     x
WHERE     TRANSLATE ( UPPER ( RTRIM (student_response, ' '))
            , 'X+-OP'
            , 'X'
            )     IS NOT NULL
;

In other words, once you remove the spaces and all occurrences of '+', '-', 'o' or 'P', then the forbidden characters are left, and you want to select the line, if there is one of these.

If you really, really want to use a regular expression:

SELECT     record_number
,     student_response
FROM     x
WHERE     REGEXP_LIKE ( RTRIM (student_response)
              , '[^-+OP]'          -- or '[^+OP-]', but not '[^+-OP]'.  Discuss amongst yourselves
              , 'i'
              )
;

but, again, it will be probably slower than the first solution, using TRANSLATE.

Published by: Frank Kulash, October 17, 2011 13:05

Published by: Frank Kulash, October 17, 2011 13:41
What follows is a bit simpler that TRANSLATE:

SELECT     record_number
,     student_response
FROM     x
WHERE     RTRIM ( UPPER ( RTRIM (student_response, ' '))
           , '+-OP'
           )          IS NOT NULL
;

Tags: Database

Similar Questions

  • CQ61-313us: maestro also needing help code is 75957252 for the bios password reset

    Maestro also needing help code is 75957252 for the bios password reset

    Check your other post. I answered here.

  • No support for pse4, don't need help with aid and all the rest. What is a layer? How can I get help PDF from CD? I don't have any idea how to use it. I have a Macbook pro.

    Need help with using pse4 not taken in charge by adobe. How subjects do not available and I have never used something like that. Aide said there is a download but have not been able to do. What is a rookie to do? Y at - it somewhere that I can go to learn how to use PSE4?

    To find out how your problem:

    http://kb2.Adobe.com/CPS/402/kb402107.html

    To get help from the CD files you double-click in the finder, go to PDF help and drag it to the desktop or elsewhere.

  • Hello, I need help with my photoshop, rececently the majority of my family disappeared merger options and I cant access AVC and other options ive tried reset preferences and it seems to come back but when I add an image and try add text again

    Hello, I need help with my photoshop, the majority of my family rececently disappeared options fusion and I can't access strokes and other options ive tried to reset the settings of preference and he seems to come back but when I add an image and you try to add text again, they'll only options I have are drop shadow , gradient, Chromakey, shine of satin overlay, inner (I use photoshop cc 2015) Please help, my Skype contact options are: RoblivionM8 and email:[email protected]

    Thanks for your time

    Your first screenshot shows the layer style dialog where not all types of effects are indicated on the left. Bottom left of the dialog box, you see a small icon fx with a menu arrow drop-down. Use drop down the menu and make sure all you click on show all effects or restore the default list. I don't know what you're trying the shoe on the second screen capture.

  • Hi, I need help with installing updates for CS5

    Hi, I need help with the installation of the updates of CS5. I get the following message: some updates to installation failure. My product is already registered. Can someone help me, please?

    Erkan please download and apply updates directly from updates.

  • I need help with some Applescript for Postbox

    I was wondering if any of you can help me?

    I am writing a very simple script for my Postbox email application. It takes the selected message and turns it into a reminder. Everything works fine, but I want to take the subject assigned to the message and use it as the name of the callback list, and that's where it breaks down (topics are tags, as in Thunderbird and Mail).

    According to the dictionary, a message object counts among its subjects msg properties which is a list of subjects. According to the dictionary, a subject has three properties so, id, name , and color.

    I need only the first topic, so I do something like

    set theTopics to msg topics of theMessage.
    set theTopic to item 1 of theTopics

    no error reported, it returns a list, but when I then try to access the properties of the first article (= first subject), it is clear that something is wrong, and I think it's a bug/bad programming in the mailbox, but I'm not sure.

    When I do something like

    set ReminderList to name of theTopic

    He begins to complain. It is said that name (or id or color) is not available, as I can't get this to other classes, and it does not even return the class type for the element.

    It will return something that looks like this:

    class {show id "some topic"}

    no name for the class.

    And it seems that the text, but it behaves differently.

    How can I know what I'm actually deal with this object "topic"?

    What is - this actually to return?

    I don't know the app, but try to go back to theTopic properties.  That could make things a little clearer.

  • Need help with upgrade memory on the Satellite A100-250

    Help me with upgrade memory on TOSHIBA Satellite A100-250 up to 1024 MB.

    I want to buy an another slat memory ddr2-533 512 MB, what model exactly I needed to research, they were working in a pair.

    Sorry for the bad English. From Russia with Love.
    PS. I like to drink Russian vodka :)

    Hay

    Your laptop can be upgraded up to 2 GB and compatible RAM is DDR2 400/533 1 GB (PA3411U-1M1G).

    Use this part number in Google and you will find it.

    Bye and don t drink too much Vodka. ;)

  • Need help setting up WebUI for the Wireless Gateway

    I have problem installing a Web UI for my demo project.

    I just do temperature is a simple application of WSN on a node of thermocouple WSN-3121 and it logging on a RT NI 9792 wireless gateway.

    Then, I wanted to create a web user interface and display whats in the user interface of the gateway - see the project.

    SO I'm stuck with the web INTERFACE coming.  I tried to read as much as I can but I still don't know what I'm doing wrong.

    As far as I see it, I need to create a web service in the construction for my gateway specifications and place the gateway_main.vi like the vi to use.  Then build and deployment.  Once it happened, and I run the vi on the bridge, I created a Web user interface as shown in the picture, where it counts the the gateway web service using 192.168.0.16:8080 - that works very well.

    When I run the Web interface, it is just and expires.

    I am using LAbview 2010.  Help, please.

    Hello markza,

    Your approach using the Web user interface designer and understanding its use case is quite accurate, the question lies in the web service, you have deployed. The VI you build as web service, which is gateway_main.vi, while loops inside and so cannot be used as a web service. The reason for the timeout is that your user interface Builder application calls the web service LV2010 and is stuck there for waiting time loops to complete. Also, the data type of cluster is not supported in the user Web interface Builder, so you'd have to break up from the entrance of the time of picking for the node wireless in two separate digital inputs.

    I recommend creating a Subvi out of your code inside of the while loop inside gateway_main.vi. The Subvi must have two digital inputs to replace the cluster (as mentioned above) and do not have one of the Boolean inputs Start or Stop. Output would remain the same, that is, two doubles and a Boolean value.

    I would like to know if this is useful and if you have any other questions.

    Thank you!

    Dieudonné jgfcnbh

    The user of LabVIEW Web R & D interface generator

  • Need help with LabVIEW code for motor control.

    Hello

    My name is Sasi. I'm a grad student BME working on my thesis topic of assessment for back pain spine implants. To do this, I'm building a test machine that would apply pure moments of a specimen of the spinal column. I use LabVIEW 8.5 to implement the control of a brushless AC servo motor. My requirement is

    Step 1: Initialize the engine.
    Step 2: Start moving it to a uniform to the right PLAN (this value of RPM too user can enter).
    Step 3: while doing step 2; at the same time read the couple cell data (acquisition of data using Asst.). DAQ o/p is 0 v to 10 V; 0 v is 10 Nm n
    10 v is + 10 Nm
    Step 4: What torque reached + 10 Nm, i.e. 10 V, the engine stops.
    Step 5: from the position where the motor stopped (IE not need to return to the initial position) start moving in the opposite direction to the same
    Uniform rpm as in step 2 at the reading of data in the cells of the couple.
    Step 6: once more what torque reached-10 Nm, i.e. 0 V, the engine should stop.
    Step 7: Repeat "Step 2" to the "step 6' 3 times.
    Step 8: Reset engine position.

    So far, I managed to get the engine to move backward @ a desired vel, the accl, deceleration for 3 cycles before n n. I enclose my code. I have a problem inserting the code for reading DAQmx amidst all this. Can someone help me.

    Thnks,

    Sasi.

    Hi Sonia,.

    I took a quick glance to your problem and I think I have a solution for you.  I certainly agree with the suggestion of the use of parallel loops Lynn.  This will allow the portion DAQmx run uninhibited by the part of the motion, and vice versa.  In addition, you need only perform an iteration of the loop of the movement whenever the voltage level exceeds a threshold.  Thus, by performing an iteration on the code of movement in the same loop are you iterate over DAQmx code, you essentially waste processor.

    I created a VI that should do what you are wanting.  I tested it on me and it works very well.  You have a tweak a few things to apply to your system (such as motion Council DAQmx and physical channel ID, etc.).  I used two parallel loops and event programming.  Basically, the loop of movement starts the engine turns at the specified speed.  Once the engine is running, he expects the DAQmx loop to tell him that the voltage value has crossed the threshold.  When the voltage value exceeds the maximum threshold (I put a value slightly less than 10 to jitter and saturation), the DAQmx loop indicates the loop of the motion that it may end its iteration.  The motion loop stops the motion, causes a reversal and repeats the motion.  Once the movement has begun, he expects the DAQmx loop once again to tell him that a threshold was held, but this time, it's looking for a minimum threshold.  I used "Occurrences" to implement the event programming in LabVIEW.

    I've commented the code pretty thoroughly, so I hope that comments will answer all remaining questions.  The advantage of using programs that focus on the event for this is that you save time processor, and your movement is more closely synchronized with the DAQmx.  Instead of one iteration of the loop of movement as fast as you can, updates every hour, you just put in pause and wait for the other loop to tell you when to start up again.  Meanwhile, the processor doesn't have to worry about an iteration of this loop over and over again.  In addition, when the accident occurs, you catch him immediately, instead of having to wait until the next iteration.  Thus, you are more closely synchronized with the DAQmx code portion.

    I hope this will help you.  Please report if you have any questions about the code or its implementation.  Good luck!


  • Need help to download files for the old order since October 2004

    I have a very old order for a font that I want to re - upload the files, but the order does not appear under my account information. Is there a way I can still access my files?

    Order date: October 29, 2004 04:56 PDT

    Order number: PON1267F24A

    Thank you

    -Brad Turner

    I doubt you'll have much luck due to the lack of support for old products, but try to support customer:

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Get help from cat with orders, refunds and exchanges (non - CC)

    http://helpx.Adobe.com/x-productkb/global/service-b.html ( http://adobe.ly/1d3k3a5 )

  • need help with insert sitemap in the footer with the adobe site map muse

    Hi I need help, to know how to insert a site map link in the footer of a page Web in muse Adobe.

    a quick google search just shows how to create a site map, but no mention of how to get a clickable link to a sitemap on a Web footer.

    any help would be appreciated.

    Hello

    You can try to front page of the site hyperlink to any text that would open the sitemap on the mouse action.

    For example, domain.com/sitemap.xml, enter in this format in hyperlink with any text or image that you can place on the page footer area.

    Thank you

    Sanjit

  • 10-2101 U.S. Tablet HP: Need help with firmware mix to the top

    Little problem with the tablet in place lately and accidentally erased the firmware. My best look up and somehow able to reinstall one from here. But the thing is now the entire Tablet is in Chinese, because it seems I could have installed the wrong one... ghoulish pls help me fix it? Appreciate the help if ever...

    Hi@Robin Wendigo,

    Thank you for the HP's Support Forums. Best platform for all kinds of solutions, tips and settings for your questions/problems.

    For the best experience on HP forum, see our Guide to HP Forums to learn more.

    Problems of language on the tablet settings. Is this fair?

    I want to help you.

    Follow the steps from the link below and check if that helps.

    http://HP.care/2dyWVI3

    I hope this helps. Let me know to learn more

    Happy announcement.

    Resolv_S

    Happy to help you. I work for HP

    Please click on " ""Accept as Solution " " " if you feel my post solved your problem, it will help others find the solution.
    Click on the " Bravo Thumbs Up" " " to say 'Thank you' to help! "

  • I need help activate my email for the fresno City College students

    It says in the instructions for the activation of the email account that my username would be outlook.com att (lastname_studentid @my.scccd.edu). I don't see how it goes because it won't let u use your user id. I JUST DON'T UNDERSTAND

    You must contact your town order IT support staff.  We do not really have a way to help you since we do not know how the College computers are configured, the network on which they are running and so on.  IT is supported by your local personnel will be because they work with the stuff every day.

  • Hello. Need help with Windows 8 for Windows 8.1 update

    I have brand new computer and need windows update 8 for windows 8.1 but when I try to update the store and click on the free updated windows 8.1 I got the message "not available". I downloaded and installed the KB 2871389 update but without success. My OS: Windows 8 64-bit language (version 6.2 version 9200)

    Hello. Thanks for the quick response, but the PROBLEM IS NOT RESOLVED.

    I did everything you told me:

    1 create the installation media for Windows 8.1.

    2. "Download Windows 8.1.

    3. "How to create a Bootable USB or a DVD with an ISO of Windows 8 or 8.1"

    4 picked up the product with magicaljellybean.com/keyfinder/ key

    I also checked the product key and it is CORREECT but I can't go further cos I got the message that my key is not valid for this edition of Windows.

    MY WINDOWS 8 IS TURNED ON, BUT MY PRODUCT KEY CANNOT BE USED TO UPGRADE TO 8.1


    Do NOT post in uppercase, because it is considered as shouting and is difficult to read.

    You have 8 SL > you download 8.1 SL

    @@@@@@@@@@@@@@@@@@@@@@@@@

    When you reinstall it will go take the product key and activate the system automatically.

    If it does not, follow these steps:

    "How to activate Windows 8 and 8.1 telephone"

  • Need help with workflow to criticize the images of the student

    We used Lightroom CC to criticize images students workshop by import of each card and then work in the develop Module to try different culture, exhibition, etc. Process import/copy files got the largest, became too long for each card. We want to use the Add option, but of course, it is not available when importing from a card SD/CF.

    I need in the catalog previews pretty long to select a half dozen with them to review/edit. The changes are mainly to show how they can adjust their framing and exposure in the future, don't not to teach fitting, so they published versions have no special value.

    I'd rather leave the files on student cards, create standard previews when importing and only create previews of 1:1 on the fly for the images that we edit in fact, usually 5-6 of each session. While criticizing us, then eject and pop in the next map, I leave the card in the reader (USB 3.0).

    They shoot in RAW and would not lose quality by switching to a compressed format or JPG format. Some could be prepared to shoot RAW + JPG for the workshop and simply import the jpg to criticize, but that presents them with a problem of management of file and possibly lowered an image quality for mounting piece.

    Any suggestions? I would like to stay with LR to do this, at least there is no good option in LR, because I also teach LR in the workshop, but would consider another tool or add-in, if it was the best option.

    Thank you very much for Maine.

    This is not an option with LR. For any image to display in LR and any changes that will be her the leader/s must be copied to a physical HARD drive that is connected to the system. Memory cards are not treated as physical disks and I don't know anyway to change this in LR

    I suggest that you try Adobe Bridge and then use ACR directly from bridge to make your editing. All functions in ACR are the same as in the module development of LR and you won't have to copy the images to the hard drive first, push as far as I know. I just tested that and it seems to work fine, except that no sidecard the XMP files are created on the memory card. If the changes could only be stored in the cache ACR system and all changes are lost once the card is ejected.

Maybe you are looking for

  • Is there a way to create a smart playlist without several songs from the same album?

    I would like to create a smart playlist without several songs of his same albums.  Is this possible?

  • KB981322 update does not install on Vista

    Hello I get an error Code 80073712 from windows update regarding KB981322 Update. I downloaded manually, but installation still does not work. Everything about this? My OS is Vista Business x 64. George.

  • Questions to open any .exe files

    Hello I have problems to open all my .exe files. happened after I installed security software. I already tried your suggestions about the site, but I can't seem to run 'command', in order to go further. I think that there are problems with my file as

  • Mobility Center button has stopped working

    Hello. The settings (windows Mobility Center) Dell Inspiron 17R button stopped working after the upgrade of Windows 8 to 8.1. The light goes on then off and nothing happens. The other two buttons are OK. A15 BIOS. Tried to reinstall QuickSet several

  • [Rebuild] - calling script to rebuild a dynamic group, anyone?

    OK, Scriptsmiths - one of you have a script that you use to trigger a "Rebuild" dynamic group programmatically membership?   The builtin scheduled task that runs nightly assessment and reconstruction - lists an empty value where a script would be...,