SQL "LIKE" statement isn't working right -- help please!

Good day everyone,
I thought about putting this in the "SQL on Oracle" forum, but it looked like those messages were geared more toward the Oracle platform itself, so here I am.  I apologize if this isn't the best forum.
I have the following SQL statement:
  SELECT zzreporting_ut1
         zzreporting_ut2
         zzreporting_ut3
         zzreporting_ut4
         zzreporting_ut5
      UP TO 1000 ROWS
      INTO TABLE it_gmia_gmgrresp_data
        FROM gmspprogram
   WHERE ( ( zzreporting_ut1 LIKE '4011%'   OR
             zzreporting_ut1 LIKE '4012%'   OR
             zzreporting_ut1 LIKE '4013%' ) OR
           ( zzreporting_ut2 LIKE '4011%'   OR
             zzreporting_ut2 LIKE '4012%'   OR
             zzreporting_ut2 LIKE '4013%' ) OR
           ( zzreporting_ut3 LIKE '4011%'   OR
             zzreporting_ut3 LIKE '4012%'   OR
             zzreporting_ut3 LIKE '4013%' ) OR
           ( zzreporting_ut4 LIKE '4011%'   OR
             zzreporting_ut4 LIKE '4012%'   OR
             zzreporting_ut4 LIKE '4013%' ) OR
           ( zzreporting_ut5 LIKE '4011%'   OR
             zzreporting_ut5 LIKE '4012%'   OR
             zzreporting_ut5 LIKE '4013%' ) ).
All I want to do is bring back the rows where one of those 5 "ut" fields begins with 4011, 4012, or 4013.  However, when I run it, it brings back anything:  rows where all 5 "ut" fields are empty, where the ut1 field begins with 4014, etc.
Does anyone know what I'm doing wrong in my SQL statement?
Thank you!  And as always, points awarded for ALL HELPFUL answers!
Dave
Edited by: Dave Packard on Jul 1, 2008 2:18 PM

Hi Dave,
because I don't know such a table named gmspprogram I'm not sure what to say.
According to boolean expression syntax you do not need any of the brackets because the only operator used is OR.
I'd suggest.
data: lt_pattern_range type range of gmspprogram-zzreporting_ut2.
perform insert_range using 'ICP':
  '4011*' '' changing lt_pattern_range,
  '4012*' '' changing lt_pattern_range,
  '4013*' '' changing lt_pattern_range.
SELECT
  zzreporting_ut1
  zzreporting_ut2
  zzreporting_ut3
  zzreporting_ut4
  zzreporting_ut5
  UP TO 1000 ROWS
  INTO CORRESPONDING FIELDS OF TABLE it_gmia_gmgrresp_data
  FROM gmspprogram
  WHERE zzreporting_ut1 in lt_pattern_range
     OR zzreporting_ut2 in lt_pattern_range
     OR zzreporting_ut3 in lt_pattern_range
     OR zzreporting_ut4 in lt_pattern_range.
* need form
*&      Form  insert_range
*       insert selection range - handles any range type "CLI20061218
FORM insert_range  USING    p_signopt     TYPE c            "#EC CALLED
                            p_low         TYPE any
                            p_high        TYPE any
                   CHANGING pt_range      TYPE table.
  FIELD-SYMBOLS:
    <range>                               TYPE ANY,
    <sign>                                TYPE ANY,
    <option>                              TYPE ANY,
    <low>                                 TYPE ANY,
    <high>                                TYPE ANY.
  DATA:
    lv_ref                                TYPE REF TO data.
  CHECK NOT (
              p_low     IS INITIAL AND
              p_high    IS INITIAL ).
  CREATE DATA lv_ref                      LIKE LINE OF pt_range.
  ASSIGN lv_ref->* TO <range>.
  CHECK sy-subrc                          = 0.
  ASSIGN COMPONENT 'SIGN' OF STRUCTURE <range> TO <sign>.
  CHECK sy-subrc                          = 0.
  ASSIGN COMPONENT 'OPTION' OF STRUCTURE <range> TO <option>.
  CHECK sy-subrc                          = 0.
  ASSIGN COMPONENT 'LOW' OF STRUCTURE <range> TO <low>.
  CHECK sy-subrc                          = 0.
  ASSIGN COMPONENT 'HIGH' OF STRUCTURE <range> TO <high>.
  CHECK sy-subrc                          = 0.
  <sign>                                  = p_signopt(1).
  <option>                                = p_signopt+1(2).
  <low>                                   = p_low.
  <high>                                  = p_high.
  READ TABLE pt_range WITH KEY table_line = <range> BINARY SEARCH
    TRANSPORTING NO FIELDS.
  CHECK sy-subrc                          <> 0.
  INSERT <range> INTO pt_range INDEX sy-tabix.
ENDFORM.                    " insert_range
At least - I think - this looks better. And you may reuse the FORM insert_range whereever you want.
Regards,
Clemens

Similar Messages

  • I turned my imessage off, and now when i try to turn it on it isn't working, any help please?:)

    i turned my imessage off, and now when i try to turn it on it isn't working, any help please?:)

    See if your Mac will boot from the install DVD.
    Then uninstall Internet Cleanup.
    Allan

  • T42 keyboard not working right, HELP PLEASE

    My keyboard is not working right. If I push the key it wont work,but if I hold the key for a couple seconds then it works was told to replace the keyboard and I did with a new one. But it is still doing it. Can anyone tell me what the problem is. Model # R4U machine type 2378, OS XP-PRO , COA SP2 , S/N L3xxxxx.
    Message Edited by scottzilla on 12-15-2008 10:05 PM
     Moderator Note; s/n edited for members own protection
    Message Edited by andyP on 12-16-2008 07:57 AM

    It's the Quick Selection Tool in Photoshop Elements 9 and I'm trying to get the background and make it another layer so I can even out the color of the background then bring down the transparency.  Not sure if that makes sense.  I'm new to this....  Sometimes the area it will grab can go ...not fast.. but not slow.  Sometimes it's like it's just messed up and literally takes 30 seconds to process each move.  I rebooted my computer and re opened it and it helped a little.  It's not clear what causes it when it messes up and when it doesn't.  Just frustrating.  It's probably user error because I'm so new at Photoshop.   Thanks for your input.   I really appreciate it.

  • I have CS5 photoshop and indesign. and it isn't working properly, help please?

    I have CS5. In the photoshop I can't open ANY documents or even open a new one. I can see the document in the layers bar but nothing on the open window, I've tried uninstalling and no luck. Also InDesign, when in the writing tool box and I hit the return key to start a new paragraph, nothing happens . Help Please!

    I can’t see my images and only get a black screen (or strange pattern).
    For the ID issue ask in their forum.
    Mylenium

  • HT5655 The new Flash installer from Adobe still isn't working, right?

    The new Flash installer from Adobe still isn't working, right? We get the "installation failed" messages, and we're awaiting Adobe's follow-up on it?

    AdmrlLocke wrote:
    Adobe Acrobat 8 has two problems on my iMac. The lesser problem comes when I go into the Print command and click "Preview." I get a message that says that Preview isn't supported.
    Preview is not supported because building a preview of a print job under OS X involves creating a .PDF file. You already have a .PDF file open if you're using Acrobat, so there's no point creating a new one.
    The greater problem just cropped up as I was writing about my problems with Quicktime and Real Player: Acrobat tried to update itself and then gave me a message that says, "Cannot overwrite file /Users/(myname)/Documents/Update5/AdobeUpdater/acrobat8pro-en_US/AUMProduct.dmg .
    That's not a problem with Acrobat. The system is saying that you have a file named AUMProduct.dmg in place already, and you don't have permission to update it. You need to change the permissions on that file so that you can update it, or to use an account which has update permission. Or it might just be locked and you need to unlock it. Locate it using the Finder (you have the complete path to the file listed above) and see what permissions are on the file and whether or not it is locked.
    You might also just put the entire Update5 folder into the Trash and try updating again.
    The file maybe be locked or you may not have sufficient access rights. Please make sure you have write access to this file." Can anyone help? Thanks.

  • I forgot my security questions and my backup email that it sends the reset to isn't working! Help

    I do not know my security questions and my backup email that it sends the reset to isn't working. Help!

    If you don't have access to, or don't have, a rescue email account (and you won't be able to change it until you can answer 2 of your questions) then you will need to contact iTunes Support or Apple to get them reset.
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then 'Forgotten Apple ID security questions'
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57
    When they've been reset you can then use the steps half-way down this page to change/add a rescue email address for potential future use : http://support.apple.com/kb/HT5312 . Or you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • HT1554 Apparently, I don't know my "com.apple.smig keychain" password. And I'm in the middle of setting up my new Mac mini. I transferred data from my MacBook and what I thought was the password isn't working! Help!!

    Apparently, I don't know my "com.apple.smig keychain" password. And I'm in the middle of setting up my new Mac mini. I transferred data from my MacBook and what I thought was the password isn't working! Help!!

    Hello,
    See if this helps...
    Mac OS X 10.4 Help, I forgot a password in my Keychain
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1960.html
    Mac OS X 10.4: Keychain Access asks for keychain "login" after changing login password...
    http://support.apple.com/kb/HT1631
    Resetting your keychain in Mac OS X...
    If Keychain First Aid finds an issue that it cannot repair, or if you do not know your keychain password, you may need to reset your keychain.
    http://support.apple.com/kb/TS1544

  • I just got the iPhone 5S.  I am able to RECEIVE air drops from people, but I can't send anything via Air Drop.  I doesn't seem to be communicating with others.  I have Air Drop to communicate with my contacts, but it isn't working.  :(  Help!

    I just got the iPhone 5S.  I am able to RECEIVE air drops from people, but I can't send anything via Air Drop.  I doesn't seem to be communicating with others.  I have Air Drop to communicate with my contacts, but it isn't working.    Help!

    iOS: Use AirDrop to wirelessly share content

  • My send button on messaging isn't working any help out there?

    My send button isn't working, any help?

        Hello monti221! Nothing is more frustrating than a phone that's not operating correctly. I want to help! Thank you gina7239 for your valuable input. My suggestion would be to complete a "restore" of your device. Using iTunes will ensure that all of your data is saved. If you need instructions please select the link and select iPhone support.. http://bit.ly/y5iuoj Let me know if this helps!
    ChaunceyM_VZWSupport
    Follow us on twitter @VZWSupport

  • Just want to say that's Block pop-up windows it's realy need to fix not work ever i think in Microsoft explorer it's work good but in firefox else new virsion Firefox4 it's not work right so please yts have to fix it it's so many important addon

    just want to say that's Block pop-up windows it's realy need to fix not work ever i think in Microsoft explorer it's work good but in firefox else new virsion Firefox4 it's not work right so please yts have to fix it it's so many important addon

    [Quote]
    Waiting for Tidbits and Elector to grace my post with there constant negativity and start a war of words as usual... since they love stirring the pot and angering the Windows Phone Community every time they reply to posts.  I just can't believe they spend that much time here on the forums replying if they are not a paid Verizon employee or a paid basher from a competing platform.
    [/Quote]
    Well I found nothing wrong in your post. So why even make a statement like the quote I included?
    Once more I am a retired government employee. So I have the time to post. Or has my rights been taken away to voice an opinion?
    Your posts was great you were not whining about your rights to file complaints to the FCC or FTC etc. One of the best I have read.
    And I am not trying to sway you from your phone choice. If you looked at my avitar it shows apple iphones. But I use and have used androids and not Windows phones.
    However your numbers of windows phone users all leaving over the issue is miniscule in the number of users of Android and iOS devices.
    I have written many times I wish all the devices get updated like iOS devices do. But at present that is not happening
    No bashing, no adversarial post just a little common sense is all I use.
    And again your post was great.
    Good Luck

  • Excel saving issues error: Someone else is working right now, please try again later"

    Excel saving issues  error: Someone else is working right now, please try again later"        
    I am running W8.1 with Office 2013 and accessing a shared drive, When I try to save an excel document back to the shared drive - I get the error msg
    "Someone else is working in "servername\share\filename" right now, please try again later"
    I can see that there is no one else accessing this file at all. I created a brand new file, added content, saved and got the same error.
    When I use a W7 with Office 2013 accessing the same share drive, accessing the same file - I am able to save the document without issues.
    Does anyone have any ideas what this could be.  Both of these situations are while working from home using a company vpn connection. It does not happen when in the office using either W8.1 or W7.
    Peter.

    Hi,
    Saves when saving locally. Its looking more like W8.1 on a VPN connection that is causing the issue. What can I look for
    I mean you can try to save it to local drive(like drive c:) and then copy it to shared drive.
    If you gain the access to the shared file server, you can check the file status when you open this file.
    Also you can check your event log to see which process causes this error.
    Since I'm not familiar with VPN, I'd suggest you post your issue to the following forum:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?category=windowsserver

  • Not able to open adobe XI Pro after I have filled out a documents and trying saving it. The program stops working & won't open up again.  Tried to complete a repair, rebooting nothing works. Help please.

    Not able to open adobe XI Pro after I have filled out a documents and trying saving it. The program stops working & won't open up again.  Tried to complete a repair, rebooting nothing works. Help please.

    Hi,
    Can you pls. provide more details of the issue?
    OS/Platform
    It would be great if you can provide the MSI logs for repair from the %temp% directory.
    Thanks,

  • Everytime I open lightroom I get a pop up message saying "Lightroom encountered an error when reading from its preview cache and needs to quit" and it closes. Ive already tried reinstalling, nothing seems to work. Help please!

    Every time I open lightroom I get a pop up message saying "Lightroom encountered an error when reading from its preview cache and needs to quit" and it closes. Ive already tried reinstalling, nothing seems to work. Help please!

    Open the folder containing your catalog. In that folder you will find another folder with the extension .lrdata, and you need to delete that folder. After you do that, Lightroom should start normally and will create a new preview cache.

  • I changed the name of my apple id and now I can't use the app store on my phone correctly because it's using my apple id's old name. I signed out and in on itunes and synced my iphone. Still doesn't work. Help please?

    I changed the name of my apple id and now I can't use the app store on my phone correctly because it's using my apple id's old name. I signed out and in on itunes and synced my iphone. Still doesn't work. Help please?

    Settings>Store...tap the ID shown...sign out...sign back in with the ID you want to use.
    Note: Apps are forever tied to the Apple ID used to originally obtain them. They cannot be updated using any other Apple ID other than the one they were originally obtained with.

  • HT2305 i have just bought a iphone 5 and am trying to back my 4 up so i can transfer everytghing on to my 5. it has said i need to update my itunes which i have tryed to do but still isnt working any help please

    i have just upgraded my iphone 4 to a 5. and was trying to back my 4 up on the computure so i could get all my pics and music on to my 5. but its saying i need to update my itunes which i have tried to do and is still not working any help please i have been trying for hours

    how is it not working?
    what version of itunes?
    what ios on iphone4?
    does it give an error msg?

Maybe you are looking for

  • MacBook Pro running slow - opening applications, documents, photos, everything

    Hello Mac community, I am using a MacBook Pro 2010 OS X 10.9.5 Storage capacity 21.74 GB free of 249.2 GB 4 GB of memory Over the last couple of weeks, or over a month now, I have been noticing this machine is getting very slow in opening up any docu

  • To view the per day load in all workcenter

    Hi guys, My client requires one report,it has to show all work centers load in a particular day.Is this possible in standard SAP R/3 ? please guide me to solve this problem. thanks in advance S.Murali

  • Best way to creat Objects

    Hi gurus, I am in a process of converting CRs to Universe. Based on the business area , I gathered a set of reports that to be converted to Universe. Joining of tables is almost done. Now I am in process of creating objects. As we are going in the Bo

  • Connect one SAP BW system to multiple R/3 systems

    Hi All, Has anyone done a connection of one SAP BW system to multiple SAP R/3 systems. I know it is theretically possible, but please let me know if anybody has experience of doing it. Our scenario is that take HR data from one R/3 system and other m

  • Error while installing 11g obiee

    I am trying to install obiee 11g on my windows 7system i have installed oracle version 11.1.0.7 as backend and when i creating rcu utility it getting me a warning "The database you are connecting is with non-AL32UTF8 Character set. oracle strongly re