Double aggregation in a single query block doesn't make any sence.

How can I argue with something that apparently has been cast in stone by ANSI SQL committee? Well the answer is famous: "Search any park in any city: you'll find no statue of committee".
OK, why
select count(1) from (
select deptno from emp
group by deptno
is an easy to understand query, and why
select count(count(*)) from emp
group by deptno
is not? I already mentioned one reason why count shouldn't accept any arguments, therefore count(count(*)) is a nonsence.
The other reason is that aggregation without grouping is essentially aggregation within a single group. Once you realize that
select sum(1) from emp
is the same as
select sum(1) from emp
group by -1
(where -1 or any other constant for that matter is a dummy pseudocolumn), then it becomes obvious that what we are doing in the infamous
select count(count(*)) from emp
group by deptno
is a query with two blocks
select count(1) from (
select deptno from emp
group by deptno
) group by -1
We are not allowed to combine two "group by" into a single query, aren't we?

Aggregate function always goes together with grouping. Grouping can partition the set of rows into many classes or a single class. Therefore, if we have 2 nested aggregation functions, we'd better be able to identify the corresponding groupings easily:
select state, avg(min(tax_return)) from household
group by city, state then statewhich is a shorthand for
select state, avg(m) from (
   select city, state, min(tax_return) m
   from household
   group by city, state
) group by stateSpeaking of double aggregation, it is frequent in graph queries. The part explosion query is posted repeatedly virtually every month on this fine forum:-) The part explosion is double aggregation: multiply the quantities along each path in the assembly hierarchy. Then add the quantities along alternative paths. Likewise, finding a shortest path between two nodes in a graph is double aggregation query. First, we calculate the length buy adding the distances along each path, and then we choose a path with minimal length. Wouldn't it be nice to have this double aggregation wired into the connect by syntax? Note that connect_by_path is a surrogate aggregate which concatenates strings. People invent all kind of functions which parse this path and make other aggregates out of this value (such as sum and product).

Similar Messages

  • It doesn't make any sense (trouble adding new songs/podcasts)

    Hi all
    When I add new songs to my Ipod shuffle, some will play, some won't. When I try to add some podcasts, I can't add them directly by dragging and dropping, so I had to create a new playlist where I can add some new podcasts. And some will play, and some won't.
    By the way, I can't see a whole list of files "inside" the ipod. Instead, I see them in two separated screens.
    OS: Windows XP
    All podcasts and songs are ok, they can be listened to when played on iTunes
    Already changed options for podcasts, so they will play when playing in random order.
    iPod shows up in iTunes when pluged in
    Used apple stuff for some time now.
    I used a ipod shuffle 2nd gen for some time and no problem at all...
    thanks in advance.
    This whole things it has been doing my head in for the last two days...
    PS: And sometimes it only plays podcasts. And sometimes only music and no trace of podcasts. As I said... it doesn't make any sense...
    Message was edited by: MGLVGLM
    PS 2nd: Tried again, now with two podcasts (ok to play random) and one song. Only can listed to the song. No idea why it doesn't play the podcasts.
    Help anyone?
    Thanks again
    Message was edited by: MGLVGLM

    well, it seems that I have found the solution (i read somewhere, not already checked)
    Since ipod shuffle 3G, you have to add podcasts to a playing list, otherwise you can't listen to them.
    If I get it solved, I will write here for the next who doesn't receive much help from Apple and has to google the solution.

  • How to calculate multiple aggregation in a single query

    how to find firstname ,lastname for max and min salary from employees table group by department in a single query?
    Edited by: Gnanasekar on Jan 10, 2012 6:36 AM

    check this query
    select ENAME,SAL
    from EMP
    where SAL in(select max(SAL)
                       from EMP
                      group by DEPTNO)
    or SAL in(select min(SAL)
                 from EMP
                  group by DEPTNO)Hope this will help you..
    You should ask this question at sql/plsql forum
    If someone's response is helpful or correct, please mark it accordingly.

  • Why were the colour icons taken away from the finder and itunes sidebars and and replaced with grey monochrome shade icons. It doesn't make any sense.

    Why were the colour icons taken away from the finder and itunes sidebars and and replaced with grey monochrome shade icons.
    Have apple rectified this yet ?
    It doesn't make sense to me why they changed this. Can anyone tell me the reason for the lack of colour ?
    On another note, can the the sidebar be changed back to the right hand side in preview (when opening PDF's). It has always been on the right in snow leopard and tiger.
    It seems to me that their has been too many unnecessary changes in the Lion operating system.
    Thanks.

    babowa wrote:
    Why were the colour icons taken away from the finder and itunes sidebars and and replaced with grey monochrome shade icons.
    Have apple rectified this yet ?
    It doesn't make sense to me why they changed this. Can anyone tell me the reason for the lack of colour ?
    You'd have to ask Apple, no one here would know - we are just users like you and aren't allowed to speculate on these forums. You have quite a bit of company though - many people preferred the color.
    And, I've not found a way to put the sidebar back on the right side in Preview, but maybe someone else can chime in with that.
    I much prefer the sidebar a la sinistra

  • When I used to receive emails it would make a beep now it doesn't make any noise

    it will not even make the *whoosh* sound anymore.
    My volume is up
    I checked the mail settings and the sound were all on, then I checked the system prefreces in the sounds menu and that appeared to be fine
    Any suggestions?

    So you checked Mail Preferences and have a sound chosen in the "new messages sound"?
    When you check the Sound Preference Pane, did you also check the Output option: are the internal speakers chosen for the sound output?

  • Iphone 3Gs won't update i get an error message that says i am not connected to the internet. i HAVE TRIED ALL THE RECOMENDED TROUBLESHOOTING. ITUNES UPDATE WAS SUCCESSFUL AND I AM NOT HAVING ANY TROUBLE WITH THE ITUNES STORE. SO IT DOESN'T MAKE ANY SENSE

    When I go to sync my iphone 3gs itunes alerts me that an update is available. I check to download an update. I then receive an error message stating that I am not connected to the internet. I am 100% positive that I am connected and before this download I was instructed to update itunes which I did without any problems and restarted my computer. I have tried all of the troubleshooting suggestions. I have no problem syncing or using the itunes store. I just can't get the update. I also have no problems with my iphone connecting to a wireless internet connection. Please Help!!!!!!

    http://support.apple.com/kb/TS3694
    http://support.apple.com/kb/TS3125
    http://support.microsoft.com/kb/299357

  • HT201328 Want to go overseas and need my virgin mobile iPhone 5 unlocked so I can use it in europe.  Called VM and they said it can't be done.  That doesn't make any sense.. What can be done?

    Have Virgin Mobile iPhone 5 and they said it can't be unlocked.  Reason to get it unlocked is so I can use the phone when travelling in Europe.   This is crazy because I also payed for the phone in full...  Also, what happens if you move to a region in the U.S. and service is bad...Your stuck with an expensive brick.. Any way to get it unlocked?

    Not all carriers unlock their phones.  They are under no legal obligation to do so in many places.

  • Mos7720 driver doesn't make any /dev/parport devices

    I have mos7715 USB to 1 serial and 1 parallel port convertor. I only have /dev/ttyUSB0, but no /dev/parport0.
    Dmesg:
    usbserial: USB Serial Driver core
    USB Serial support registered for Moschip 2 port adapter
    mos7720: 2.1:Moschip USB Serial Driver
    moschip7720 2-6.2.2:1.0: Moschip 2 port adapter converter detected
    usb 2-6.2.2: Moschip 2 port adapter converter now attached to ttyUSB0
    usbcore: registered new interface driver moschip7720
    Kernel .config(default Arch kernel: 2.6.35-ARCH):
    CONFIG_USB_SERIAL_MOS7720=m
    CONFIG_USB_SERIAL_MOS7715_PARPORT=y
    Why don't I see any parallel port?
    Thanks in advance.

    itayf, It's not just you. kernel 2.6.17.5 is broken and gave me the same hal problems.
    In the meantime, try the beyond kernel.

  • My premiere elements and photoshop 13 won't pop up after I downloaded it. Nothing happens. Lol what's going on? Is it because my labtop needs a new battery? Doesn't make any sense....

    It won't pop up after I downloaded it. This is very annoying....

    Nobody can tell you anything without proper system info or other technical details.
    Mylenium

  • How do I get the download for for product if I'm unable to download because the download manager is corrupt and a reinstall as an administrator doesn't make any difference?

    I want to purchase the Creative Cloud suite but I get the following error when I try to download.
                                   Download Error
    Adobe Application Manager is corrupted and must be
    reinstalled. Download now, or contact customer support.
    I reinstalled as admin (3 time) but I get the same error.  I don't see an uninstall in the Control Panel for this program so I don't know what else to try.
    Thanks,
    Christi

    Christi what operating system are you using?  Have you utilized the steps listed in Error "Failed to Install" Creative Cloud Desktop application to reinstall the Creative Cloud Desktop application?

  • The t.v. show I'm trying to watch won't load. It doesn't make any sense because I can watch everything else.

    The T.V. show I'm trying to watch on my MACBOOK AIR won't load. I got it from the iTunes store last night. I'm not complaining that it's slow.It pauses halfway through when I try to watch it. And yet everything else has loaded. HELP!
    p.s. every thing before that episode is nice and black. So are the first 11 episodes. Everything after that is grayed out but I could still watch it. But why?

    If your apps are up-to-date then there is nothing to download to update...the app store is telling you there is nothing for you to download.
    Why do you want to update all of your apps?

  • EQ doesn't make any difference

    No matter what setting I put the eq on, every song sounds exactly the same. I have tried heaps of songs and evey eq setting and there is no difference. Is my iPod broken?

    I think I found the problem...
    My music collection is in MP3Pro format, which is 64 kbps but supposed to play at near 128 kbps MP3 equivalent (at half the size). But iPod does not support the "Pro" format, so it plays like a 64 kbps MP3.
    Another bad side effect is that it seems that the EQ does not work for this specific file format. I tried re-encoding a CD in various other formats, and the EQ definitely works in all the other formats, but NOT the MP3Pro version!!!
    So, now for 2 reasons MP3Pro on iPod is a bad idea!

  • Single Query suddenly goes slow until database restart or query change

    Hello all,
    Configuration I'm using is Oracle 10g EE 10.1.0.4.0 on Windows 2003 Server
    I have performance issue with one single query. The query is called using dbExpress from Delphi application.
    Since a month, almost every week this query starts going VERY slow. Usually it executes in a 0.5-1 second, but when it's slowed down, it takes approx. 4-5 minutes to execute.
    The query runs on a single table (~4 000 000 rows) and runs on primary index. The index itself consists of 5 fields - the query uses the first 4 of them. I know it's not a good design but restructuring the table/index is out of question, AFAIK.
    Until now, I figured out two ways to speed things up. The first and obvious is to restart the server or shut/start the database. It works. For a week. Then we're back at first square.
    The second way is some kind of a mystery to me: If I change the query a little bit, never mind how - for example, adding 'and (1=1)' in the clause, after deploying the application, it starts running fast. Again for a week or so.
    I've attached an jpeg showing the explain plans on slow and fast executing queries. They look almost the same.
    I'm running out of ideas for now. It's very annoying (and unsafe) to restart the machine on a week basis. Thus any help is greatly appreciated.
    Things I've done so far:
    - installed last service packs from Oracle and Microsoft.
    - tried different versions of dbexpora.dll.
    - Regularly gathered and estimated statistics and analyzings.
    - Made sure that the server is not under heavy load (antiviruses, firewalls, archive loggers are stopped or uninstalled for a while).
    - made sure that there is enough free space on hard disks.
    - the disk array itself is in good health - defragmented, HDD tools doesn't find anything suspicious.
    Final thoughts: Maybe the sql cache is going overloaded and someway stops executing the query. That's why when I restart the machine or change the query clause insignificantly, it starts running fast. I took a peek on v$sql and v$sqlarea but there is nothing special, and honestly, I'm not very familiar reading the values in this view - I'm just comparing the values returned by this query with the others - they look similar.
    Anyway, if someone could help, it would be great.
    Regards,
    Ivan
    Screenshots showing the explain plans for slow and fast query:
    Image: !http://img254.imageshack.us/img254/6674/queryr.jpg!

    Sorry for the incomplete information. I tried to gather the mentioned in your second link additional data. Unfortunately, I cannot find the TKPROF utility - it's not in the bin directory, neither in any other folder. Guess it's not installed at all.
    About rewriting the query, suggested in the first link you gave: it's so simple and clear that it should not be rewriten. As I mentioned before, every time I change the query even a little bit, it starts running well for a couple of days.
    Anyway, here are the stats I've just gathered. Unfortunately, now the query performs well and I'm not able to give you stats, showing the slowed down query.
    These are the parameters relevant to the optimizer:
    SQL> show parameter optimizer
    NAME TYPE VALUE
    optimizer_dynamic_sampling integer 2
    optimizer_features_enable string 10.1.0.4
    optimizer_index_caching integer 0
    optimizer_index_cost_adj integer 100
    optimizer_mode string ALL_ROWS
    SQL> show parameter db_file_multi
    NAME TYPE VALUE
    db_file_multiblock_read_count integer 32
    SQL> show parameter db_block_size
    NAME TYPE VALUE
    db_block_size integer 8192
    SQL> show parameter cursor_sharing
    NAME TYPE VALUE
    cursor_sharing string EXACT
    Screenshots of explain plan is posted in my first post - both for fast and slow executed query.
    output of SQL_Plus AUTOTRACE including the TIMING information:
    SQL> set autotrace traceonly arraysize 1000
    SQL> SELECT * FROM "AOPERITEM"
    WHERE (FOPER = 201)
    AND (FCLIENT = 1)
    AND (FDATEOPER = '2009-10-28')
    AND (FNUMOPER = 95532)
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 1 | 132 | 5 (0)|
    | 1 | TABLE ACCESS BY INDEX ROWID| AOPERITEM | 1 | 132 | 5 (0)|
    | 2 | INDEX RANGE SCAN | AOPERITEM_IDX | 1 | | 4 (0)|
    Note
    - 'PLAN_TABLE' is old version
    Statistics
    1 recursive calls
    0 db block gets
    9 consistent gets
    0 physical reads
    0 redo size
    3098 bytes sent via SQL*Net to client
    369 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    4 rows processed
    The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> select /*+ gather_plan_statistics */
    * FROM "AOPERITEM"
    WHERE (FOPER = 201)
    AND (FCLIENT = 1)
    AND (FDATEOPER = '2009-10-28')
    AND (FNUMOPER = 95532)
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 1 | 132 | 5 (0)|
    | 1 | TABLE ACCESS BY INDEX ROWID| AOPERITEM | 1 | 132 | 5 (0)|
    | 2 | INDEX RANGE SCAN | AOPERITEM_IDX | 1 | | 4 (0)|
    Note
    - 'PLAN_TABLE' is old version
    Statistics
    0 recursive calls
    0 db block gets
    9 consistent gets
    4 physical reads
    0 redo size
    2937 bytes sent via SQL*Net to client
    369 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    4 rows processed
    PS: I'm not a DBA myself, I'm just trying to find a solution to this problem.
    Thanks in advance.

  • 'dbms_xplan.display_awr' is showing two plan for single query

    Hi,
    I am trying to fetch sql plan from awr, but it's showing two different plans for a single query:
    PLAN_TABLE_OUTPUT
    SQL_ID 2pxv33cr271sb
    SELECT P_DEP_BNK_CODE,P_DEP_BRN_CODE,P_DEP_DATE,
                                   P_DEP_DAY_SL,P_DEP_INST_SL,P_INST_AMT                                       
                             FROM P WHERE
                                        P_DEP_BNK_CODE = :1 AND
                                    P_DEP_BRN_CODE = :2 AND
                                P_DEP_DATE     = :3 AND
                            P_DEP_LCC_UCC  = :4 AND
                        P_DEP_DAY_SL   = :5 AND
                    (P_REALISED_ON IS NULL AND
                    P_RTN_DATE IS NULL)
    Plan hash value: 3064382432
    | Id  | Operation                          | Name      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                   |           |       |       |     5 (100)|          |       |       |
    |   1 |  TABLE ACCESS BY GLOBAL INDEX ROWID| P         |     1 |    40 |     5   (0)| 00:00:01 | ROWID | ROWID |
    |   2 |   INDEX RANGE SCAN                 | P_PK      |     1 |       |     4   (0)| 00:00:01 |       |       |
    Note
       - dynamic sampling used for this statement (level=5)
    SQL_ID 2pxv33cr271sb
    SELECT P_DEP_BNK_CODE,P_DEP_BRN_CODE,P_DEP_DATE,
                                   P_DEP_DAY_SL,P_DEP_INST_SL,P_INST_AMT                                       
                             FROM P WHERE
                                        P_DEP_BNK_CODE = :1 AND
                                    P_DEP_BRN_CODE = :2 AND
                                P_DEP_DATE     = :3 AND
                            P_DEP_LCC_UCC  = :4 AND
                        P_DEP_DAY_SL   = :5 AND
                    (P_REALISED_ON IS NULL AND
                    P_RTN_DATE IS NULL)
    Plan hash value: 3447007225
    | Id  | Operation            | Name     | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT     |          |       |       |     7 (100)|          |       |       |        |      |            |
    |   1 |  PX COORDINATOR      |          |       |       |            |          |       |       |        |      |            |
    |   2 |   PX SEND QC (RANDOM)| :TQ10000 |     1 |    38 |     7  (43)| 00:00:01 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |   3 |    PX BLOCK ITERATOR |          |     1 |    38 |     7  (43)| 00:00:01 |   KEY |   KEY |  Q1,00 | PCWC |            |
    |   4 |     TABLE ACCESS FULL| P        |     1 |    38 |     7  (43)| 00:00:01 |   KEY |   KEY |  Q1,00 | PCWP |            |
    ------------------------------------------------------------------------------------------------------------------------------The database version is 11.2.0.1 and the underlying table is partitioned. Why this is showing two plans? Although the plan doesn't look expensive but this is causing maximum gets and enq: row lock contention
    Regards,
    Regards

    SQL> set autot on
    SQL> SELECT
      2  SUM(NVL(P_INST_AMT, 0))
      3  FROM
      4  AXISCMS.P
      5  WHERE
      6  P_DEP_BNK_CODE = '211'
      7  AND
      8  P_DEP_BRN_CODE = '005'
      9  AND
    10  P_DEP_DATE = to_date('11-NOV-2010')
    11  AND
    12  P_DEP_LCC_UCC = 'L'
    13  AND
    P_DEP_DAY_SL = 15001
    14   15  AND
    16  (P_REALISED_ON IS NOT NULL OR P_RTN_DATE IS NOT NULL );
    SUM(NVL(P_INST_AMT,0))
    Execution Plan
    | Id  | Operation                           | Name      | Rows  | Bytes | Cost  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                    |           |     1 |    38 |     8 |       |       |
    |   1 |  SORT AGGREGATE                     |           |     1 |    38 |       |       |       |
    |   2 |   TABLE ACCESS BY GLOBAL INDEX ROWID| P          |     1 |    38 |     8 |    72 |    72 |
    |   3 |    INDEX RANGE SCAN                 | P_PK      |     1 |       |     4 |       |       |
    Note
       - 'PLAN_TABLE' is old version
    Statistics
              5  recursive calls
              0  db block gets
            370  consistent gets
             31  physical reads
              0  redo size
            543  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedThe above query seems to be having cheapest cost but causing a lot of slowness in the database.
    Column Description:
    COLUMN_NAME                    DATA_TYPE                      NUM_DISTINCT  NUM_NULLS    DENSITY HISTOGRAM
    P_AC_NAME                 VARCHAR2                             244672   49251591 4.0871E-06 NONE
    P_AC_NO                   VARCHAR2                             413792   48713721 2.4167E-06 NONE
    P_ARNGMNT_CREDIT_DATE     DATE                                   1708   39366743 .001724138 HEIGHT BALANCED
    P_AUTOLIQ_ACT_DATE        DATE                                    358   50356077 .003003003 HEIGHT BALANCED
    P_AUTOLIQ_DUE_DATE        DATE                                    337   50427426 .002967359 NONE
    P_AUTOLIQ_FLAG            CHAR                                      1   44746714          1 NONE
    P_CLG_DNLD_FLAG           NUMBER                                    1   50481119 .035714286 FREQUENCY
    P_CORR_BANK_REAL_DATE     DATE                                      0   50481133          0 NONE
    P_DEP_BNK_CODE            VARCHAR2                                 16          0 9.9454E-09 FREQUENCY
    P_DEP_BRN_CODE            VARCHAR2                                671          0 .002531646 HEIGHT BALANCEDIndex Details
    INDEX_NAME                     COLUMN_NAME                    COLUMN_POSITION
        P_IDX_FULL                P_INST_NO                               1
        P_IDX_FULL                P_DRAWN_ON_BANK                         2
        P_IDX_FULL                P_DRAWN_ON_BRN                          3
        P_IDX_FULL                P_INST_TYPE                             4
        P_IDX_FULL                P_DRAWN_ON_LOC                          5
        P_IDX_FULL                P_RTN_DATE                              6
        P_INDX1                   P_INST_NO                               1
        P_INDX2                   P_RTN_DATE                              1
        P_INDX2                   P_RTN_DAY_SL                            2
        P_INDX2                   P_RTN_INS_SL                            3
        P_INDX3                   P_REALISED_ON                           1
        P_INDX3                   P_REALISED_DAY_SL                       2
        P_INDX3                   P_REALISED_INS_SL                       3
        P_INDX4                   P_REV_TO_COL_DUE_DATE                   1
        P_INDX4                   P_REV_TO_COL_DONE_ON                    2
        P_INDX5                   P_ARNGMNT_CREDIT_DATE                   1
        P_INDX6                   P_POOL_POST_DATE                        1
        P_INDX6                   P_POOL_POST_DAYSL                       2
        P_PK                      P_DEP_BNK_CODE                          1
        P_PK                      P_DEP_BRN_CODE                          2
        P_PK                      P_DEP_DATE                              3
        P_PK                      P_DEP_LCC_UCC                           4
        P_PK                      P_DEP_DAY_SL                            5
        P_PK                      P_DEP_INST_SL                           6
    Top 5 Timed Foreground Events
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                               Avg
                                                              wait   % DB
    Event                                 Waits     Time(s)   (ms)   time Wait Class
    DB CPU                                           58,454          13.1
    enq: TX - row lock contention         1,095      17,691  16156    4.0 Applicatio
    read by other session             1,719,661      11,392      7    2.6 User I/O
    latch: cache buffers chains         264,753      10,758     41    2.4 Concurrenc
    latch free                           78,456       8,215    105    1.8 Other
    The query comes on top in every section in AWR.Regards,

  • SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row

    I have a region with the following type:
    SQL Query (PL/SQL Function Body returning SQL query).
    In a search screen the users can enter different numbers, separated by an ENTER.
    I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
    It's something like this:
    If (:P30_POD Is Not Null) Then
    v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
    v_condition := ' AND ';
    End If;
    But the query doesn't return any rows.
    I tried to reproduce it in Toad:
    select * from asx_worklistitem
    where
    POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    ==> This is the query that does't return any rows
    select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    from dual;
    ==> This returns '541449200000171813','541449206006341366'
    select * from asx_worklistitem
    where pod in ('541449200000171813','541449206006341366');
    ==> and when I copy/paste this in the above query, it does return my rows.
    So why does my first query doesn't work?
    Doe anyone have any idea?
    Kind regards,
    Geert
    Message was edited by:
    Zorry

    Thanks for the help.
    I made it work, but via the following code:
    If (:P30_POD Is Not Null) Then
    v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
    v_where := v_where || v_condition || 'POD IN (';
    v_counter := 1;
    WHILE (v_counter < LENGTH(v_pods)) LOOP
    v_pod := SUBSTR(v_pods, v_counter, 18);
    IF (v_counter <> 1) THEN
    v_where := v_where || ',';
    END IF;
    v_where := v_where || '''' || v_pod || '''';
    v_counter := v_counter + 18;
    END LOOP;
    v_where := v_where || ')';
    v_condition := ' AND ';
    End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
    For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
    Because I think this will have a lot of overhead.
    I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible?

Maybe you are looking for