Returning concatenated string for each acctid

Hi All,
For each acct id, bank statement can be sent to multiple CC EMAIL addresses.
So, for each acct - only one row should appear. I would need to string together cc email addreses for each acct.
Can someone provide code for a function that takes acct_id and loops through all the CC email addresses and for each ACCT_ID passed and returns a concatenated result of
email addresses like "email1, email 2".
GIVEN TABLE:
ACCT EMAIL ADDRESS:
ACCT1 [email protected]
ACCT1 [email protected]
RESULT in report:
ACCT1 [email protected], [email protected]
Need to do it asap.
Regards,

Version? If you are on 11.2 use LISTAGG:
select  acct,
        listagg(email_address,', ') within group(order by email_address) email_address_list
  from  ypour_table
  group by acct
/For example:
with sample_table as (
                      select 'ACCT1' ACCT,'[email protected]' EMAIL_ADDRESS from dual union all
                      select 'ACCT1','[email protected]' from dual
select  acct,
        listagg(email_address,', ') within group(order by email_address) email_address_list
  from  sample_table
  group by acct
ACCT  EMAIL_ADDRESS_LIST
ACCT1 [email protected], [email protected]
SQL> On lower versions:
select  acct,
        rtrim(xmlagg(xmlelement(e,email_address,', ').extract('//text()') order by email_address),', ') email_address_list
  from  your_table
  group by acct
/For example:
with sample_table as (
                      select 'ACCT1' ACCT,'[email protected]' EMAIL_ADDRESS from dual union all
                      select 'ACCT1','[email protected]' from dual
select  acct,
        rtrim(xmlagg(xmlelement(e,email_address,', ').extract('//text()') order by email_address),', ') email_address_list
  from  sample_table
  group by acct
ACCT  EMAIL_ADDRESS_LIST
ACCT1 [email protected], [email protected]
SQL>SY.

Similar Messages

  • Access Parameter Query by form, returns a form for each returned value

    I have a form set up with a parameter query. It returns data from multiple tables. My problem is it returns the data for say 7 records, but then it repeats the entire form 7 times, the forms are identical with all the data included. I want it to return
    the data on one form. It must be a setting, or statement that is lacking but I can't seem to find it.

    Hans,
    Thank You for the response. I first changed the setting in the SubForm Query, same result. Then I changed it in the Report, still no difference. After reading some information in other forums it may be because I am pulling the data from the Tables using
    the InvoiceNum field from one table, on both the Report and the SubForm, and I have the Report and Subform linked by this field. The InvoiceNum field is the Foreign key created to pull the desired data, if I don't use it I get all the data in the tables, not
    just the data I need.

  • Generated schema on a query returns xsd:string for date data type

    I'm a complete newbie to oracle's xml generation and have encountered the following problem. But first the important details:
    select * from v$version
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    "CORE     10.2.0.2.0     Production"
    TNS for Linux: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    We have a large number of dynamic queries that we would like to generate xml for. I'm currently using the dbms_query.getXML(context, 2) to generate the schema definition for the columns as well as the xml row data. Currently, the problem I have is that the schema definition for date columns is being returned as xsd:string rather than xsd:date. I've no idea why it is coming back that way, and haven't found anything to point me in the direction of any configuration data where this can be changed. Here is the table and code I'm using:
    query: select dbms_xmlquery.getxml('select * from clh_xml_test',2) from dual
    table definition:
    create table CLH_XML_TEST
    ID NUMBER not null,
    NAME VARCHAR2(50) not null,
    DATE_COL DATE,
    EMAIL_ADDRESS VARCHAR2(100) not null,
    URL VARCHAR2(100) not null,
    TIMESTAMP_COL DATE
    Sample results:
    <?xml version="1.0"?>
    <DOCUMENT xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
              <xsd:element name="ROWSET">
                   <xsd:complexType>
                        <xsd:sequence>
                             <xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
                                  <xsd:complexType>
                                       <xsd:sequence>
                                            <xsd:element name="ID" type="xsd:double" minOccurs="0"/>
                                            <xsd:element name="NAME" nillable="true" minOccurs="0">
                                                 <xsd:simpleType>
                                                      <xsd:restriction base="xsd:string">
                                                           <xsd:maxLength value="50"/>
                                                      </xsd:restriction>
                                                 </xsd:simpleType>
                                            </xsd:element>
                                            <xsd:element name="DATE_COL" type="xsd:string" nillable="true" minOccurs="0"/>
                                            <xsd:element name="EMAIL_ADDRESS" nillable="true" minOccurs="0">
                                                 <xsd:simpleType>
                                                      <xsd:restriction base="xsd:string">
                                                           <xsd:maxLength value="100"/>
                                                      </xsd:restriction>
                                                 </xsd:simpleType>
                                            </xsd:element>
                                            <xsd:element name="URL" nillable="true" minOccurs="0">
                                                 <xsd:simpleType>
                                                      <xsd:restriction base="xsd:string">
                                                           <xsd:maxLength value="100"/>
                                                      </xsd:restriction>
                                                 </xsd:simpleType>
                                            </xsd:element>
                                            <xsd:element name="TIMESTAMP_COL" type="xsd:string" nillable="true" minOccurs="0"/>
                                       </xsd:sequence>
                                       <xsd:attribute name="num" type="xsd:integer"/>
                                  </xsd:complexType>
                             </xsd:element>
                        </xsd:sequence>
                   </xsd:complexType>
              </xsd:element>
         </xsd:schema>
         <ROWSET xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="#/DOCUMENT/xsd:schema[not(@targetNamespace)]">
              <ROW num="1">
                   <ID>779451193</ID>
                   <NAME>Clh Test</NAME>
                   <DATE_COL>1/1/2001 0:0:0</DATE_COL>
                   <EMAIL_ADDRESS>[email protected]</EMAIL_ADDRESS>
                   <URL>http://www.google.com</URL>
                   <TIMESTAMP_COL>7/8/2004 10:7:4</TIMESTAMP_COL>
              </ROW>
         </ROWSET>
    </DOCUMENT>
    Thank you for your help, let me know if I can provide any additional information.
    Chris
    Message was edited by:
    user538302

    use DBMS_XMLGEN.

  • How to code a method that returns string for class object

    I have a class named Address.
    public class Addresss{   
    private String street;   
    private String city;            // instance variables  
    private String zipcode;}I have been asked to write a method that returns a string for Address object. I dont understand how to create address object.Can anyone pls help me understand.
    do I have to write (for creating object)
    Address addressObject  = new Address(); ( coding method that returns a string for address object) ---> I really dont understand this part.

    looks almost right. The problem is that your method name AddressBookEntry does not match the name of your class AddressBook and therefore is not a constructor.
    Furthermore, you probably need to make a distinction between a single entry into the address book which consists of a single name and a single address, (which is just what you have done) and an address book itself which is probably a list of AddressBookEntries
    So for your code I would change the class that you called "AddressBook" to "AddressBookEntry" and have a third class that represents the collection of AddressBookEntries.
    Now to be honest, I don't know why you keep the name split apart from the street address portion of the address. I would be more inclined to keep the name as a field of the address itself, but it's your code, you carve it up the way you like.

  • How to return a string in chronological order?

    I have a string called schedule, for example:
    schedule = "^14%Paul's house?Group Meeting\n^9%Nutty Professor's Office?Office Hours\n^12%MegaBits?Lunch"
    After breaking it up using StringTokenizer, how do I return it into chronological order?
    Return the schedule for each day of the week as a String with the appointments listed in chronological order, starting with those for the first day of the week and ending with those for the last day of the week.
    The String should have the following format
    Sunday:
    ^14%Paul's house?Group Meeting
    Monday:
    ^9%Nutty Professor's Office?Office Hours
    Tuesday:
    ^12%MegaBits?Lunch
    Wednesday:
    xxx
    Thursday:
    xxx
    Friday:
    xxx
    Saturday:
    xxx
    xxx is the String representation of the schedule for each day. There should be no newline after the last schedule.
    Note: if there are no appointments scheduled for a certain day, then that day should not be included in the String. (For example, if there are no appointments scheduled on Tuesday then:
    Tuesday:
    xxx
    should not be included.)

    Well, then,
    i would assume you need to keep 7 variables, that hold the 7 values of the days,
    then append the values together in the natural order using +

  • Store Date as Oracle Date as string for simplicity?

    I got this table (scaled-down):
       CREATE TABLE TBLSERVICES
         STORENBR CHAR(4 byte) NOT NULL,
         SERVICEDATE CHAR(10 byte) NOT NULL,
         CHECKNBR CHAR(6 byte),
         ORDER_START_TIME DATE NOT NULL,
         ITEMID CHAR(4 byte), 
         SERVERID NUMBER(18),
         SERVERNAME VARCHAR2(50 byte),
         ITEMQUANTITY NUMBER
    ) Function MakeServicesDatatable(byval onodesconfig as xmlnodelist) return datatable
           dim objDT as new datatable
           With objDt
                .Columns.Add("StoreNbr", GetType(String))
                .Columns.Add("Order_Start_Time", GetType(String))
           End With
           dim dte as string
           For Each onode As XmlNode In onodesConfig
                    If onode.InnerText = "5" Or onode.InnerText = "6" Then
                        objdr = objDt.NewRow
                        objdr("StoreNbr") = storenbr
                        dteYear = parentNode("Order_Start_Time").SelectSingleNode("Year").InnerText
                        dteMonth = parentNode("Order_Start_Time").SelectSingleNode("Month").InnerText
                        dteDay = parentNode("Order_Start_Time").SelectSingleNode("Day").InnerText
                        DteHour = parentNode("Order_Start_Time").SelectSingleNode("Hour").InnerText
                        dteMin = parentNode("Order_Start_Time").SelectSingleNode("Minute").InnerText
                        dteSecs = parentNode("Order_Start_Time").SelectSingleNode("Second").InnerText
                        dte = String.Format("{0}/{1}/{2} {3}:{4}:{5}", dteMonth, dteDay, dteYear, DteHour, dteMin, dteSecs)
                        objDR("order_start_time") = dte
                        objDt.rows.add(objdr)
                    end if
            next onode
            return objDT
    end function
    I call following:
    dt = MakeServicesDatatable(NodesWithData)
    WriteDataToDB(dt)
    Public Sub WriteDataToDB(ByVal dtServices As DataTable)      
            Dim altConnString As String = connString
            Dim queryString As String = "Select * from tblServces"
            Using connection As New OracleConnection(altConnString)
                Dim adapter As New OracleDataAdapter()
                adapter.SelectCommand = New OracleCommand(queryString, connection)
                Dim builder As OracleCommandBuilder = New OracleCommandBuilder(adapter)
                connection.Open()
                Dim ds As DataSet = New DataSet
                adapter.Fill(ds, "tblServices")
                For Each drService As DataRow In dtServices.Rows
                    ds.Tables("tblServices").ImportRow(drService)                
                Next drService
               adapter.Update(ds, "tblServices")
            End Using
        End SubIn a PL/SL SQL Query, I need to say something like this:
    - Lunch is anything before 3:00pm
    - Assume date is same as date of order start time
    select  storenbr,
            itemquantity
    from tblServices
    where order_start_time < DatePArt(order start time date) || 15:59:00 I don't know syntax for getting date portion of oracle date
    Problem is the order_start_time is stored as dd-mmm-yyyy.
    I need seconds also. Should I make order-start_time a string
    and convert to date in SQL statement.

    Hi Vinod,
    Create a varaible of type customer exit for RUNDATE.
    IF i_step = 1.
       select max (rundate) from /bic/prundate into zrundate.
      IF i_vnam = 'rundate'.
      l_s_range - low = zrundate.
      l_s_range- opt = 'eq'.
    append l_s_range into e_t_range.
    endif.
    Endif.
    hope it helps
    bhaskar

  • Want to print the whole month with or without overtime for each employee

    Hi,
    I have Oracle forms/reports10g R2, Below query returns employee overtime correctly but I want to add the whole month with it in simple words if one employee have overtime for five days in a month I want the query to return the whole month including five overtime days for each employee and let say if we have ten employees query return whole month for each employee either he have or overtime or not how can I implement this in report it becomes agony for me, anyone please suggest a solution.
    Thanks and regards, Khawar.
    ---Query---
    select o.ot_date , o.start_dt_time as start_time, o.end_dt_time as end_time, o.ot_details, et.holiday, et.staff_id, e.staff_name, e.desig
    from overtime o, emp_ot et, employee e
    where o.complain_no = et.complain_no
    and o.inc_type_code = et.inc_type_code
    and et.staff_id = e.staff_id
    order by 1, 2, 3, e.staff_id

    Hi Michael,
    Thanks for reply, I think I didn't explain as I should, I want to print Overtime report for each employee let say employee A123 did overtime for five days in DEC than what I want is to print report for employee A123 for the whole month means when I print report blank cell should come where A123 don't have data (I mean other 25/26 days).
    The structure of tables are as
    SQL> desc overtime
    Name Null? Type
    COMPLAIN_NO NOT NULL NUMBER(5)
    OT_DATE NOT NULL DATE
    START_DT_TIME NOT NULL DATE
    INC_REF_NO NUMBER(5)
    END_DT_TIME NOT NULL DATE
    INC_TYPE_CODE NOT NULL VARCHAR2(10)
    DISTRICT_CODE VARCHAR2(6)
    BUSBAR_VOL VARCHAR2(5)
    OT_DETAILS VARCHAR2(2000)
    SQL> desc EMP_OT
    Name Null? Type
    STAFF_ID NOT NULL VARCHAR2(8)
    COMPLAIN_NO NOT NULL NUMBER(5)
    INC_TYPE_CODE NOT NULL VARCHAR2(10)
    HOLIDAY NUMBER
    Each employee associated with primary key i.e COMPLAIN_NO and INC_TYPE_CODE
    in each OVERTIME table record we may have more than one employee in EMP_OT table.
    above detail may clear my query.
    Thanks and Regards,
    Khawar.

  • Replacing multiple strings for many occurance of single string   in OBIEE a

    Hi,
    I have a requirement like i need to replace a Particular string('_') that occur three times in a string.I need to replace different strings for each occurance of ('_').
    My requirement is like this,
    My string is 'A_B_C_D' and I need to replace first'_' as 'E=' second '_' as 'F=' third '_' as 'G='.
    and the final string should be I=A E=B F=C G=D...
    Can any one help me in the logic or else help me how to use the existing functions in answers.

    Hi,
    We have Replace function in Answers which would replace all occurunces of a particular character with another. To achieve your requirement, you will need to split your string and apply replace function on each part and finally concatenate again.
    For e.g. your string is 'A_B_C_D'
    You need to split into, below
    A_
    B_
    C_
    D
    Apply Replace function to first three parts and then finally concatenate.
    Replace('A_','_','E=') || Replace('B_','_','F=') || Replace('C_','_','G=') || 'D'
    To split the string into parts you may have to use substring and locate functions.
    Refer the below thread too.
    Re: extract a part of a string in a full  string
    Thanks

  • Function - Return More than One Value in a Concatenated String

    Hi,
    Is it possible for a function to return a concatenated string(combining more than one number). I am trying to return the PO number by inputting and invoice_id and code number but an invoice_id can have more than one PO with the same code number. I would like to concatenate the PO numbers with commas e.g.
    10124, 10090, 10987
    At the moment the function returns null for these cases that have more than one PO number.
    Thanks

    Also is is possible to create another function that can be called in the same script using the PO number as an IN parameter in SQL. See SQL below:
    select cck.concatenated_segments as "Segment" ,
    cc.code_combination_id,
    NVL ( src . user_je_source_name , '**********' ) AS "Source" ,
    NVL ( cat . user_je_category_name , '**********' ) AS "Category" ,
    jel . period_name as "Period Name" ,
    i.invoice_id as "Invoice ID",
    s.vendor_name as "Vendor Name",
    s.segment1 as "Supplier No",
    jeb . name as "Batch Name" ,
    func_get_po(i.invoice_id, cc.code_combination_id) "PO No",
    jeh . name AS "Header Name" ,
    jel . description AS "Description" ,
    jel.accounted_dr AS "Debit" ,
    jel.accounted_cr AS "Credit" ,
    NVL(jel.accounted_dr, 0) - NVL(jel.accounted_cr, 0) AS "Net Amount"
    FROM apps.gl_code_combinations cc ,
    apps.gl_code_combinations_kfv cck,
    apps.gl_je_lines jel ,
    apps.gl_je_headers jeh ,
    apps.gl_je_batches jeb ,
    apps.gl_je_categories cat ,
    apps.gl_je_sources src,
    apps.gl_import_references r,
    apps.xla_ae_lines al,
    apps.xla_ae_headers ah,
    apps.xla_events e,
    xla.xla_transaction_entities te,
    apps.ap_invoices_all i,
    apps.ap_suppliers s
    WHERE ( cck.concatenated_segments BETWEEN '23.83545.141.000.00.23.000.000' AND '23.83545.141.000.00.23.000.000'
    AND cc.CHART_OF_ACCOUNTS_ID = 50328
    AND jeh.LEDGER_ID IN
    (select acc.ledger_id
    FROM apps.gl_access_set_ledgers acc
    WHERE acc.access_set_id = 1000
    AND jel.code_combination_id = cc.code_combination_id
    AND cck.code_combination_id = cc.code_combination_id
    AND jel.status
    || '' = 'P'
    AND ( jel.accounted_dr != 0
    OR jel.accounted_cr != 0 )
    AND jeh.je_header_id = jel.je_header_id
    AND jeh.actual_flag = 'A'
    AND 1 = 1
    AND jeh.currency_code != 'STAT'
    AND jeb.je_batch_id = jeh.je_batch_id
    AND jeb.average_journal_flag = 'N'
    and src.je_source_name = jeh.je_source
    and cat.je_category_name = jeh.je_category
    and r.je_header_id(+) = jel.je_header_id
    and r.je_line_num(+) = jel.je_line_num)
    AND ( :period_name = jel.period_name
    and al.gl_sl_link_id(+) = r.gl_sl_link_id
    and al.ae_header_id = ah.ae_header_id(+)
    and al.application_id = ah.application_id(+)
    and ah.application_id = e.application_id(+)
    and ah.event_id = e.event_id(+)
    and e.application_id = te.application_id(+)
    and e.entity_id = te.entity_id(+)
    and nvl(te.source_id_int_1,-99) = i.invoice_id(+)
    and i.vendor_id = s.vendor_id(+) )
    AND ( jel.ledger_id = 2041)
    ORDER BY src.user_je_source_name ,
    cat.user_je_category_name ,
    jeb.name ,
    jeh.name ,
    cck.concatenated_segments ,
    jel.je_line_num
    I am using func_get_po(i.invoice_id, cc.code_combination_id), I would like to call another function in this script that uses the PO number as an IN parameter.
    For example func_get_po_requester(i.invoice_id, cc.code_combination_id, func_get_po(i.invoice_id, cc.code_combination_id))
    Would this work?
    Thanks

  • SQL help: return number of records for each day of last month.

    Hi: I have records in the database with a field in the table which contains the Unix epoch time for each record. Letz say the Table name is ED and the field utime contains the Unix epoch time.
    Is there a way to get a count of number of records for each day of the last one month? Essentially I want a query which returns a list of count (number of records for each day) with the utime field containing the Unix epoch time. If a particular day does not have any records I want the query to return 0 for that day. I have no clue where to start. Would I need another table which has the list of days?
    Thanks
    Ray

    Peter: thanks. That helps but not completely.
    When I run the query to include only records for July using a statement such as following
    ============
    SELECT /*+ FIRST_ROWS */ COUNT(ED.UTIMESTAMP), TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD') AS DATA
    FROM EVENT_DATA ED
    WHERE AGENT_ID = 160
    AND (TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY')+(ED.UTIMESTAMP/86400)), 'MM/YYYY') = TO_CHAR(SYSDATE-15, 'MM/YYYY'))
    GROUP BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD')
    ORDER BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD');
    =============
    I get the following
    COUNT(ED.UTIMESTAMP) DATA
    1 07/20
    1 07/21
    1 07/24
    2 07/25
    2 07/27
    2 07/28
    2 07/29
    1 07/30
    2 07/31
    Some dates donot have any records and so no output. Is there a way to show the missing dates with a COUNT value = 0?
    Thanks
    Ray

  • Return to vendor via delivery, customer number for each vendor?

    Hi
    We wish to use return materials to Vendor via delivery process
    addition to required configuration, we need to maintain Customer number in Vendor master
    In out plant we have more than 500 Vendor masters, do we need to create customer number for each vendor? or can we create a generic customer ????
    Business has a concern on creating customer for each vendor since number is huge, Sales guys may get confused with these numbers
    Please suggest a way out
    Thanks

    Thanks Jurgen for the reply
    We have Vendor Work flow setup in the system. Which means when ever vendor master is changed [Return indicator ticked] workflow kicks off which means it goes for approvals. This is why we dont want to go for tick as and when needed. When ever there is a return, return to vendor must be ticked, it will go for approval etc so it slows the process
    we are thinking if we can achieve through data load before SAP GO-Live so that users able to return without any delay
    NOTE 447070 says 'the automatic creation of the required customer data is not supported in the data transfer'
    this is related to automatic customer create isnt it
    i was thinking as below
    --> Create Ship-to's for all vendors
    --> Load vendors via LSMW [along with return to vendor ticked and customer number(created above)]
    Tested in SAP
    created ship-to
    Created vendor with above customer number
    Do you see any issue?
    Thanks

  • For each EMPLOYEE, the Concatenated DESCRIPTION of the employees.

    for each EMPLOYEE (Table IN),
    the Concatenated DESCRIPTION of the employees (Table OUT).
    Table IN:
    EMPLOYEE DESCRIPTION
    Weiss "pay 3$"
    Weiss "pay 1$"
    Weiss "pay 4$"
    De Haan "7$"
    De Haan "8$"
    Table OUT:
    EMPLOYEE ALL_DESCRIPTION
    Weiss "pay 3$pay 1$pay 4$"
    De Haan "7$8$"
    for each EMPLOYEE, the Concatenated DESCRIPTION of the employees.
    How make from table IN -> table OUT?

    I don't know exactly what you mean by Table IN and Table OUT, but the next query will give you a clue:
    SQL> create table table_in
      2  as
      3  select 'Weiss' employee, 'pay 3$' description from dual union all
      4  select 'Weiss', 'pay 1$' from dual union all
      5  select 'Weiss', 'pay 4$' from dual union all
      6  select 'De Haan', '7$' from dual union all
      7  select 'De Haan', '8$' from dual
      8  /
    Tabel is aangemaakt.
    SQL> select employee
      2       , d all_description
      3    from ( select employee
      4                , d
      5                , rn
      6             from table_in
      7            model
      8                  partition by (employee)
      9                  dimension by (row_number() over (partition by employee order by null) rn)
    10                  measures (cast(description as varchar2(100)) d)
    11                  rules
    12                  ( d[any] order by rn desc = d[cv()] || d[cv()+1]
    13                  )
    14         )
    15   where rn = 1
    16  /
    EMPLOYE ALL_DESCRIPTION
    Weiss   pay 1$pay 3$pay 4$
    De Haan 7$8$
    2 rijen zijn geselecteerd.Regards,
    Rob.

  • Calling a stored procedure for each row returned

    I need to call a stored procedure for each row returned by a repeating frame. I called the stored procedure from the repeating frame format trigger, but that did not work( it did no populated the tables populated by the stored procedure)
    How can I call a stored procedure for each row returned by a repeating frame.
    Thank you

    Include it as a formula column in your data model.

  • Maximum length of query string for functions return a SELECT

    Hi all,
    I have a report that gets it's SELECT statement from a function, instead of being coded into the region. All was well but I suspect now I'm blowing some kind of limit as I'm getting an error :
         ORA-06502: PL/SQL: numeric or value error
         Error      ERR-1101 Unable to process function body returning query.
    However if I run the procedure out of ApEx and grab the SELECT statement then it works fine. The length of the query is 8636 bytes (yup, it's a beauty!).
    Does anyone know if there is a hard limit to the size of the string that can be returned?
    I'm using ApEx 3.1.
    Thanks,
    Steve H

    I do have a similar painfull scenario - Although my query length is very less i.e 618 bytes only.
    I have defined a stored function, which returns an SQL query string, this return SQL string executes fantastic but when I tried to to call this function from a APEX report it gives error. the details are as follows. Please help.......
    The function code:
    CREATE OR REPLACE function PROD."TEST_C_QRY"
    return VARCHAR2
    is
    msql VARCHAR2(32767);
    Begin
    msql:='Select null,statusname,AgeInd, ';
    For m_stat in (select statusname from a02_status)
    loop
    msql:= msql || q'[decode(statusname,']';
    msql:= msql || m_stat.statusname;
    msql:= msql || q'[',count(id),0) ]';
    msql:= msql || m_stat.statusname|| ',';
    end loop;
    msql:=rtrim(msql,',');
    msql:= msql||' from ';
    msql:= msql||'( ';
    msql:= msql||'select a.id, round(sysdate-a.registeredon) TimeSpan,';
    msql:= msql||'case ';
    msql:= msql||q'[when round(sysdate-a.registeredon)<=7 then 'Week' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' ]';
    msql:= msql||q'[else 'More...'  end ageind,]';
    msql:= msql||'a.status_id,b.statusname ';
    msql:= msql||'from a02_task a,a02_status b ';
    msql:= msql||'where b.id=a.status_id) ';
    msql:= msql||'group by statusname,AgeInd;';
    return msql;
    end TEST_C_QRY;
    The Output SQL comes from this is
    SQL> Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,
    'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round
    (sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then
    'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    The result that comes when I execute the above resultant SQL is as follows.
    N STATUSNAME AGEIND SCHEDULED EXECUTING COMPLETED
    Completed More... 0 0 4
    Completed Week 0 0 1
    Scheduled Week 1 0 0
    Completed Month 0 0 3
    Executing More... 0 1 0
    Executing Month 0 6 0
    Scheduled More... 1 0 0
    7 rows selected.
    But the surprising error that comes from Oracle XE when I use the following code for stacked bar chart
    Code:
    begin
    return TEST_D_QRY;
    end;
    Error thrown by XE report builder is as follows:
    1 error has occurred
    Failed to parse SQL query!
    Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).
    Regards,
    Soumen

  • Last() not returning correct value within for-each-group

    I've found inconsistent results between JDeveloper and SOA Suite using the xslt 2.0 for-each-group construct.
    &lt;xsl:for-each-group select="Po/PoLine" group-by="itemId"&gt;
    &lt;xsl:if test="position()=1"&gt;
    &lt;GroupCount&gt;
    &lt;xsl:value-of select="last()"/&gt;
    &lt;/GroupCount&gt;
    &lt;/xsl:if&gt;
    &lt;/xsl:for-each-group&gt;
    What I expect is the function last() to give me the number of groups which is the unique number of itemIds.
    In JDeveloper 10.1.3.4, testing this construct gives me what I expect.
    At run-time (deployed to 10.1.3.3 SOA Suite), the value returned is the total number of records, not the number of groups.
    For example, given the following XML
    &lt;Po&gt;
    &lt;PoLine&gt;
    &lt;itemId&gt;<strong>001</strong>&lt;/itemId&gt;
    &lt;description&gt;Hammer&lt;/description&gt;
    &lt;quantity&gt;10&lt;/quantity&gt;
    &lt;/PoLine&gt;
    &lt;PoLine&gt;
    &lt;itemId&gt;<strong>001</strong>&lt;/itemId&gt;
    &lt;description&gt;Hammer&lt;/description&gt;
    &lt;quantity&gt;10&lt;/quantity&gt;
    &lt;/PoLine&gt;
    &lt;PoLine&gt;
    &lt;itemId&gt;<strong>002</strong>&lt;/itemId&gt;
    &lt;description&gt;Nail&lt;/description&gt;
    &lt;quantity&gt;10&lt;/quantity&gt;
    &lt;/PoLine&gt;
    &lt;/Po&gt;
    Grouping by <strong>itemId</strong>, last() should return 2 as there are two groups (001 and 002). JDeveloper does this.
    When deployed to SOA Suite, last() returns 3.
    Any ideas?

    Hi,
    if JDeveloper is doing the right thing then this issue should be reported to the SOA Suite forum or BPEL BPEL , what do you think ?
    Frank

Maybe you are looking for

  • Number fields in select expert

    I am currently using Crystal 2008 and I am having issues with numeric values entered in the select expert. The record selection criteria that I have entered is {HSP_BKT.BKT_ID} in [94633, 94920] however, crystal defaults/converts to these numbers wit

  • Horizontal scroll in webdynpro java table

    Hello, I have a webdynpro java application in which i have a table with 15 columns. I have set the scrollableColCount property of the table to 5. Now on click of some link(LinkToAction), i want to scroll horizontally to column 8. Can i do this from t

  • Browser right click context menu

    Hello Everyone, I want to get the browser right click context menu in the WD Application when they are running in portal. We don't want the SAP Default context menu, which is confusing for our end-users. Is there a way of disabling this. I would appr

  • How to convert Oracle User defined datatype to SQL Server 2014 using SSMA Version 6.0

    I am trying to convert Oracle 11g OE schema to SQL Server 2014, using SSMA version 6.0 Getting an error in converting the Oracle View to SQL Server CREATE OR REPLACE VIEW OC_CUSTOMERS OF OE.CUSTOMER_TYP WITH OBJECT IDENTIFIER (customer_id) AS SELECT

  • Camera issue after upgrade

    I Just upgraded to the ios6.1 and now my camera isn't working at all. Anyone else have this issue?