Regexp_substr and select all

HI
I have this doubt, I have a query like this:
SELECT *
FROM table
WHERE DIVISION IN (
SELECT REGEXP_SUBSTR( DIVISIONS ,'[^,]+', 1, LEVEL) FROM DUAL
CONNECT BY REGEXP_SUBSTR( DIVISIONS , '[^,]+', 1, LEVEL) IS NOT NULL )
It works fine when DIVISIONS its like "3,4,5,6"
but i want, that when DIVISION its empty ( "" ) it does not filter,
Can you help me find how can i do this?
thanks

How about:
SQL> var divisions varchar2(100)
SQL> exec :divisions := '3,2,6,7,8,6,34'
PL/SQL procedure successfully completed.
SQL> -- generating sample data:
SQL> with t as (
  2  select 1 div from dual union
  3  select 2 div from dual union
  4  select 3 div from dual union
  5  select 4 div from dual union
  6  select 5 div from dual union
  7  select 6 div from dual
  8  )
  9  --
10  -- actual query
11  --
12  select *
13  from   t
14  where
15    case
16      when :divisions is null then 1
17      when :divisions is not null
18      and div in ( select regexp_substr(:divisions ,'[^,]+', 1, level)
19                   from   dual
20                   connect by regexp_substr(:divisions , '[^,]+', 1, level) is not null
21                  ) then 1
22    end = 1;
       DIV
         2
         3
         6
3 rows selected.
SQL>  exec :divisions := '';
PL/SQL procedure successfully completed.
SQL> -- generating sample data:
SQL> with t as (
  2  select 1 div from dual union
  3  select 2 div from dual union
  4  select 3 div from dual union
  5  select 4 div from dual union
  6  select 5 div from dual union
  7  select 6 div from dual
  8  )
  9  --
10  -- actual query
11  --
12  select *
13  from   t
14  where
15    case
16      when :divisions is null then 1
17      when :divisions is not null
18      and div in ( select regexp_substr(:divisions ,'[^,]+', 1, level)
19                   from   dual
20                   connect by regexp_substr(:divisions , '[^,]+', 1, level) is not null
21                  ) then 1
22    end = 1;
       DIV
         1
         2
         3
         4
         5
         6
6 rows selected.

Similar Messages

  • In history displays. put checkmarks and select all.

    In history displays. put checkmarks and select all.

    Can you clarify what you mean?
    Do you have a problem with the history?
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    *Use a compressed image type like PNG or JPG to save the screenshot
    *Make sure that you do not exceed the maximum size of 1 MB

  • Have a question I do not use mail in my computer I use yahoo and I have all these emails and selected all and then delete then delete trash and they always come back how do I stop these old email in apple mail? I never send anything from there but I have

    have a question I do not use mail in my computer I use yahoo and I have all these emails and selected all and then delete then delete trash and they always come back how do I stop these old email in apple mail? I never send anything from there but I have the same email in yahoo but delete them and they still show up in apple mail from day one how do I get rid of these once and for all.Please help
    <Edited by Host>

    I am soooooooooooo confused now.  Ok, if you are having problems with Yahoo Mail and Gmail but you do not use Apple's Mail you need to do the following:
    1 - Post in Yahoo's Mail forums and/or contact their tech support.
    2 - Post in Gmails forums and/or contact their tech support.
    Neither of the above are Apple's products.

  • How to block user create personal view and select ALL VIEW?

    How to block user create personal view and select ALL VIEW?

    Hello,
    >create personal view
    To restrict creating personal view, you need to modify your existing permission level or create new one. Login with admin account to your site and open role.aspx page (http://siteurl/_layouts/role.aspx). Then click on existing permission or add new permission
    level-->and move to "Personal Permissions" section-->uncheck "Manage Personal Views - Create, change, and delete personal views of lists" option. Later you can assign this permission to all users, whom you don't want
    to allow to create.
    >and select ALL VIEW
    Since SP does not supports view level permission directly so you have to use custom solution or use below designer solution to restrict user to open any view.
    http://www.codeproject.com/Articles/433486/How-to-set-view-level-permissions-out-of-the-box-i
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • I created folders in iphoto on my imac, synch using itunes and selected all photos from iphoto but those albums don't show up...most my albums do but a few don't!??

    I have a new iMac and I'm a new mac user....I have an iphone5..and ipad2.
    I have created folders on the imac in iphoto.
    I am synching the ipad and iphone with mac using itunes...selecting all photos, 3,500+ and although all the pictures may be sharing on all devices, the folders aren't.
    I have created several folders and copied pictures into those folders and they look fine while in iphoto....but I can't get the to synch into ipad and iphone using itunes.

    Folders in iPhoto do not contain photos. Albums and Events do. Folders can contain albums, but not photos on their own.
    So, do you mean Albums?

  • Where did edit and select all go?

    Where in the new Itunes format can I click on edit then click select all cause I need to add more then one song to my playlist at a time if not it gonna take forever.

    Are you referring to iPhoto or iMovie?  If it's iPhoto then what version of iPhoto are you running?  Have you updated to iPhoto 9.5? If so what version did you have previously?
    As a first attempt try the following:
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - Run Option #4, Rebuild Database, followed by Option #1 if needed.
    Can't help you with iMovie.
    OT

  • How do I set focus to the Browser so I can CmdKey-A and select all?

    I've searched the shortcut list for about 10 minutes and cannot find a shortcut to shift focus to the browser (by default the right-side) preferably the lower film-strip/list pane where pressing Cmd-A selects all the photos.
    Note, that if you select an album and hit Cmd-A it doesn't select all the photos in the album - if that worked I wouldn't need to set focus to the film-strip/list pane.
    There's only 1 keyboard shortcut in the "Aperture 3 Keyboard Shortcuts" guide with the word "Focus", and it's not the one I need.

    Put it this way.
    1. Select an Album
    2. Now, you want to select all photos in that album, hit Cmd-A
    You can't do (2) until I manually click in the film-strip pane.
    I want to hit 1 key, to put me in a position to select all photos immediately.
    This would also allow me to navigate using the arrow keys.
    I'm not sure I really understand how anyone would not need this.
    You click an album, you want to navigate through them (without using the mouse) ... doesn't everyone need to do this somehow?
    ** I just realized while experimenting that hitting the arrow-key actually gives focus to the film-strip in a way that allows me to hit Cmd-A.
    So it looks like the answer is to
    1. Select the Album
    2. Hit any arrow key (sometimes it already has focus, depending on what you were doing in this album last time, by the look of it)
    3. Cmd-A now works.

  • USING NULL AND SELECT ALL IN DECODE

    COL1 has the following values:
    COL1
    ====
    A
    B
    C
    A
    B
    C
    A
    D
    D
    SELECT COL1 FROM TABLE1 WHERE COL1 =
    DECODE(:VAL1, 'A', 'AA', 'B', 'BB', 'C', 'CC', 'D', 'DD')
    1. what about the null values ? how can I add to the above statements when I enter null for the parameter :VAL1
    2. what about all the values in COL1, what shall I enter for :VAL1 ?
    THANKS.

    SELECT COL1 FROM TABLE1
    WHERE nvl(COL1,0) = DECODE(:VAL1, 'A', 'AA', 'B', 'BB', 'C', 'CC', 'D', 'DD',null,0)
    Can we use in this way?
    Shishu Paul
    Chandigarh-India

  • I need to pick in bulk and select all the lines of the orders each order alone

    I have 100 sales order
    I need to pick in bulk in one LPN or without LPN for the 100 sale order
    at staging I need to separate them by orders
    I need to pack each order alone
    the prder may have different item
    when I finish the first order I will continue the second

    Hello Alemand,
    Can you please answer this question so I understand better.
    1. If you want to ship the orders separately as individual deliveries then why are you trying to bulk pick?
    Knowing your operational need would help better direct you.
    Thanks
    Ash

  • Select All in Discoverer

    I have several reports that have conditions applied. Most of the time, the conditions are used, but how would someone disregard the condition and select all?

    Hi,
    There are a number of different ways of doing this. You could change your condition to use LIKE. Then the use can enter % as the community id and select all community ids.
    You could use a dummy value for the community id, e.g. ALL and then change the condition to be community id = DECODE(:communitry id, 'ALL',:community id) OR community id = :community id. Then when the user enters ALL as the community id then all community ids are selected.
    You may need to change the definition of your list of values so that ALL or % is included.
    Hope that helps,
    Rod West

  • Select all in email

    I'm a new iMAC owner and how do I use the mouse to select all in email? What I want to do is delete all the emails in my trash. On a PC I can right click and select all would appear. On my iMacI know I can use cmdA or move the cursor to edit on the task bar at the top and click select there. Both these solutions are combersome. Further, can I right click in text to get to select all?
    Thanks,
    Mr. Allen

    You can arrange to have the Trash mailbox emptied on a regular schedule. Open Mail preferences, click on the Accounts icon in the toolbar. Select your account. Click on the Mailbox Behaviors tab. You can configure the Trash mailbox to be emptied regularly by selecting an option from the drop down menu.

  • How to select all (dots) in a scatter plot matrix?

    I have a scatter plot matrix, and I'm manually changing the color of each trend line, which probably isn't the best way but it's an easy but time consuming way to do it. I can't feasibly change the color/stroke of every single scatter plot dot in every single scatter plot graph of the matrix. I'm trying various Select --> Same or Select --> All but it keeps trying to change everything, from the line to the border to the dots. I am not sure if I can group the dots and select all or something. Is there a way to select all of the dots and just the dots?

    I feel like I should have posted screenshots of my graphs for all of my questions. In any event I've been manually changing the colors of the lines and the dots (see the few graphs on the left, I highlighted the inside of the graph and changed the dots and the line and then just manually changed the line back)

  • I updated to the new 5.0 and lost all of my photos and some of my apps. how can i get them back

    lost my pictures and some apps with update. how can iget them back?

    Sync with iTunes to recover these things.
    Connect the iPad to your compter and launch iTunes. Select the iPad on the left side of iTunes and then click on the Apps tab. Go down through the list and select all of the apps that you want to put on the iPad. Do the same thing with the photos. Make sure that the headings - Sync Music and Sync Photos have been selected and then sync again.
    If you have changed the configuration - you will have to click on Apply in the lower right corner of iTunes.

  • Select all mail at a time

    I have so many mails a day and I'd like to read and delete them selectively.
    News letters from shopping mall sites, business mails from partners, customer's feedback mails and notification mails from SNS .....
    After reading some interesting mail, there's mails I don't want to open for today.
    I mean it's NOT that I stop subscription, just wanna delete for now.
    But, there's no "Select all" button in Mail List and I cannot select mails to be removed all at a time.
    So, the Mail app force me to tap each mails that I don't need to touch (one at a time... one at a time)
    Given that you've got mails too lot a day, the number of times you have to tap would really mass up your day life!
    To delete all, We should go to trash box and tap 'delete all'
    but before we move each mail we need select all button.
    it's deferent delete all and select all. delete all button is enough and useful for now in trash box. I think select all button in Mail Inbox(List) is urgent issue.
    from a user in South Korea

    Apple doesn't read these forums, but you can give them your suggestions here:
    http://www.apple.com/feedback/iphone.html.

  • Function Module to select all entries in  ALV output

    Hi,
      I have an ALV report and Select ALL and Deselect ALL Buttons added to it .
      When the Select ALL button is pressed,all entries of the ALV report should be selected.
      When the Deselect ALL button is pressed,all entries of the ALV report should be deselected.
      Is there any function module to select all entries of the output and vice versa.
      Thanks in advance.
    Regards,
    Navas

    Hi Navas,
    I have written a part of the code you can use.
      TYPE-POOLS: slis.
      DATA : ls_event TYPE slis_alv_event.
    Set PF Status
      ls_event-name = slis_ev_pf_status_set .
      ls_event-form = slis_ev_pf_status_set .
      APPEND ls_event TO gt_event.
      CLEAR  ls_event.
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STATUS'.
    ENDFORM  .                 "set_pf_status
    (no need for any perform. This will be called automatically).
    While calling the FM for ALV, pass the internal table gt_event in it_events parameter.
    Double click on Z_STATUS and add two buttons in Application Toolbar.
    1. Select All - Give function code name as &ALL,
    2. Deselect All - Give function code name as &SAL.
    Hope this helps.
    Thanks,
    Dawood.
    Edited by: Dawood.S.Ghasletwala on Apr 3, 2009 3:51 PM

Maybe you are looking for