Query returning record even when not satisfying the where condition

Hi,
Below Query is returning value '1D' though it doesnt fall under the range '01' and '99'.
I actually want to get the last 2 characters of the string and filter out if its not a number. Please help me.
select * from (
select substr('qwe1D',4) val from dual )
where val between '01' and '99';
Thanks
Madhuri

Sven W. wrote:
Madhuri wrote:
Hi,
Below Query is returning value '1D' though it doesnt fall under the range '01' and '99'.
I actually want to get the last 2 characters of the string and filter out if its not a number. Please help me.
select * from (
select substr('qwe1D',4) val from dual )
where val between '01' and '99';
Thanks
MadhuriBut '1D' is between '01' and '99'. Simply because '1' is between '0' and '9'.
One more example: '1111111' is also between '01' and '99'. This is how an string comparison works.
To filter out strings that do not have numeric chars in them you can use several functions. regexp_substr/regexp_replace/translate/regexp_like etc.
This might work:
select * from (
select substr('qwe1D',4) val from dual )
where regexp_like(val,'\d{2}$');Edited by: Sven W. on Sep 27, 2012 12:35 PMThere is still one problem with this. It will return '00' which is not part of the original requirement. You have to add
AND val != '00'

Similar Messages

  • Firefox crashes - even when not using the computer

    Firefox crashes - even when not using the computer
    Sometimes I can walk away from the computer and only have one tab open (e.g. Facebook) and when I come back to the computer a few hours later, Firefox has crashed for no reason.

    Unfortunately the linked crash report is empty (@ EMPTY: no crashing thread identified; corrupt dump) and doesn't include any data, so it is not possible to find the cause of the crash.
    Did you recently submitted other crash reports that were submitted and show a crashing thread?
    See:
    *http://kb.mozillazine.org/Firefox_crashes
    *https://support.mozilla.org/kb/Firefox+crashes
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If the new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Keep getting a prompt to install java even when not surfing the net. I have java installed and the control panel says it is right version. Want to know how to stop prompts. This started after I installed Yosemite.

    Since installing Yosemite I keep getting a prompt to install Java even when I am not surfing the net. Went system preferences and I have recommended version installed. I want to know how to stop the prompts. I do not have this problem on my iMac.

    Most likely, you have either the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. Both depend on the Java runtime distributed by Apple. If you no longer need the plugin, remove it. Otherwise, install Java.

  • How do I sync my iPhone 5 to my new PC? iTunes will not recognize it even when plugged in the USB port. Settings General iTunes wifi sync is still my old laptop. Any help is appreciated.

    How do I sync my iPhone 5 to my new PC? iTunes will not recognize it even when plugged in the USB port. Settings>General>iTunes wifi sync is still my old laptop. Any help is appreciated.

    See also Recover your iTunes library from your iPod or iOS device.
    tt2

  • I am in Muse 2014.3. When I edit a page, in the preview everything looks fine, but when I upload it to FTP, the page does not change, even when I upload the whole site. Is this a bug? I don't know what to do.

    I am in Muse 2014.3. When I edit a page, in the preview everything looks fine, but when I upload it to FTP, the page does not change, even when I upload the whole site. Is this a bug? I don't know what to do.

    Hi Jaap,
    Are you sure about your FTP credentials (FTP folder and site URL) that you are using for the upload? Are you able to see the updated files in the remote directory of the FTP server, after you finish uploading the muse file, using an external FTP client like FileZilla?
    Thanks
    -Prashanth

  • HT1212 even when i connect the ipod to itune... the ipod is not showing to itune...

    even when i connect the ipod to itune it's not showing and even when the ipod says connect to itunes the ipod still can't show up to itune connection...

    iOS: Device not recognized in iTunes for Windows
    also
    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar              

  • I downloaded the new 7 update and now my iPad won't charge to 100% and loses power even when not in use ?

    i downloaded the new 7 update on my ipad. it now will not charge to 100% and loses power even when not in use. any solutions ??

    Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps BEFORE doing the reset.
    Then plug it in and let it fully charge.

  • My airport express seems to be broken -- light is yellow and does not flash and doesn't change even when I press the "reset".  Tried unplugging and reset -- still a solid yellow.

    AX light is yellow and does not flash and doesn't change even when I press the "reset".  Tried unplugging and reset -- still a solid yellow. I assume this is a goner?

    Unfortunately, based on your description, I would have to second that your Express is a "goner." However, before giving up on the unit, be sure that you attempt a "factory default" reset at least 3x just to be sure.

  • Hello my keyboard it lights up even when I activate the icon in the system preference, I do not know what to do, please help me

    hello my keyboard it lights up even when I activate the icon in the system preference, I do not know what to do, please help me

    I am getting this exact same message on my phone!  That it is linked to apple ID 1****@qq.com - this has got to be a bug right?  My phone was linked to my apple ID but then I restored it and now it is saying it is linked to be above.  It is a little be too weird that @wqy8972222 is also getting that same message?

  • File.exists() returns false even when the file exists

    hi,
    the exists() function of java.io.File function returns false even when the file exists on the file system. why is this? i checked the path of the file which gives me the correct path, but exists returns false. can anyone help?

    post some of the code you�re using - then maybe I can help you out
    //Anders

  • The system is auto population partner profit center even when not provided

    Hi experts,
    While posting FB01,The system is auto population partner profit center even when not provided in the entry.Requested to you could you please assist us as soon as possbile.
    Thanks & Best regards
    Sreenivas

    Will you please let me know where you get this field partner profit center. In my screen for FB01, I do not see any such field.
    Sangram

  • Cannot download OSX Maverick? My current system is Snow Leopard 10.6.8 and even when logged into the app store I'm getting the message that I can not download at this time. Try Later?

    Cannot download OSX Maverick? My current system is Snow Leopard 10.6.8 and even when logged into the app store I'm getting the message that I can not download at this time. Try Later?

    Are you connected via wifi? If so, and it is an option, try connecting using a ethernet cable. It sometimes seems to help as it can give a more reliable connection for the 5.3gb download.
    If you do manage to download it you may want to make a copy of the installer file - which gets downloaded to the Applications folder - before running it as it self-deletes on successful installation. It may save you another monster download in the future.

  • Automatically connects to sync and will start playing music all the time even when not using sync

    My iPhone 4S will automatically start playing music as soon as I start my vehicle with sync.you can't hear it but on the screen it shows its playing even when listening to the radio

    Try resetting it if you can: hold the on/off and home buttons until you see the Apple logo (ignore the off slider that appears first), then release.  If you can't, try to connect it to iTunes, go to the Summary tab of your sync settings and click Restore to restore it.  If that doesn't work you'll have to force it into recovery mode to restore it as outlined here: http://support.apple.com/kb/ht1808.
    You can check in iTune to see if you have a backup.  They are listed in iTunes>Preferences>Devices.  However, the backup may not bring your contacts back as contacts are only backed up as necessary to preserve the recent call and call favorites lists.

  • The light on the back of my phone will not turn off, even when I turn the phone off. Help?

    The light on the back of my iphone 4s will not turn off. Even when I turn the phone off the light stays on.  Can someone help? I did notice that the camera on the back has a little bit of moisture. (I have 3 small kids).

    You will need to have the hold switch replaced.

  • Phone thinks the earbuds are in even when not

    phone thinks the earbuds are in even when not.  Does anyone know how to fix?

    Hey tss808,
    Try the tips in this article:
    http://docs.info.apple.com/article.html?artnum=306910
    Jason

Maybe you are looking for

  • Fehlermeldung: "Adobe InDesign CC 2014 funktioniert nicht mehr"

    Hallo zusammen. Ich bekomme seit heute eine Fehlermeldung wenn ich InDesign öffnen will. Der Wortlaut ist: "Adobe InDesign CC 2014 funktioniert nicht mehr" Dann kann ich nur noch das Fenster schliessen und das war es. Bei PS und Ai gibt es keinerlei

  • Missed ANOTHER appointment - Invites received in Mail not showing in iCal

    I missed an appointment this morning, and it's because of a bug in Mail/iCal. This is how it's supposed to work: - iCal collects invitations from Mail. - The invites show up in the notifications area and also show up in "gray" in the calendar pane. -

  • Please assist me which SAP module is better for me..

    Hi Evry1,      I completed B.Com in 2012. After Completion, my B.Com teacher forcefully admitted me and also my friends in Costing (I.C.W.A), and he had guided us. But due to wrong guidence and lots of pressure my friends and we cant completed any of

  • Newbie help - refreshing the page and validating?

    When entering a userID and password, how would I make the values in the textbox disappear when I refresh the page/press F5? Also how would I check the 2 textboxes in a jsp page, if their empty/null and if they are redirect them to that same page? Tha

  • IDoc to File - error code 56

    Hello, I have configured the scenario for IDoc XI File. The IDoc from SAP system is triggered out properly, but at XI side by using we05 t-code i found that the IDoc received doesnot contain any data at all. The segment names have been changed and th