Oracle Query failing for multiple rows:

Hey Guys,
I have been given a task to produce an ad-hoc report based on the following conditions (I will give you the structure of the table and details in the table below the requirements)
Requirements: Adhoc Report for Audit on CIT Income Allocation
1. Select from the RETURNS table:
• Id > 3600000 and
• Prog_program_cd = '01' and
• Return_status in ('ASSESSED', 'DU") and
• Tax year ending in 2009 (i.e. year portion of the Period_end_date is in 2009)
2. Retrieve the following fields from the RETURNS table :
• Id
• Entp_abn
• Acct_id
• Prog_program_cd
• Period_start_date
• Period_end_date
• Amend_ind
• Return_status
• Status_date
• Loctr_nbr
3. If there are multiple entries from the same account and tax year, only retain the latest record: From the records selected in step 2, if there are multiple records with the same Acct_Id and Period_end_date, only retain the record with the most recent Status_date (i.e. MAX value on the date).
4. Using the results from step 3, link to the applicable RETURN_LINE_ITEMS table where:
• RETURNS.Id = RETURN_LINE_ITEMS.Rtrn_Id
5. From the selected return on RETURN_LINE_ITEMS table, retrieve records where (value on Sch 000 Line 062 > 500,000) and (value on Sch 000 Line 066 < value on Sch 000 Line 062) :
• Sched_nbr = '000', and Litm_line_item_nbr = '062', and Active_ind = 'Y', get Revise_val_amt as 'ab_taxable_income'
• Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
• Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
The tables used in this are : RETURNS and RETURN_LINE_ITEMS
Structure of RETURNS table is:
ID
PROG_PROGRAM_CD
ACCT_ID
ACPE_ID
JENT_ID
PREV_RTRN_ID
ENTP_ABN
ACCT_OCCURNC_NBR
SOURCE_TYPE
RECEIVE_DATE
AMEND_IND
CMPLT_IND
PENALTY_OR_IND
RETURN_STATUS
STATUS_DATE
STATUS_USERID
PERIOD_START_DATE
PERIOD_END_DATE
NOTICE_STATUS
NOTICE_STATUS_DATE
NOTE_TEXT
PENALTY_OR_BY
PENALTY_OR_TMST
FILING_ID
CASE_ID
DOC_CONTRL_NBR
LOCTR_NBR
STATUTE_BARRED_DATE
MEDIA_TYPE
DISPSTN_TYPE
AMEND_TYPE
CALC_MODE
PROCESS_PASS_CNT
CONVRTD_IND
LOSS_PERIOD_END_DATE
MF_SYNC_CD
CREATED_BY
CREATED_TMST
MODIFIED_BY
MODIFIED_TMST
Structure of RETURN_LINE_ITEMS is:
ID
RTSC_ID
RTRN_ID
SCLI_ID
LITM_ID
ENTP_ABN
PROG_PROGRAM_CD
ACCT_OCCURNC_NBR
ACPE_END_DATE
SCHED_NBR
SCHD_VERSION_YR
SCHD_VERSION_NBR
RTSC_OCCUR_NBR
LITM_LINE_ITEM_NBR
SLIN_LINE_ITEM_ID
OCCUR_NBR
PREV_VAL_MOD_IND
VIABLE_IND
ACTIVE_IND
ACTION_CD
PREV_VAL_AMT
REVISE_VAL_AMT
PREV_VAL_TEXT
REVISE_VAL_TEXT
DISPLAY_SEQ_NBR
SYS_VAL_AMT
LITM_INNER_PASS_SEQ_NBR
CREATED_BY
CREATED_TMST
MODIFIED_BY
MODIFIED_TMST
So scripts to create the able tables are:
RETURNS
CREATE TABLE RETURNS
ID NUMBER(12),
PROG_PROGRAM_CD VARCHAR2(2 BYTE),
ACCT_ID NUMBER(12),
ACPE_ID NUMBER(12),
JENT_ID NUMBER(12),
ENTP_ABN NUMBER(9),
ACCT_OCCURNC_NBR NUMBER(4),
SOURCE_TYPE VARCHAR2(30 BYTE) DEFAULT 'BLANK',
RECEIVE_DATE DATE,
AMEND_IND VARCHAR2(1 BYTE) DEFAULT 'N',
CMPLT_IND VARCHAR2(1 BYTE) DEFAULT 'N',
PENALTY_OR_IND VARCHAR2(1 BYTE) DEFAULT 'N',
RETURN_STATUS VARCHAR2(12 BYTE),
STATUS_DATE DATE,
STATUS_USERID VARCHAR2(8 BYTE),
PERIOD_START_DATE DATE,
PERIOD_END_DATE DATE,
NOTICE_STATUS VARCHAR2(12 BYTE),
NOTICE_STATUS_DATE DATE,
LOCTR_NBR NUMBER(10),
MEDIA_TYPE VARCHAR2(30 BYTE),
DISPSTN_TYPE VARCHAR2(30 BYTE),
CONVRTD_IND VARCHAR2(1 BYTE) DEFAULT 'N')
RETURN_LINE_ITEMS
CREATE TABLE RETURN_LINE_ITEMS
ID NUMBER(12),
RTSC_ID NUMBER(12),
RTRN_ID NUMBER(12),
LITM_ID NUMBER(12),
ENTP_ABN NUMBER(9),
PROG_PROGRAM_CD VARCHAR2(2 BYTE),
ACCT_OCCURNC_NBR NUMBER(4),
ACPE_END_DATE DATE,
SCHED_NBR VARCHAR2(3 BYTE),
SCHD_VERSION_YR NUMBER(4) DEFAULT 0,
SCHD_VERSION_NBR NUMBER(3),
RTSC_OCCUR_NBR NUMBER(3),
LITM_LINE_ITEM_NBR VARCHAR2(3 BYTE),
SLIN_LINE_ITEM_ID NUMBER(12),
OCCUR_NBR NUMBER(3) DEFAULT 1,
PREV_VAL_MOD_IND VARCHAR2(1 BYTE) DEFAULT 'N',
VIABLE_IND VARCHAR2(1 BYTE) DEFAULT 'N',
ACTIVE_IND VARCHAR2(1 BYTE) DEFAULT 'Y',
PREV_VAL_AMT NUMBER(15,2),
REVISE_VAL_AMT NUMBER(15,2),
DISPLAY_SEQ_NBR NUMBER(3),
SYS_VAL_AMT NUMBER(15,2),
LITM_INNER_PASS_SEQ_NBR NUMBER(3)
So when you run the scripts above, the tables are created (I have tested it in TOAD)
Now let's feed data into both the tables
RETURNS table:
insert into RETURNS
VALUES
(3602448 , '01' ,288151,3876821,9345370 , 403232531, 1, 'TAXPAYER' ,12/4/2008 ,'N', 'Y','N','ASSESSED', 2/18/2009,'SANDEEP',1/2/2008,1/2/2009,
'PRINTED','2/18/2009, 6043073664,'PAPER', 'NOTICE','N');
insert into RETURNS
VALUES
(4117092 , '01' ,57794,3864551,10566221 , 400571410, 1, 'TAXPAYER' ,6/30/2010 ,'N', 'Y','N','ASSESSED', 2/18/2009,'SANDEEP',1/2/2008,1/2/2009,
'PRINTED','2/18/2009, 6043073664,'PAPER', 'NOTICE','N');
RETURN_LINE_ITEMS table:
INSERT INTO RETURN_LINE_ITEMS
VALUES
(266000770,7749234,3602448,1603,403232531, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40,1, 'N','Y', -5440, -5440, 200,-5440,130);
INSERT INTO RETURN_LINE_ITEMS
VALUES
(266000773,7749234,3602448,1539,403232531, 01, 1, 1/1/2009, 000, 1998, 1,1, '066', 43,1, 'N','Y', NULL, 0, 215,0,200);
INSERT INTO RETURN_LINE_ITEMS
VALUES
(319820233,9028477,4117092,1603,400571410, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40 ,1, 'N','Y', 790068, 790068, 200,790068,130);
INSERT INTO RETURN_LINE_ITEMS
VALUES
(319820236,9028477,4117092,1539,400571410, 01, 1, 1/1/2009, 000, 1998, 1,1, '062', 40 ,1, 'N','Y', NULL, 790, 215,790068,200);
This completes the test data.
Now based on the question posed by the Business Analyst, until "5 b" i.e where it's said:
Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
I am able to retrieve data perfectly fine and the query for that is:
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where r1.id = rtlnms.rtrn_id
and r1.id > 3600000
AND r1.prog_program_cd = '01'
AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and RTLNMS.LITM_LINE_ITEM_NBR IN('062', '066')
and rtlnms.active_ind = 'Y' and r1.id in(4117092, 3602448)
The out put is : 4 rows returned which has litm_line_item_nbrs for all the returns in question (4117092, 3602448) and that is - 066,062,062, 066 with their respective amounts.
However against the business analyst's question 5 "C" which is - Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
I should be getting 2 rows(one with '062' and '066') with return -4117092
So I am applying the logic as mentioned by business analyst's "5C" and run the following query:
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where r1.id = rtlnms.rtrn_id
and r1.id > 3600000
AND r1.prog_program_cd = '01'
AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and RTLNMS.LITM_LINE_ITEM_NBR IN('062', '066')
and rtlnms.active_ind = 'Y' and r1.id in(4117092, 3602448)
and r1.id in (select rtrn2.id
from returns rtrn2, return_line_items rtlnms2
where rtrn2.id= rtlnms2.rtrn_id
and rtrn2.id=r1.id
and nvl(decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT),0) > 500000 or rtlnms2.litm_line_item_nbr='066') and (
nvl(decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT),0) < nvl(decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT),0))
order by r1.acct_id , r1.period_end_date desc
I am only getting one row with for RETURN = 4117092 with litm_line_item_nbr (line item number) '062' where as I should also be getting line item number '066' along with '062'
Could any one of you please help me out. I am stuck and have tried everything at the office with no luck.
Many Many Thanks in Advance!
Sandeep

Hi there,
I agree that without test case it's a bit complicated for you folks to solve. However I just could not. Anyways this is the query that I had to use to come to my solution and that is:
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where
r1.id = rtlnms.rtrn_id and
r1.prog_program_cd = rtlnms.prog_program_cd and
r1.entp_abn = rtlnms.entp_abn and
r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
AND nvl(decode(litm_line_item_nbr, '062', REVISE_VAL_AMT),0) > 500000
and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR = '066'
AND SCHED_NBR='000'
UNION
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where r1.id = rtlnms.rtrn_id
AND r1.prog_program_cd = rtlnms.prog_program_cd
AND r1.entp_abn = rtlnms.entp_abn
AND r1.id > 3600000 AND r1.prog_program_cd = '01'
AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('066')
and NVL(RTLNMS.REVISE_VAL_AMT,0) <( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR = '062'
and NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
AND SCHED_NBR='000'
order by ID
This above query works fine. No worries.
One more question and that is:
I need to find out details of another condition. However what happens is using the same query above, when I try to add "and RTLNMS.LITM_LINE_ITEM_NBR IN('066' ,029')" (in the bold part),
it does give me another extra value for row 029 and that's something that I don't want. Based on the above results, I get 4 rows ; 2 each for 062 and 069.
The question asked by business is based on the above results, bring out even values for 029, so which in this case should be 2 rows, making it overall 6, but then I get 7, is there any way to get rid of extra row
or rather : is there any way to retrieve additional row based on results from a query?

Similar Messages

  • Return Code - Query for Multiple Rows as XML

    Hi,
    I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this:
    { call MyStoredProc(?) }
    This works great, the stored procedure always returns a record set (with or without records). I use this activity rather than "Call Stored Procedure" because I can transform the record set into XML right away within this activity. Unfortunately any exception arising from invoking this stored procedure cannot be handled within the workflow as this activity does not have an exception handler (lightning bolt). In an attempt to handle at least some exceptions we have decided to use try/catches within the stored procedures and return different error codes. Now the problem I am faced with is that there is no way to retrieve the returned code within any of the SQL activities. We don't want to have to write an execute script for each of these SQL calls. Is there any way to do this? Seems like I'm 95% there.
    Thanks
    Nic

    Thanks for the offer, unfortunately we would need something certified by Adobe.
    Nic

  • Formula to calculate SUM of multiple sheets of excel and the result to be stored in another excel sheet and pop up alerts for multiple rows

    I have a excel with multiple
         sheets with data as shown below
    SHEET 1
    A 1
    B 2
    C 3
    SHEET 2
    B 1
    C 2
    A 3
    SHEET 3
    C 1
    A 2
    B 3
    My
    query is splitted into 3 categories
    I want to have a formula to do math calculation such that data of "A" of SHEET 1 is  calculated with "A" of SHEET2 irrespective of the location of "A".
    When I include SHEET3, the formula should automatically identify the location of "A" or "B" or "C" and give the result corresponding to A, B or C. Since I want to bifurcate daily report and output printed. I want to use another
    excel for output. How to link multiple sheets of one excel and print the output of above in
         another excel?
    Assume, I have 4 SHEETS,  "SHEET 1", "SHEET 2", "SHEET 3" and "SHEET 4". Math calculation need to be done using all 4 sheets. If
    I include "SHEET 5", the formula should ignore SHEET 1  automatically and give the results of SHEETS 2 to 5. Similarly, if I include SHEET 6, SHEET 1 and 2 need to be ignored for further calculation and SHEET 3-6 need to be used. How to write
    such formula?
    How to get pop up alert for multiple rows, if a specific condition is hit?

    Maybe VBA Code should be a good option for you. I suggest you post you issue to
    Excel for Developers forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Best Regards,
    Wind

  • Can I use Concatenate function for multiple rows?

    I have a lead list that contains 5000 leads. The format of this list contains address data that is saved in separate columns (ie: address, address 2, city, state, zip). I need this data in 1 column. I tried to use the concatenate function to combine the data for 1 row and it worked perfectly. I tried to do this for multiple rows and the function is greyed out. Is there a work around or way that I can combine this data for all 5000 rows without doing it 1 by one?

    Look at this table;
    In B9, the formula is;
    =B2&" "&C2&" "&D2&" "&E2&" "&B3&" "&C3&" "&D3&" "&E3
    Yvan KOENIG (VALLAURIS, France) dimanche 18 octobre 2009 20:51:47

  • Query for Multiple Rows as XML

    Ok I've seen this topic in the forums, but have failed to get this to work within my process. Basically I have a process that has a user fill out a form, and upon submittal the form writes it's information to a database (via a data connection within the form that invokes a separate process upon submittal.), once this is done the main process is invoked and it's first step is to query that same database and bring back the data in a lower (now exposed) portion of the form that contains certain fields that track the issue history. The query brings back the xml document and I store it in an xml variable (xml_output). I then take this information and use the Set Value object to assign the returned nodes values to the location fields in the form. This works if the query returns only one row. But once the form is moved beyond the initial Task Assignment, (first user), and query returns more than just one row, the added nodes to not show up on the form, i.e I still just get information about the first row in my form. From what I've read the form should be able to recognize the xpath expression, and bring back all the nodes, by in a sense using instance manager to create an instance for each node on the form. My question is how can I get this to work. Jasmin if your still out there... Help!
    Also We're using Adobe LiveCycle ES 8.0
    created the process using Workbench
    the form was reader enabled and saved as a dynamic PDF.
    Thanks
    Mike

    Ok have done the binding of the schema to the form, and I'm getting the information to flow as it's supposed to.  The problem I'm having now, (I know I'm having a bunch.) is that once I've placed the form into my process, and I use the set value operation to pre-fill information I get the form to flow, but the rest of the information that was previously filled in is blank.  So I have checked the variable and nothing wrong there.  It appears the problem is how I'm using the set value operation.  If I don't use the set value operation, the form retains it's information.  And if I use the set value by trying to set the subform value, the form retains it's information, but no pre-fill.  I'm going to try to be a little more detailed here.  The xml that is returned looks like this:
            0016-03-30
            Mike
            Public Works
            alone in the dark
            Type sleep
            -1
            Council
            FYI
            Important
    Flowed and positioned are actual subforms on the form that have their properties set as their names indicates.  The entire path is /form1/Page1/flowed/positioned .  The way I was able to get the form to flow correctly upon the injection of this xml data, was to bind the subforms in the form in this manner, positioned[*].  Designer didn't place the [*] for me so I had to do this myself.  But once I previewed the document, the form pre-populated and created the necessary number of subforms and placed information into the fields correctly.
    Now on the process side, I have created an xfaform variable that stores the form (bound to xsd.)  information, and another xml variable that stores the query return that looks like the xml listed above (has an xsd associated with it for navigating xpath).  My first operation performs the query (JDBC- Query Multiple Rows as XML) and stores it into the xml variable.  The next step of the process is the Set Value operation which is supposed to inject the xml data retrieved from the query into the form.  Initially I tried the an xpath similar to the following:
    /process_data/object/data/form1/page1/flowed/positioned = /xml_data/flowed/positioned.
    No dice.  On this one the form retains the information filled out by the user (didn't explain this earlier, the form is filled out first, and upon submittal the process starts.), but doesn't pre-populate the bottom part of the form.  Next I tried the following xpath:
    /process_data/object/data/form1/page1/flowed = /xml_data/flowed/positioned.
    This time it retained the form information which was filed in by the user, but the bottom part is becomes hidden!  Didn't understand this.  But I started to kinda think that I had to navigate he xpath in order to correctly inject the xml into the form.  That being said my next attempt was:
    /process_data/object/data/form1/page1 = /xml_data
    My thinking was that if on location, I stop at page1, the xml in the variable will allow it to navigate correctly through the form.  Well it worked, but too well.  The top part of the form is blank, but the bottom portion is pre-populated correctly.  Now I'm stuck.  Not sure how to get the rest of the information in the form.  I thought about creating variables form each of the fields and then re-populating them after the injection of xml, but that didn't seem practical.  I'm almost positive it's something I'm not doing correctly with xpath.  Anyway, thanks for all your help on this.
    Mike

  • Query for multiple row to single

    Hi All,
    Need help in Multiple row to single row
    create table cust_tranc_track
    (id number,
    payment_dt date ,
    emi_dt date,
    appr_dt date
    SET DEFINE OFF;
    Insert into CUST_TRANC_TRACK
       (ID, APPR_DT)
    Values
       (425, TO_DATE('11/12/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into CUST_TRANC_TRACK
       (ID, PAYMENT_DT, EMI_DT)
    Values
       (425, TO_DATE('11/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('11/13/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Output :
    ID     PAYMENT_DT     EMI_DT              APPR_DT
    425     11/1/2012     11/13/2012     11/12/2012thanks
    ajr

    *> g2500 wrote:**> Hi All,*
    *>*
    *> Need help in Multiple row to single row*
    *>*
    *> *
    *>*
    *>*
    **_+Hi,+_**
    **_+I cant clear about ur question. I m giving the solution wat i can understand.to get multiple row inti single u can use listagg function.+_**
    **_+use hr.employees+_**
    **_+select department_id,listagg(first_name,',') WITHIN GROUP (ORDER BY first_name) AS employeename+_**
    **_+from employees+_**
    **_+group by department_id;+_**
    **_+u [http://dba-oracle.com/t_oracle_listagg_function.htm]+_**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query to return multiple rows

    Hi all,
    I've a requirement where in I've to get multiple rows from a query.
    The resultset should be something like this:
    SELECT A
    FROM dual;
    A
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Thanks in anticipation
    RK Raju

    I'm not completely certain I understand the question. Just in case you're asking for something as simple as this ...
    select rownum from all_objects where rownum <= 10;You didn't say what version you were using either (shame on you). You could use a collection or a pipeline depending on your version ...
    create or replace type ttab_number is table of number;
    create or replace function f_collection
        return ttab_number is
        tab_number ttab_number := ttab_number();
    begin
        for i in 1 .. 10 loop
            tab_number.extend;
            tab_number(tab_number.count) := i;
        end loop;
        return tab_number;
    end f_collection;
    select *
    from table(f_collection)
    create or replace function f_pipeline
        return ttab_number
        pipelined is
    begin
        for i in 1 .. 10 loop
            pipe row(i);
        end loop;
        return;
    end f_pipeline;
    show errors
    select *
    from table(f_pipeline)

  • Password Masking & Background Color for Multiple Rows in Tabular Form

    Hi all,
    I have a requirement of making a column in Tabular form, having multiple rows, masked(password field). I also want to give bg color to this field indicating that its a mandatory field.
    I am unable to accomplish both at a time in my page. I am using Apex 3.2.
    Waiting for your valuable comments. Thanks,
    Regards,
    Sandeep

    APEX_ITEM API doesnot have a password function, but input fields of type password are available in HTML.
    So you would have to change the field type to password in JS
    That is from :
    <input type="text" ...change it to
    <input type="password" ...If you were using jQuery it would have been simpler, but to do it in native JS it is a bit more hard work.
    Anyway here goes (a quick check in a tabular form seens to work fine)
    var password_array=document.getElementsByName("f04");
    for(var i=0;i<password_array.length;i++)
       password_array.type = 'password';
    password_array[i].style.backgroundColor = 'RED';
    +Replace the "f04" with your password field's array name(use firebug to identify the field name)+
    Does that solve your problem ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Datatype-Name for multiple rows return

    Hi
    If I return multiple rows says ex:100 rows then what will be data type for that return values...

    Using PL/SQL Collections and Records
    Using Ref Cursors To Return Recordsets

  • Querying view gives multiple rows

    I have a query that returns duplicate rows (5) when I write the query this way:
    "Select *
    from view v
    , table_A a
    where v.key = a.key"
    However, if I write the query this way, the correct data is returned, i.e., only one row.
    "Select *
    from (select * from view v)
    ,table_A a
    where v.key = a.key"
    It also works correctly if I put the in-line view in the select portion of the select statement.
    Any ideas?
    Thank you for your help,
    Tricia

    With the second query, I get "ORA-00904: "V"."KEY": invalid identifier". Are you sure that it ran ok for you? v.key is out of scope in the where clause...
    If I label the subselect as v, I get the same result as the first query - 5 rows.
    Message was edited by:
    Boneist
    (I can't spell)

  • How to disable resize function for multiple rows of inputText?

    I have a multiple rows inputText component like below:
    <af:inputText label="#{ZccToolbarGenBundle['OLabel.TransferNote']}"
    id="it1" autoSubmit="true" columns="150"
    immediate="true" simple="true" rows="5"
    binding="#{transferBean.transferNoteText}"/>
    How can I turn off the resizing icon on the bottom of right hand side of this input text box?
    Thanks for any help.

    Timo, the bug that I filed has been changed to 'not a bug'. The reason of that is 'That correct as it is not a valid CSS style on all browsers'. I sent email to ADF faces team and got following answers: 1. StyleClass that has agent specific setting for this setting. 2. You put the style class in a skin file and reference it. you can not use the inline style notation. It wants a Style Class.
    My question is what kind of StyleClass or skin file do you use so that you can use contentStyle="resize:none;"? Thanks.

  • How to use simple values services for multiple rows ina table

    Hi Frnds...
    As per my requirment i need to use SVS for multile rows in a table.
    The coding goes like this for getting single attribute which is directly under root context.
    objSimpleValueSetCurr = wdContext.getNodeInfo().getAttribute("ctx_attribute");
    (this is only for context attribute directly placed under root context in the view controller.)
    We need to use value node and a value attribute inside this node. And retrieve the same. so need help regarding the code changes.
    Regards,
    Sudeep

    Hi ,
    I had tried out your suggestion. Its not working.
    The code goes like this, but the data is not getting populated.
    "controller_curr" is the value attribute  under the node "InitTable" in the controller which is further mapped to view controller with the same structure.
    The data is geting printed through the message manager just before the line
    divSMT.put(currency,currency); in this code, at the end.
    But "divSMT.put" is not able to populate the data.
    _________START________
    public void currency( )
        //@@begin currency()
              IWDMessageManager msg = wdComponentAPI.getMessageManager();     
              ISimpleTypeModifiable objSimpleTypeCurr = null;
              IModifiableSimpleValueSet objSimpleValueSetCurr = null;
              String currency=null;
              String bandg = null;
              Z_Bapi_Get_Curr_Rate_Input authCurrDet = null; //for FCURR
        Try
    authCurrDet = new Z_Bapi_Get_Curr_Rate_Input();
                         wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().bind(authCurrDet);
                              wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().currentZ_Bapi_Get_Curr_Rate_InputElement().modelObject().execute();     
    IWDAttributeInfo  objSimpleValueSetCurr1 = wdContext.nodeInitTable().getNodeInfo().getAttribute("controller_curr");
    ISimpleTypeModifiable countryType = objSimpleValueSetCurr1.getModifiableSimpleType();
    IModifiableSimpleValueSet divSMT = countryType.getSVServices().getModifiableSimpleValueSet();
    int sizeofCurrencyFCURR = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().size();
    msg.reportSuccess("SizeofCurrency FCURR : "+sizeofCurrencyFCURR);
    for(int i=0;i<sizeofCurrencyFCURR;i++)
    currency = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().getIt_Curr_RateElementAt(i).getFcurr();
    msg.reportSuccess("Currency : "+currency);
    divSMT.put(currency,currency);
         catch(Exception e)
    //@@end
    _________END________
    Please look into the issue.
    Regards.

  • Unlimted License Patch fails for multiple versions of  Server Express

    I'm following the directions for installing and licensing two versions of Microfocus Server Express for a PeopleTools 8.52 upgrade. When I get to the point where I apply the Unlimited License Patch (ULP), the application to the first version goes fine, showing a successful "installed" message. After installing the other version of Server Express, I try to apply the ULP again and this time it returns an "uninstalled" message. Eventhough I had COBDIR set to the 2nd installation, the ULP deinstalled the patch for the first installation. I'm doing this as the root user but I have su'ed to root. This worked fine 2 years ago. What am I missing in the environment that prohibits me from installing the ULP for multiple versions of Server Express?

    LD_LIBRARY_PATH

  • It is possible to have a dynamic Oracle Label Security procedure/script to configure data label (compartments and data label)  for multiple rows at same time?

    A single script which can be run below mentioned commands...  instead of using multiple manual steps for configuring data labels. Is that possible and how? Having bulk of data where OLS need to be applied.
    exec LBACSYS.SA_COMPONENTS.CREATE_COMPARTMENT
    exec SA_LABEL_ADMIN.CREATE_LABEL
    exec SA_POLICY_ADMIN.APPLY_TABLE_POLICY

    Have you ever answered this question? If not, have you tried to use the "HIDE" property on your table_options?

  • Query for Multiple Rows as XML 'NULL' question

    There are two fields in the database.
    Foo = null (real null)
    Foo1 = '' (blank string)
    In my return xml the nodes are as follows:
    <Foo>null</Foo>
    <Foo1/>
    Why is it that if there is a null in the database, that it puts the string null, and then when there is a blank string, the node is empty?
    How can I get the null value to act like the blank value?
    Cheers

    SELECT COALESCE(Foo,''),COALESCE(Foo1,'') FROM mytable;
    The above query will return '' (empty string) if the columns has NULL value.
    This is another solution.
    Third solution is to apply XSL and remove NULL value.

Maybe you are looking for

  • How do I assign a Location from My Places to an Event?

    iPhoto 8.1.1 I don't have any GPS data in my photos and am trying to assign it manually, with some difficulty. I watched the tutorial on the iLife > iPhoto webpage and it appears that when you click on an Event's "i" icon there are supposed to be two

  • My MacBook Pro keeps telling me there was a problem connecting to a time capsule that no longer exists on my network.

    The error showing states "There was a problem connecting to the server 'name of my old time capsule' ".  However, that time capsule has since been replaced by a new time capsule.  Why does my computer continue to try to connect to the old time capsul

  • Default Color  Problem

    I Have a small problem, that I need some help on ... I need to find the rgb value for the default background colors of Panels. I used new Color color = JPanel().getBackground(); int red = color.getRed(); int green = color.getGreen(); int blue = color

  • Can I turn Lightroom previews into jpgs?

    I recently lost my original raw (CR2) files for a set of photos. They were imported and edited in lightroom 4.1. I still have the lightroom catalog but the photo previews are occompanied by the warning "The file name "#####.cr2" is offline or missing

  • Document Date as any future date

    Dear Experts, We know thre are three dates in SAP FI Modules:- Document Date :- Any Reference Date Posting Date - This hits the FI Ledger Entry Date - Date of actual entry Our user in some cases in advertantly put future date as the year 2208 instead