Single Query for getting total no of records N getting records from a selected range

Hi,
Got the below query:
SELECT a.*, rowid FROM (SELECT name, postcode FROM Tbl ORDER BY name asc)a WHERE ROWNUM <=30
MINUS
SELECT b.*, rowid FROM (SELECT name, postcode FROM Tbl ORDER BY name asc) b WHERE ROWNUM <= 10
Though I got the results right, I also want to know the total no of records from "SELECT name, postcode FROM Tbl ORDER BY name asc". Does anyone knows how to do it in a single query?
Thanks.

hi Carol
The following output may help you.
SQL> l
1 select * from emp where (rowid,0) in (select rowid,mod(rownum,10)-rownum from emp)
2 minus
3* select * from emp where (rowid,0) in (select rowid,mod(rownum,6)-rownum from emp)
SQL> /
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
The above query fetches the 6,7,8,9th records only.
Well my suggestion would be not to use ROWNUM directly in where clause since it changes dynamically. it is not a fixed value. for example pls see the result.
SQL> select rownum,empno,ename,sal,job from emp where sal > 3000;
ROWNUM EMPNO ENAME SAL JOB
1 7839 KING 5000 PRESIDENT
SQL> select rownum,empno,ename,sal,job from emp where sal > 1000;
ROWNUM EMPNO ENAME SAL JOB
1 7566 JONES 2975 MANAGER
2 7654 MARTIN 1250 SALESMAN
3 7698 BLAKE 2850 MANAGER
4 7782 CLARK 2450 MANAGER
5 7788 SCOTT 3000 ANALYST
6 7839 KING 5000 PRESIDENT
7 7844 TURNER 1500 SALESMAN
8 7876 ADAMS 1100 CLERK
9 7902 FORD 3000 ANALYST
10 7934 MILLER 1300 CLERK
10 rows selected.
SQL> select * from emp where rownum = 1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
The record of employee KING is getting the rownum differently.
My understanding (out of my little knowledge) is the rownum values are assigned to the records only after the records are read physically and after applying the conditions(without rownum). Then the row numbers (rownum) is assigned to the records. Hence the rownum is not constant to a record since it is a dynamic value.
Well i would like to know the suggestions of the ORACLE EXPERTS here in the discussion forum.
If my finding is correct then OK if not Pls excuse me and pls give the correct solution
Regards
Prakash Eranki
[email protected]

Similar Messages

  • Single query for querying three tables

    Hi All,
    We are trying to construct a sql query(a single query), which can perform the below functionality.
    Assume, that there are three tables,
    TABLE1: 3 Columns
    1) ID -> PRIMARY KEY
    2) TYPE -> Allows only values 'A' or 'B'
    3) REF_ID(this can refer to TABLE2(ID) or TABLE3(ID)).
    TABLE2: 2 Columns
    1) ID -> PRIMARY KEY
    2) DETAILS -> Any normal text
    TABLE3: 2 Columns
    1) ID -> PRIMARY KEY
    2) DETAILS -> Any normal text
    We need to come up with a query that, given TABLE1's(ID), we need to fetch the corresponding record in TABLE1, and we need to fetch the corresponding record from TABLE2 or TABLE3, depending on the below conditions.
    If the TYPE for the TABLE1's(ID) is 'A'
    Then get the details from TABLE2's by mapping TABLE1.REF_ID = TABLE2.ID
    If the TYPE for the TABLE1's(ID) is 'B'
    Then get the details from TABLE3's by mapping TABLE1.REF_ID = TABLE3.ID
    We need to accomplish all these tasks in a single query.
    Thanks for your kindly help,
    Sreenivasan

    SQL> select * from test_qry1;
    ID T REF_ID
    1 A 100
    2 A 200
    3 B 300
    SQL> select * from test_qry2;
    ID DETAILS
    100 Human Resources
    200 It Services
    300 Relationships
    SQL> select * from test_qry3;
    ID DETAILS
    100 Human Beings
    200 Conference
    300 Used things
    SQL> SELECT t1.ID,
    DECODE(t1.type,'A',( SELECT t2.details FROM test_qry2 t2 WHERE t1.ref_id = t2.id
    'B',( SELECT t3.details FROM test_qry3 t3 WHERE t1.ref_id = t3.id
    ) details
    FROM test_qry1 t1;
    ID DETAILS
    1 Human Resource
    2 It Services
    3 Used things
    Try with this query.
    Thanks,
    Vissu......

  • Help in the query for sub total.

    hi friends.
           i have a query display below output.
          but i wanted to get sub total of each repeated records,.
    Output is like below.  
    Segment
    Units
    Total items
    CRE
    CRE - MUMBAI
    3
    CTA
    CTA - CHENNAI
    13
    CTA
    CTA - DELHI
    37
    CTA
    CTA - HYDERABAD
    10
    CTA
    CTA - KOLKATTA
    22
    CTA
    CTA - MUMBAI
    110
    Now i need to show like below.  if you see the sub total in bold.
    Segment
    Units
    Total items
    CRE
    CRE - MUMBAI
    3
    CRE
    Sub Total
    3
    CTA
    CTA - CHENNAI
    13
    CTA
    CTA - DELHI
    37
    CTA
    CTA - HYDERABAD
    10
    CTA
    CTA - KOLKATTA
    22
    CTA
    CTA - MUMBAI
    110
    CTA
    Sub Total
    192
    please help.

    with
    the_data as
    (select 'CRE' segment,'CRE - MUMBAI' units,3 total_items from dual union all
    select 'CTA','CTA - CHENNAI',13 from dual union all
    select 'CTA','CTA - DELHI',37 from dual union all
    select 'CTA','CTA - HYDERABAD',10 from dual union all
    select 'CTA','CTA - KOLKATTA',22 from dual union all
    select 'CTA','CTA - MUMBAI',110 from dual
    select segment,
           case grouping_id(segment,units) when 0
                                           then units
                                           when 1
                                           then 'Sub total'
                                           else 'Grand total'
           end units,
           sum(total_items) total_items
      from the_data
    group by rollup(segment,units)
    SEGMENT
    UNITS
    TOTAL_ITEMS
    CRE
    CRE - MUMBAI
    3
    CRE
    Sub total
    3
    CTA
    CTA - DELHI
    37
    CTA
    CTA - MUMBAI
    110
    CTA
    CTA - CHENNAI
    13
    CTA
    CTA - KOLKATTA
    22
    CTA
    CTA - HYDERABAD
    10
    CTA
    Sub total
    192
    Grand total
    195
    Regards
    Etbin

  • Query for PO total group by Supplier

    Hi All,
    Does any 1 have query which gives the total of PO's for a supplier? and that to top 10 suppliers?
    For example there are 100 PO's for Supplier 'A'.
    I need total of al 100 PO's for Supplier 'A'.
    Also is there iny report which gives for top 10 suppliers.
    Thanks in Advance,
    SYR

    Here are some pointers so you can write your own query.
    Start with po_vendors to get vendor_id for your vendor.
    Join with po_headers_all to get po's for that vendor. Focus on standard pos only.
    Join with po_lines_all to get price and quantity for those po.
    Sum up the price*quantity to get total.
    Do you have blanket Purchase orders? If yes, then you will have to include po_releases_all.
    Hope this helps,
    Sandeep Gandhi

  • SIngle query for table Update

    In a procedure I have a CURSOR FOR_LOOP
      FOR CUR_CONTO in
         (SELECT TO_NUMBER(lpad(nvl(ltrim(K_DRG),'0'),3,'0')   ) K_DRG,
             CASE
            WHEN K_MDC  = 'NA' THEN 0
             WHEN K_MDC <> 'NA' THEN TO_NUMBER( lpad(nvl(ltrim(K_MDC),'0'),2,'0')   )
             END K_MDC,
                     TO_NUMBER(substr(PAZIENTE,     instr(PAZIENTE,'@')+1, 4) ) KCODET, 
                     substr(PAZIENTE,     instr(PAZIENTE,'@')+5, 1)           TIPORDT,  
                     TO_NUMBER(SUBSTR(N_CCLINICA,1,4) )                      ANNOT
                FROM table_g)
         LOOP
         UPDATE table_dm SET K_DRG = CUR_CONTO.K_DRG , K_MDC = NVL(CUR_CONTO.K_MDC,0)
                        WHERE  K_CODE  = CUR_CONTO.KCODET
                        AND    TIPORD  = CUR_CONTO.TIPORDT
                        AND    ANNO    = CUR_CONTO.ANNOT ;
         end  LOOP;
      I want change it in a single query, how can I do?
    I write
    UPDATE table_dm SET K_DRG , K_MDC =
        (SELECT     TO_NUMBER(lpad(nvl(ltrim(K_DRG),'0'),3,'0')   ) K_DRG,
             CASE
            WHEN K_MDC  = 'NA' THEN 0
             WHEN K_MDC <> 'NA' THEN TO_NUMBER( lpad(nvl(ltrim(K_MDC),'0'),2,'0')   )
             END K_MDC FROM table_g )
                but I don't know how insert in the where the variable KCODET, TIPORDT ,ANNOT get from table table_g
    WHERE K_CODE = CUR_CONTO.KCODET
    AND TIPORD = CUR_CONTO.TIPORDT
    AND ANNO = CUR_CONTO.ANNOT ;
    And How can I lock table_dm because it has some trigger in updating?
    Thanks in advance

    It should be something like this
    UPDATE table_dm dm
        SET (K_DRG, K_MDC) = (
                    SELECT k_drg, NVL(k_mdc,0)
                      FROM (SELECT TO_NUMBER(lpad(nvl(ltrim(K_DRG),'0'),3,'0')   ) k_drg,
                             CASE
                                  WHEN k_mdc  =  'NA' THEN 0
                                  WHEN k_mdc  != 'NA' THEN TO_NUMBER( lpad(nvl(ltrim(k_mdc),'0'),2,'0'))
                             END k_mdc,
                             TO_NUMBER(substr(paziente, instr(paziente,'@')+1, 4)) kcodet, 
                             substr(paziente, instr(paziente,'@')+5, 1) tipordt,  
                             TO_NUMBER(SUBSTR(n_cclinica,1,4)) annot
                           FROM table_g) t
                     WHERE t.kcodet  = dm.k_code
                       AND t.tipordt = dm.tipord
                       AND t.annot   = dm.annot
      WHERE EXISTS (
               SELECT null
                 FROM (SELECT TO_NUMBER(lpad(nvl(ltrim(K_DRG),'0'),3,'0')   ) k_drg,
                        CASE
                             WHEN k_mdc  =  'NA' THEN 0
                             WHEN k_mdc  != 'NA' THEN TO_NUMBER( lpad(nvl(ltrim(k_mdc),'0'),2,'0'))
                        END k_mdc,
                        TO_NUMBER(substr(paziente, instr(paziente,'@')+1, 4)) kcodet, 
                        substr(paziente, instr(paziente,'@')+5, 1) tipordt,  
                        TO_NUMBER(SUBSTR(n_cclinica,1,4)) annot
                      FROM table_g) t
                WHERE t.kcodet  = dm.k_code
                  AND t.tipordt = dm.tipord
                  AND t.annot   = dm.annot
                )Note: Code not tested

  • Need Help To Create a Single  Query For it

    I am Making an Oracle Report
    Which Include 4 Formulae Columns,Each of Them Represent
    1) Qty_inWarehouse(Whose Location_code=1)
    2) Value_inWarehouse(cost_price*qty)
    3) Qty_inlocation(This will Populate Based On Used Entered Value,Means the user will enter a particular Location,Location_code is other than 1)
    4) Value_inlocaiton
    Now All these Values are Coming From Inv_stores Tables.If I use Formula for each Column Then I have to Select This
    Table 4 Times(inv_stores)
    The Structure Of Inv_stores Table is
    location_code Varcha2(3), pk
    Department_Code Varchar2(2), pk
    Product_code Varchar2(15), pk
    Qty_instock Number(6)
    I have Written Query Like This
    In This Query i Have Directly used Location_code as '1' and Another Location as '22' (Which is of One Showroom) and Tried By Testing With Department No.'10'.It is Selecting Cost Price from inv_product Table.
    Now This inv_product is Product MAster Table.Each Product is uniquely identified by Department_code and
    Product_code in this table.
    Now in this Query i Want The Value per department Wise....
    Select A.department_code,Sum(Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))
    STK_QTY_INLOC,
    Sum((Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))) STK_VALUE_INLOC,
    SUM(nvl(inv_product.qty_backorder,0)) as Qty_BO,
    Sum(Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0)) STK_QTY_INWH,
    Sum((Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0))*nvl(inv_product.cost_pricekd,0)) STK_VALUE_INWH
    from inv_stores A,inv_product,inv_stores B
    where B.location_code(+) = '1' and
    B.Department_Code(+) = '10' and
    A.department_code = B.department_code(+) and
    A.product_code = B.product_code(+) and
    A.location_code = '22' and
    inv_product.department_code = A.department_code and
    inv_product.product_code = A.product_code
    Group By A.department_code
    But it is Giving Useless Results
    now The 4 Diffrent Queries Which i am Uising is This
    This Will Give me Stock quantity in Location
    Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
    into var_qty
    from inv_stores
    where department_Code = :department_code and
    location_code = :location_code;
    This will Give me Value For That Location
    Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
    nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
    into var_stk_value
    from inv_stores,inv_product
    where inv_stores.department_Code = :department_code and
    inv_stores.location_code = :location_code and
    inv_product.department_code = inv_stores.department_Code and
    inv_product.product_code = inv_stores.product_code;
    This Will Give me Qty in W/H
    Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
    into var_qty
    from inv_stores
    where department_Code = :department_code and
    location_code = '1';
    This Will Give me Value in W/H
    Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
    nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
    into var_stk_value
    from inv_stores,inv_product
    where inv_stores.department_Code = :department_code and
    inv_stores.location_code = '1' and
    inv_product.department_code = inv_stores.department_Code and
    inv_product.product_code = inv_stores.product_code;
    These 4 Queries is Selecting Data from inv_stores Table,I want to Combine Them Into One........
    Suppose if we take for location 22 whose name is 'SHL'(It is s showroom)
    Sample Data Will Be Something Like
    Dept W/H(qty) W/h(Value) SHL(qty) SHL(Value)
    00 3 90 1 30
    10 0 0 2 50
    12 5 100 1 20

    This forum is for issues with the SQL Developer tool. You'd get more response in the SQL And PL/SQL forum (where you cross-posted already).
    Regards,
    K.

  • How can I update the table with a single query for...

    I have a table with columns C1 and C2.
    C1 C2
    A1 null
    A1 null
    A1 null
    A1 null
    A2 null
    A2 null
    A2 null
    A3 null
    A4 null
    A4 null
    I want to update my table with a single query so that I would have data like
    C1 C2
    A1 1
    A1 2
    A1 3
    A1 4
    A2 1
    A2 2
    A2 3
    A3 1
    A4 1
    A4 2
    The updated column C2 has the values like serial no grouped on the column C1.

    SQL> create table mytable
      2  ( c1 varchar2(2)
      3  , c2 number(2)
      4  )
      5  /
    Tabel is aangemaakt.
    SQL> insert into mytable (c1)
      2  select 'A1' from dual union all
      3  select 'A1' from dual union all
      4  select 'A1' from dual union all
      5  select 'A1' from dual union all
      6  select 'A2' from dual union all
      7  select 'A2' from dual union all
      8  select 'A2' from dual union all
      9  select 'A3' from dual union all
    10  select 'A4' from dual union all
    11  select 'A4' from dual
    12  /
    10 rijen zijn aangemaakt.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1
    A1
    A1
    A1
    A2
    A2
    A2
    A3
    A4
    A4
    10 rijen zijn geselecteerd.
    SQL> merge into mytable t1
      2  using (select c1
      3              , row_number() over (partition by c1 order by null) rn
      4              , rowid rid
      5           from mytable
      6        ) t2
      7     on (t1.rowid = t2.rid)
      8   when matched then
      9        update set c2 = rn
    10   when not matched then
    11        insert values (null,null)
    12  /
    10 rijen zijn samengevoegd.
    SQL> select * from mytable
      2  /
    C1                                     C2
    A1                                      1
    A1                                      2
    A1                                      3
    A1                                      4
    A2                                      1
    A2                                      2
    A2                                      3
    A3                                      1
    A4                                      1
    A4                                      2
    10 rijen zijn geselecteerd.Regards,
    Rob.

  • Single query for displaying all but 1 column values for all tables

    Hi,
    All the tables have SYS_CREATION_DATE column.
    But I dont want to display this column value
    Can someone suggest some way in which i could achive this?
    Oracle version:11gR1
    OS:SunOS
    Cheers,
    Kunwar
    Edited by: user9131570 on Jul 6, 2010 7:57 PM

    user9131570 wrote:
    @Tubby
    I *want to display table-wise the values of all but 1(SYS_CREATION_DATE) columns in my database.*
    I need this in order to compare it to another database for all these values .Let me make a wild guess at what you are getting at.
    Given these two tables
    create table emp
       (empid number,
        empname varchar2(15),
        empaddr   varchar2(15),
        sys_creation_date date);
    create table dept
       (deptid number,
        deptmgr varchar2(10),
        sys_creation_date date);you want to somehow combine
    select empid,
             empname,
             empaddr
    from emp;with
    select deptid,
             deptmgr
    from dept;into a single sql statement?

  • Need a single query for all IF conditions

    I have the following requirements which looks at two parameter p_batch and p_frequency and frames a select to query from the Employers table.
    Can I achieve all these in a single select statement? If so how to do it?
    Please help.
    Thank you.
    IF p_batch = 1 and p_frequency = 2 then
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'A' AND 'M'
    AND er.freq_flag = 2
    ORDER BY er.name asc;
    ELSIF p_batch = 2 and p_frequency = 2 then
    Open cursor for processing employer starting with N to Z
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'N' AND 'Z'
    AND er.freq_flag = 2
    ORDER BY er.name asc;
    ELSIF p_batch = 1 and p_frequency = 1 then
    Open cursor for processing employer starting with A to M for all ER
    SELECT er.employer_id
    FROM employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'A' AND 'M'
    ORDER BY er.name asc;
    ELSIF p_batch = 2 and p_frequency = 1 then
    Open cursor for processing employer starting with N to Z for all ER
    SELECT er.employer_id
    FROM wweb.ptei_employers er
    WHERE SUBSTR (er.name, 1, 1) BETWEEN 'N' AND 'Z'
    ORDER BY er.name asc;
    ELSE
    -- Return as no need to send any mails
    END IF;

    Hi,
    Sure, you can do that in a single statement. Here's one way:
    SELECT       employer_id
    FROM       employers
    WHERE       SUBSTR (name, 1, 1) BETWEEN  CASE p_batch
                                 WHEN  1  THEN  'A'
                                 WHEN  2  THEN  'N'
                               END
                         AND      CASE p_batch
                                 WHEN  1  THEN  'M'
                                 WHEN  2  THEN  'Z'
                               END
    AND       (     (     p_frequency = 2
              AND     freq_flag   = 2
           OR     p_frequency  = 1
    ORDER BY  name
    ;

  • How to get rid of the loop in ALV output from At selection screen event?

    I have several push buttons on a selection screen.
    Clikc on a button, then it pops up an editable ALV report. (This gets triggered AT SELECTION SCREEN event.). REUSE_ALV_GRID_DISPLAY_LVC..
    On the ALV output, I enabled F4 for a couple of fields. Once I click on the F4 button, ONF4 method gets triggerd and a pop up appears with custom search helps.
    choose a line and it fills the cell.
    Upto this it works fine.
    Now I click on the BACK button at the ALV output, it takes me to the selection screen. I click on the button again, it show the editable ALV. Now when I click on the F4 button, the pop up comes up twice and the cell gets filled from the second pop - up.
    How to control this?
    Probably I am not refreshing something?
    (I am using REUSE_ALV_GRID_DISPLAY_LVC and tooks ome code for ONF4 event from BCALV_*DATATYPES (forgot the exact name) program.)
    Thanks,
    Ven

    Hi,
    FORM refresh_grid USING  pw_grid TYPE REF TO cl_gui_alv_grid.
    *Work area
      DATA : wal_stable TYPE lvc_s_stbl.
      CHECK NOT pw_grid IS INITIAL.
      wal_stable-col = c_check.
      wal_stable-row = c_check.
    *Method to refresh grid
      CALL METHOD  pw_grid->refresh_table_display
           EXPORTING
             is_stable      = wal_stable
             i_soft_refresh = c_check
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2.
    ENDFORM.                    " refresh_grid
    Thanks,
    Sree.

  • Need to get a single query

    qn. Field1
    112
    121
    222
    444
    333
    ans. Field1
    444
    333
    222
    112
    121
    let me know the answer .a single query for this

    i assume it is not
    ans. Field1
    444
    333
    222
    112
    121
    it is
    ans. Field1
    444
    333
    222
    121
    112
    just do ORDER BY Field1 DESC

  • A simple query in My SQL what is the similer query for that in Oracle ???

    hello friends
    In My Sql if i have 1000 records in a table and i want to get the records from 400 to 550 then it is posible by giving the following query
    Select * from Table a , table b where condition "List 400,550" gives the records from 400 to 550
    what is the coresponding query for this in oracle database
    any one help me pls
    mail me to [email protected]

    Genericly, if you want records N through M from a SELECT statement, there's a wonderful article on asktom.oracle.com
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    Justin

  • Query for calculating financialyear

    help me to write a query  which will check if the record createdon
    is within  the current financialyear  i.e. June 2014- July 2015
    RecordCreatedon
    logic
    2014-10-28
    yes
    2014- 12-15
    Yes
    2012- 01-19
    No
    Note  : query for calculating financialyear should be hardcoded .

    It looks like your sample data range is wrong "June 2014- July 2015"
    To get an idea, I consider June 2014 - May 2015 as financial year, try the below:
    create Table test_Table (RecordCreatedon date)
    Insert into test_table values('2014-10-28'),('2014- 12-15'),('2014- 06-01'),('2014- 05-30')
    ,('2015- 02-28'),('2015- 05-30'),('2015- 06-01')
    Select *,
    case when year(Dateadd(month,-5,RecordCreatedon) )=YEAR(getdate()) Then 'yes' else 'no' end Logic
    From test_Table
    Drop table test_Table

  • Want to retrieve multiple XML fragments in CLOBs in a *single query*

    Hi,
    I am trying to retrieve some well formed XML fragments stored as CLOBs from an 8i DB. For a single fragment at a time this is not a problem using <xsql:include-xml>. However, I am trying to retrieve multiple well formed fragments in a single query, "stacked" like so...
    <xsql:include-xml>
    <![CDATA[
    select theXMLFrag from tclob1 where id = 'open'
    union all
    select theXMLFrag from tclob2 --returns multiple rows
    union all
    select theXMLFrag from tclob3 --some more rows
    union all
    select theXMLFrag from tclob1 where id = 'close'
    ]]>
    </xsql:include-xml>
    What I am really after are the contents from the middle two selects. (The 'open' and 'close' bit was just a cheap attempt to ensure that the included XML is well formed.) Though it is not shown in my example, the problem is that the number and source of the CLOB fragments is not known until run time, and I wanted to use a dynamic query to assemble the needed CLOBS...
    I have since learned that <xsql:include-xml> returns the first column of the first row of the query result as parsed XML, either from a CLOB or a VARCHAR containing well-formed XML. So my attempt is no good... all but the first row are ignored.
    Does anyone have any suggestions for a way to do this using the existing xsql tag library? Or will I need to create my own <xsql:action>?
    Thanks,
    Bob Nugent

    Hi,
    Let me correct if i am right:
    - Central Contract -> new concept of SRM 7.0. 1 contract which is visible and usable from ECC and SRM as well. (not available in SRM 5.0 - agree)
    - GOA -> it exist in SRM 5.0 for sure! (we are currenlty using it for ECC procurement).
    The solution what you are mentioned is good...but as you said only for SRM 70...we are in SRM 5.0 and we need solution for here. Do you have any idea?
    Currently i am thinking about a new solution based on "standard" functionalities: if a GOA need to be created for mulitple company, it has to be populated in Header distribution (all company will have the same contract header). It item detail all the required information need to be poupulate in SRM (i.e.: item 1 for p.org1/comp.cod1; item 2 for p.org2/comp.cod2).
    When this is done, the BADI need to check the informatoin in SRM GOA and create contract according to that -> in this case 1GOA is created, but the 2 items for totally different p.org/comp.code, the BADI needs to create 2 different contract in ECC (i would like to avoid using reference purchasing organization in ECC!
    Thanks in advance!
    Best Regards,
    Attila

  • Query for Date Manipulation

    Hi,
    I have a requirement where given a date, I need to get the range from the given date and the last date of the subsequent month.
    For example if the given date is 20070517(YYYYMMDD), I need to fetch records within the range of this date that is 20070517 and 20070630.
    Can someone help me in forming a query for this.
    thanks in advance.
    Harish

    maybe this can work:
    SQL> select sysdate given_date, last_day(add_months(sysdate,1)) next_month
      2  from dual;
    GIVEN_DAT NEXT_MONT
    17-MAY-07 30-JUN-07well you just do the WHERE clause, but the idea is there.

Maybe you are looking for