Help to write using anlytical functions or singe count instead of many

HI,
Could you some one help to write as single count instead of many (.Or) Is there any way to write below query using analytical functions?
SELECT paper_code,paper_code_description, numCandidates, cast(numAwaitingApproval as varchar2(10)) as numAwaitingApproval, (numawaitingtrans + numawaitingibtran) as numAwaitingSubmission, (numibsub + numsub) as numSubmittedForMarking
       FROM(
         SELECT e.paper_code,
  translate_paper(e.paper_code,:v_year,:v_month,:v_iblanguage,:v_paper_type) AS paper_code_description,
  COUNT(e.candidate)                                                     AS numcandidates,
  COUNT(DECODE(status, 'AWAITING AUTHENTICATION',1))                     AS numAwaitingApproval,
  COUNT(DECODE(status, 'AWAITING TRANSFER',1))                           AS numawaitingtrans,
  COUNT(DECODE(status, 'AWAITING IB TRANSFER',1))                        AS numawaitingibtran,
  COUNT(DECODE(status, 'SUBMITTED',1))                                   AS numsub,
  COUNT(DECODE(status, 'IB SUBMITTED',1))                                AS numibsub
FROM e_assessment_cands e,
  candidate_component_reg ccr,
  person_subject_session pss
WHERE e.year                = :v_year
AND e.month                 = :v_month
AND e.e_coursework          = :v_e_coursework
AND e.school_code           = :v_school_code
AND ccr.split_session_year  = e.year
AND ccr.split_session_month = e.month
AND ccr.candidate           = e.candidate
AND ccr.paper_code          = e.paper_code
AND ccr.subject             =:v_subject
AND ccr.subject_option      =COALESCE(:v_subject_option,ccr.subject_option)
AND ccr.lvl                 =COALESCE(:v_lvl,ccr.lvl)
AND ccr.language            =COALESCE(:v_language,ccr.language)
AND ccr.component           =COALESCE(:v_component,ccr.component)
AND pss.year                = ccr.split_session_year
AND pss.month               = ccr.split_session_month
AND pss.subject             = ccr.subject
AND pss.lvl                 = ccr.lvl
AND pss.subject_option      = ccr.subject_option
AND pss.language            = ccr.language
AND pss.role                = :v_role
AND pss.person_code         = :v_person_code
GROUP BY e.paper_code)

Hi,
user575115 wrote:
HI,
Could you some one help to write as single count instead of many (.Or) If you're using Oracle 11, look at SELECT ... PIVOT.
If you'd like help. post CREATE TABLE and INSERT statements for some sample data, and the results you want from that data.
Always say which version of Oracle you're using.
Given that you need numCnadidates and numAwaitingApproval, using COUNT twice seems to be the simplest and most efficient way to do it.
If you don't need the other COUNTs, such as numawaitingtrans, then don't compute them.
Is there any way to write below query using analytical functions?Analytic functions can give you a COUNT without reducing the result set to one row per group. It lookw like you do want to reduce the result set to one row per group, however, so I don't see how analytic functions would help in this problem.

Similar Messages

  • Help me on using GUI_UPLOAD function

    Dear my friends,
    I am using GUI_UPLOAD function to upload a file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
      filename contain file path
        FILENAME                      = filepath
      filetype is ASC
        FILETYPE                      = 'ASC'
      Use tab key to seperate field
        HAS_FIELD_SEPARATOR           = ','
      Internal table keep data from file by function GUI_UPLOAD
        TABLES
            data_tab   =   tblTrantable.
    but it did not work for HAS_FIELD_SEPARATOR option.
    although i tried to use HAS_FIELD_SEPARATOR = '#'
    but system still return by fix lengh data column not by separator.
    <u>note : my SAP version = 4.6C</u>
    Please help me,
    Thanks !
    Message was edited by:
            Quoc Luc Nguyen
    Message was edited by:
            Quoc Luc Nguyen

    hi,
    set has field separartor to 'x'.
    chk this FM for example:
    CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
           FILENAME                      = W_FILENAME1
          FILETYPE                      = W_FILETYPE1
          HAS_FIELD_SEPARATOR           = 'X'
         HEADER_LENGTH                 = 0
         READ_BY_LINE                  = 'X'
          DAT_MODE                      = 'X'
         CODEPAGE                      = ' '
         IGNORE_CERR                   = ABAP_TRUE
         REPLACEMENT                   = '#'
         CHECK_BOM                     = ' '
         VIRUS_SCAN_PROFILE            =
         NO_AUTH_CHECK                 = ' '
       IMPORTING
         FILELENGTH                    =
         HEADER                        =
         TABLES
           DATA_TAB                      = IT_UPLOAD
        EXCEPTIONS
          FILE_OPEN_ERROR               = 1
          FILE_READ_ERROR               = 2
          NO_BATCH                      = 3
          GUI_REFUSE_FILETRANSFER       = 4
          INVALID_TYPE                  = 5
          NO_AUTHORITY                  = 6
          UNKNOWN_ERROR                 = 7
          BAD_DATA_FORMAT               = 8
          HEADER_NOT_ALLOWED            = 9
          SEPARATOR_NOT_ALLOWED         = 10
          HEADER_TOO_LONG               = 11
          UNKNOWN_DP_ERROR              = 12
          ACCESS_DENIED                 = 13
          DP_OUT_OF_MEMORY              = 14
          DISK_FULL                     = 15
          DP_TIMEOUT                    = 16
          OTHERS                        = 17.
            IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
    regards,
    keerthi

  • Search help in  output(using alvgrid function module)

    HEllo Experts,
        I hav developed report using ALV grid function module, now my req is I need to provide the search help for particular field in the output.
    my output contains .MATNO, PLANT AND STORAGE LOCATION.
    Now based on mat and plant I need to provide the F4 help for storage location field in the out put.
    could u pls anbody help me on the req asap. with details code.
    will give u Full point if it suits my req....

    Hi Raja,
    This is what you can try to do....first select the sales org and distribution channel for the value entered in the material in an 2 separate internal tables.
    Then use the FM 'F4IF_INT_TABLE_VALUE_REQUEST' for each internal table to get a search help for the sales org and distribution channel for any particular material number.
    Please write the code at AT SELECTION-SCREEN ON VALUE-REQUEST event.
    or,
    try this code.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_salesorg.
    select salesorg from tablename into itab where matnr = p_matnr(selction screen value).
    if sy-subrc eq 0.
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
    ENDPOS_COL =
    ENDPOS_ROW =
    STARTPOS_COL =
    STARTPOS_ROW =
    TITLETEXT =
    TITLETEXT =
    IMPORTING
    CHOISE = W_LINEN0
    TABLES
    VALUETAB = itab
    EXCEPTIONS
    BREAK_OFF = 1
    OTHERS = 2.
    IF SY-SUBRC EQ 0.
    READ TABLE itab INDEX W_LINENO.
    IF SY-SUBRC EQ 0.
    P_salesorg = itab-salesorg.
    endif.
    endif.
    similarly for distribution channel pass sales org ....
    kindly reward if found helpful.
    cheers,
    Hema.

  • Help to write using for all insted of cursor

    Hi,
    Can some one help to rewrite the pl/sql block using FOR ALL.
    DECLARE
      CURSOR c1
      IS
        SELECT SC.ASSESSMENT_TYPE
          || '_EXAMINER' ass,PORTFOLIO_COMMENT_ID
          --BULK COLLECT INTO l_tab
        FROM ibis.CANDIDATE_COMPONENT_REG CCR
        INNER JOIN ibis.CANDIDATE_EXAMINER_ALLOCATION CEA
        ON CCR.SPLIT_SESSION_YEAR  =CEA.YEAR
        AND CCR.SPLIT_SESSION_MONTH=CEA.MONTH
        AND CCR.ASSESSMENT_SCHOOL  =CEA.ASSESSMENT_SCHOOL
        AND CCR.PAPER_CODE         =CEA.PAPER_CODE
        AND CCR.CANDIDATE          =CEA.CANDIDATE
        INNER JOIN ibis.subject_component sc
        ON SC.YEAR            = CCR.SPLIT_SESSION_YEAR
        AND SC.MONTH          = CCR.SPLIT_SESSION_MONTH
        AND SC.PAPER_CODE     = CCR.PAPER_CODE
        AND SC.SUBJECT        = CCR.SUBJECT
        AND SC.SUBJECT_OPTION = CCR.SUBJECT_OPTION
        AND SC.LVL            = CCR.LVL
        AND SC.COMPONENT      = CCR.COMPONENT
        AND SC.LANGUAGE       = CCR.LANGUAGE
        INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
        ON CCP.PAPER_CODE =cea.PAPER_CODE
        AND cea.CANDIDATE =CCP.CANDIDATE
        AND cea.year      =CCP.YEAR
        AND cea.month     =CCP.MONTH
        INNER JOIN ibis.cw_portfolio_comments cpc
        ON cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
        AND cpc.examiner_code         = cea.examiner_code
        WHERE CCR.WITHDRAWN           ='N'
        AND CCP.STATUS_ID             = 'P004'
      UNION ALL
      SELECT SC.ASSESSMENT_TYPE
        || '_EXAMINER' ass, PORTFOLIO_COMMENT_ID
      FROM ibis.CANDIDATE_COMPONENT_REG CCR
      INNER JOIN ibis.CANDIDATE_EXAMINER_ALLOCATION CEA
      ON CCR.SPLIT_SESSION_YEAR  =CEA.YEAR
      AND CCR.SPLIT_SESSION_MONTH=CEA.MONTH
      AND CCR.ASSESSMENT_SCHOOL  =CEA.ASSESSMENT_SCHOOL
      AND CCR.PAPER_CODE         =CEA.PAPER_CODE
      AND CCR.CANDIDATE          =CEA.CANDIDATE
      INNER JOIN ibis.subject_component sc
      ON SC.YEAR             = CCR.SPLIT_SESSION_YEAR
      AND SC.MONTH           = CCR.SPLIT_SESSION_MONTH
      AND SC.PAPER_CODE      = CCR.PAPER_CODE
      AND SC.SUBJECT         = CCR.SUBJECT
      AND SC.SUBJECT_OPTION  = CCR.SUBJECT_OPTION
      AND SC.LVL             = CCR.LVL
      AND SC.COMPONENT       = CCR.COMPONENT
      AND SC.LANGUAGE        = CCR.LANGUAGE
      AND SC.ASSESSMENT_TYPE = 'INTERNAL'
      INNER JOIN ibis.subject_component sc1
      ON SC1.YEAR            = CCR.SPLIT_SESSION_YEAR
      AND SC1.MONTH          = CCR.SPLIT_SESSION_MONTH
      AND SC1.PAPER_CODE    != CCR.PAPER_CODE
      AND SC1.SUBJECT        = CCR.SUBJECT
      AND SC1.SUBJECT_OPTION = CCR.SUBJECT_OPTION
      AND SC1.LVL            = CCR.LVL
        --AND SC1.COMPONENT = CCR.COMPONENT
      AND SC1.LANGUAGE        = CCR.LANGUAGE
      AND SC1.ASSESSMENT_TYPE = 'EXTERNAL'
      INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
      ON CCP.PAPER_CODE =SC1.PAPER_CODE
      AND cea.CANDIDATE =CCP.CANDIDATE
      AND cea.year      =CCP.YEAR
      AND cea.month     =CCP.MONTH
      INNER JOIN ibis.cw_portfolio_comments cpc
      ON cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
      AND cpc.examiner_code         = cea.examiner_code
      WHERE 1                       = 1
      AND CCR.WITHDRAWN             ='N'
      AND CCP.STATUS_ID             = 'P004'
      UNION ALL
      SELECT SC.ASSESSMENT_TYPE
        || '_MODERATOR' ass ,PORTFOLIO_COMMENT_ID
      FROM cw_portfolio_comments cpc
      INNER JOIN examiner_moderator_allocation ema
      ON ema.moderator_code = cpc.examiner_code
      INNER JOIN examination_paper ep
      ON EMA.NO_LANG_CODE = EP.NO_LANG_CODE
      AND EMA.YEAR        = EP.YEAR
      AND EMA.MONTH       = EP.MONTH
      INNER JOIN
        (SELECT YEAR,
          MONTH,
          EXAMINER_CODE,
          PAPER_CODE,
          CANDIDATE
        FROM ibis.CANDIDATE_EXAMINER_ALLOCATION
        ) CEA
      ON EMA.YEAR           = CEA.YEAR
      AND EMA.MONTH         = CEA.MONTH
      AND EP.PAPER_CODE     = CEA.PAPER_CODE
      AND EMA.EXAMINER_CODE = CEA.EXAMINER_CODE
      INNER JOIN ibis.CANDIDATE_COMPONENT_REG CCR
      ON cea.YEAR                 = CCR.SPLIT_SESSION_YEAR
      AND cea.MONTH               = CCR.SPLIT_SESSION_MONTH
      AND cea.PAPER_CODE          = CCR.PAPER_CODE
      AND CEA.CANDIDATE           = CCR.CANDIDATE
      AND CCR.SAMPLED             = 'Y'
      AND CCR.DELETED_FROM_SAMPLE = 'N'
      AND CCR.WITHDRAWN           = 'N'
      INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
      ON cea.PAPER_CODE              = CCP.PAPER_CODE
      AND cea.CANDIDATE              = CCP.CANDIDATE
      AND cea.YEAR                   = CCP.YEAR
      AND cea.MONTH                  = CCP.MONTH
      AND cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
      INNER JOIN subject_component sc
      ON CCR.SPLIT_SESSION_YEAR   = SC.YEAR
      AND CCR.SPLIT_SESSION_MONTH = SC.MONTH
      AND CCR.SUBJECT             = SC.SUBJECT
      AND CCR.SUBJECT_OPTION      = SC.SUBJECT_OPTION
      AND CCR.LVL                 = SC.LVL
      AND CCR.LANGUAGE            = SC.LANGUAGE
      AND CCR.COMPONENT           = SC.COMPONENT;
    BEGIN
      FOR i IN c1
      LOOP
            UPDATE ibis.cw_portfolio_comments  SET EXAMINER_TYPE =i.ass
    where PORTFOLIO_COMMENT_ID=i.PORTFOLIO_COMMENT_ID;
      END LOOP;
    END;Edited by: user575115 on Nov 2, 2012 6:05 AM
    Edited by: user575115 on Nov 2, 2012 6:07 AM

    Hi,
    While running merge below error occurring.can you please advice.
    QL Error: ORA-30926: unable to get a stable set of rows in the source tables
    30926. 00000 -  "unable to get a stable set of rows in the source tables"
    *Cause:    A stable set of rows could not be got because of large dml
               activity or a non-deterministic where clause.
    *Action:   Remove any non-deterministic where clauses and reissue the dml.
    MERGE INTO ibis.cw_portfolio_comments cpc USING
    (SELECT SC.ASSESSMENT_TYPE
      || '_EXAMINER' ass,
      PORTFOLIO_COMMENT_ID
      --BULK COLLECT INTO l_tab
    FROM ibis.CANDIDATE_COMPONENT_REG CCR
    INNER JOIN ibis.CANDIDATE_EXAMINER_ALLOCATION CEA
    ON CCR.SPLIT_SESSION_YEAR  =CEA.YEAR
    AND CCR.SPLIT_SESSION_MONTH=CEA.MONTH
    AND CCR.ASSESSMENT_SCHOOL  =CEA.ASSESSMENT_SCHOOL
    AND CCR.PAPER_CODE         =CEA.PAPER_CODE
    AND CCR.CANDIDATE          =CEA.CANDIDATE
    INNER JOIN ibis.subject_component sc
    ON SC.YEAR            = CCR.SPLIT_SESSION_YEAR
    AND SC.MONTH          = CCR.SPLIT_SESSION_MONTH
    AND SC.PAPER_CODE     = CCR.PAPER_CODE
    AND SC.SUBJECT        = CCR.SUBJECT
    AND SC.SUBJECT_OPTION = CCR.SUBJECT_OPTION
    AND SC.LVL            = CCR.LVL
    AND SC.COMPONENT      = CCR.COMPONENT
    AND SC.LANGUAGE       = CCR.LANGUAGE
    INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
    ON CCP.PAPER_CODE =cea.PAPER_CODE
    AND cea.CANDIDATE =CCP.CANDIDATE
    AND cea.year      =CCP.YEAR
    AND cea.month     =CCP.MONTH
    INNER JOIN ibis.cw_portfolio_comments cpc
    ON cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
    AND cpc.examiner_code         = cea.examiner_code
    WHERE CCR.WITHDRAWN           ='N'
    AND CCP.STATUS_ID             = 'P004'
    UNION ALL
    SELECT SC.ASSESSMENT_TYPE
      || '_EXAMINER' ass,
      PORTFOLIO_COMMENT_ID
    FROM ibis.CANDIDATE_COMPONENT_REG CCR
    INNER JOIN ibis.CANDIDATE_EXAMINER_ALLOCATION CEA
    ON CCR.SPLIT_SESSION_YEAR  =CEA.YEAR
    AND CCR.SPLIT_SESSION_MONTH=CEA.MONTH
    AND CCR.ASSESSMENT_SCHOOL  =CEA.ASSESSMENT_SCHOOL
    AND CCR.PAPER_CODE         =CEA.PAPER_CODE
    AND CCR.CANDIDATE          =CEA.CANDIDATE
    INNER JOIN ibis.subject_component sc
    ON SC.YEAR             = CCR.SPLIT_SESSION_YEAR
    AND SC.MONTH           = CCR.SPLIT_SESSION_MONTH
    AND SC.PAPER_CODE      = CCR.PAPER_CODE
    AND SC.SUBJECT         = CCR.SUBJECT
    AND SC.SUBJECT_OPTION  = CCR.SUBJECT_OPTION
    AND SC.LVL             = CCR.LVL
    AND SC.COMPONENT       = CCR.COMPONENT
    AND SC.LANGUAGE        = CCR.LANGUAGE
    AND SC.ASSESSMENT_TYPE = 'INTERNAL'
    INNER JOIN ibis.subject_component sc1
    ON SC1.YEAR            = CCR.SPLIT_SESSION_YEAR
    AND SC1.MONTH          = CCR.SPLIT_SESSION_MONTH
    AND SC1.PAPER_CODE    != CCR.PAPER_CODE
    AND SC1.SUBJECT        = CCR.SUBJECT
    AND SC1.SUBJECT_OPTION = CCR.SUBJECT_OPTION
    AND SC1.LVL            = CCR.LVL
      --AND SC1.COMPONENT = CCR.COMPONENT
    AND SC1.LANGUAGE        = CCR.LANGUAGE
    AND SC1.ASSESSMENT_TYPE = 'EXTERNAL'
    INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
    ON CCP.PAPER_CODE =SC1.PAPER_CODE
    AND cea.CANDIDATE =CCP.CANDIDATE
    AND cea.year      =CCP.YEAR
    AND cea.month     =CCP.MONTH
    INNER JOIN ibis.cw_portfolio_comments cpc
    ON cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
    AND cpc.examiner_code         = cea.examiner_code
    WHERE 1                       = 1
    AND CCR.WITHDRAWN             ='N'
    AND CCP.STATUS_ID             = 'P004'
    UNION ALL
    SELECT SC.ASSESSMENT_TYPE
      || '_MODERATOR' ass,
      PORTFOLIO_COMMENT_ID
    FROM cw_portfolio_comments cpc
    INNER JOIN examiner_moderator_allocation ema
    ON ema.moderator_code = cpc.examiner_code
    INNER JOIN examination_paper ep
    ON EMA.NO_LANG_CODE = EP.NO_LANG_CODE
    AND EMA.YEAR        = EP.YEAR
    AND EMA.MONTH       = EP.MONTH
    INNER JOIN
      (SELECT YEAR,
        MONTH,
        EXAMINER_CODE,
        PAPER_CODE,
        CANDIDATE
      FROM ibis.CANDIDATE_EXAMINER_ALLOCATION
      ) CEA
    ON EMA.YEAR           = CEA.YEAR
    AND EMA.MONTH         = CEA.MONTH
    AND EP.PAPER_CODE     = CEA.PAPER_CODE
    AND EMA.EXAMINER_CODE = CEA.EXAMINER_CODE
    INNER JOIN ibis.CANDIDATE_COMPONENT_REG CCR
    ON cea.YEAR                 = CCR.SPLIT_SESSION_YEAR
    AND cea.MONTH               = CCR.SPLIT_SESSION_MONTH
    AND cea.PAPER_CODE          = CCR.PAPER_CODE
    AND CEA.CANDIDATE           = CCR.CANDIDATE
    AND CCR.SAMPLED             = 'Y'
    AND CCR.DELETED_FROM_SAMPLE = 'N'
    AND CCR.WITHDRAWN           = 'N'
    INNER JOIN ibis.CW_CANDIDATE_PORTFOLIO CCP
    ON cea.PAPER_CODE              = CCP.PAPER_CODE
    AND cea.CANDIDATE              = CCP.CANDIDATE
    AND cea.YEAR                   = CCP.YEAR
    AND cea.MONTH                  = CCP.MONTH
    AND cpc.candidate_portfolio_id = ccp.candidate_portfolio_id
    INNER JOIN subject_component sc
    ON CCR.SPLIT_SESSION_YEAR       = SC.YEAR
    AND CCR.SPLIT_SESSION_MONTH     = SC.MONTH
    AND CCR.SUBJECT                 = SC.SUBJECT
    AND CCR.SUBJECT_OPTION          = SC.SUBJECT_OPTION
    AND CCR.LVL                     = SC.LVL
    AND CCR.LANGUAGE                = SC.LANGUAGE
    AND CCR.COMPONENT               = SC.COMPONENT
    ) a ON (cpc.PORTFOLIO_COMMENT_ID=a.PORTFOLIO_COMMENT_ID)
    WHEN MATCHED THEN
      UPDATE SET cpc.EXAMINER_TYPE =a.ass;
      Edited by: user575115 on Nov 2, 2012 7:09 AM

  • Help in using listagg function for more than 8000 char.

    Hi Friends,
    Need you urgent help in using listagg function for more than 8000 char.
    I did the below sample SQL and in "e_orig" and "d_orig" for upto 4000 char it is working fine but I have to use it for more than 8000 char. and it is giving error,
    I checked the listagg function is having limitation of 4000 char.
    I tried but I am unable to achive this. Can someone provide me a sample example to achive this
    select d.dname,d.loc,e.hiredate
    ,listagg(e.ename,',' ) within group (order by e.deptno) over (partition by e.deptno) as e_orig
    ,listagg(e.ename, ',') within group (order by e.sal) over (partition by e.deptno) as d_orig
    from emp e, dept d
    where e.deptno=d.deptno;[ This is my first post, I gone through the guideline for posting a post , and try to go according to that ( I have not pasted here create table and insert as I have used basic table emp, dept for example), please let me know if still I should give this, I will take care from my next post ]
    Thanks in advance

    Interesting, I didn't know you could do that, but...
    BluShadow wrote:
    You could write some PL/SQL code that does it all for you, but that would involve loops and would be slow.Well, objects are written in PL/SQL aren't they? And presumably there'll be implicit looping too? So it's not at all obvious that this method will be faster than doing the joining in PL/SQL in memory. The only way to find out is to benchmark them - so I have done that.
    I noticed that OP's ref cursor actually only ever retrieves a single record for a bound department number, so I decided the best thing would be to test using a procedure that passes an output string back. I selected all (109) employees and put spaces in to ensure above 4000 characters. I also noticed that as he is using PL/SQL he probably can use a VARCHAR2 type, but just not ListAgg in the query, so I wrote short procedures as follows:
    SimpleAggChr     - bulk collect and array processing, VARCHAR2 output
    ClobAggPrc     - the custom aggregation method, CLOB output
    SimpleAggClob     - bulk collect and array processing, CLOB output
    I then wrote a driving script that calls them in the order above and times each call (I like benchmarking so I have my own timing object to make it easy). I then print the lengths for checking, and my object writes the timings to my output table. Running a few times I got varying results, but generally it looks like there isn't a lot to choose between them for performance.
    Here's the procedure code:
    CREATE OR REPLACE TYPE char100_list_type AS TABLE OF VARCHAR2(100)
    CREATE OR REPLACE PROCEDURE SimpleAggChr (x_out OUT VARCHAR2) IS
      l_enames     char100_list_type;
    BEGIN
      SELECT first_name || '                                        ' || last_name
        BULK COLLECT INTO l_enames
        FROM employees
       ORDER BY salary;
      FOR i IN 1..l_enames.COUNT LOOP
        x_out := x_out || l_enames(i) || ',';
      END LOOP;
    END SimpleAggChr;
    CREATE OR REPLACE PROCEDURE SimpleAggClob (x_out OUT CLOB) IS
      l_enames     char100_list_type;
    BEGIN
      SELECT first_name || '                                        ' || last_name
        BULK COLLECT INTO l_enames
        FROM employees
       ORDER BY salary;
      FOR i IN 1..l_enames.COUNT LOOP
        x_out := x_out || l_enames(i) || ',';
      END LOOP;
    END SimpleAggClob;
    SHO ERR
    PROMPT ClobAggPrc
    CREATE OR REPLACE PROCEDURE ClobAggPrc (x_out OUT CLOB) IS
    BEGIN
      SELECT clobagg(first_name || '                                        ' || last_name || ',')
        INTO x_out
        FROM employees
       ORDER BY salary;
    END ClobAggPrc;
    SHO ERRand the driving script:
    SET SERVEROUTPUT ON
    SET TIMING ON
    DECLARE
      l_enames_c1     CLOB;
      l_enames_c2     CLOB;
      l_enames_v     VARCHAR2(32767);
      l_timer     timer_set_type := timer_set_type ('Aggregation');
    BEGIN
      Utils.g_id := 'Aggregation';
      SimpleAggChr (l_enames_v);
      l_timer.Increment_Time ('SimpleAggChr');
      ClobAggPrc (l_enames_c1);
      l_timer.Increment_Time ('ClobAggPrc');
      SimpleAggClob (l_enames_c2);
      l_timer.Increment_Time ('SimpleAggClob');
      DBMS_Output.Put_Line ('SimpleAggChr returned string of length ' || Length (l_enames_v));
      DBMS_Output.Put_Line ('ClobAggPrc returned string of length ' || Length (l_enames_c1));
      DBMS_Output.Put_Line ('SimpleAggClob returned string of length ' || Length (l_enames_c2));
      l_timer.Write_Times;
    END;
    SET TIMING OFF
    SET LINES 150
    SET PAGES 1000
    COLUMN id FORMAT A30
    COLUMN line_text FORMAT A120
    SELECT line_text
      FROM output_log
    WHERE id = 'Aggregation'
    ORDER BY line_ind
    /and the results:
    SimpleAggChr returned string of length 5779
    ClobAggPrc returned string of length 5779
    SimpleAggClob returned string of length 5779
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:27.05
    LINE_TEXT
    Timer Set: Aggregation, constructed at 03 Nov 2011 16:27:07, written at 16:27:35
    ================================================================================
    [Timer timed: Elapsed (per call): 0.02 (0.000016), CPU (per call): 0.01 (0.000010), calls: 1000, '***' denotes corrected
    line below]
    Timer              Elapsed          CPU          Calls        Ela/Call        CPU/Call
    SimpleAggChr          9.84         0.36              1         9.84400         0.36000
    ClobAggPrc            9.37         0.32              1         9.37400         0.32000
    SimpleAggClob         8.25         0.22              1         8.25000         0.22000
    (Other)               0.00         0.00              1         0.00000         0.00000
    Total                27.47         0.90              4         6.86700         0.22500
    13 rows selected.

  • New to PL/SQL and need help on check sum using ASCII function

    Hello,
    Need your expertise to help in figuring out how to write
    code to calculate using ASCII function to return value for a character. For example ASCII('A') is 58. I want to do the check sum to sum-up the value for each character in the name. For example 'Jack'
    Appreciate your help.
    CK

    Hi,
    Please post all the technical queries in the respective forums. For more details and answers in SQL and PL/SQL, use the following forum:
    PL/SQL
    Sample PL/SQL code for your requirement:
    -- make sure you have the serveroutput on using command.
    -- set serveroutput on
    DECLARE
    sumval NUMBER(10);
    tempval NUMBER(10);
    colval VARCHAR2(20);
    BEGIN
    SELECT USER INTO colval FROM dual;
    sumval := 0;
    FOR i IN 1..LENGTH(colval)
    LOOP
    SELECT ASCII(SUBSTR(colval,i,1)) INTO tempval FROM dual;
    sumval := sumval+tempval;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('sum is: '||to_char(sumval));
    END;
    The output of this pl/sql block will be:
    sum is: 397
    Please note: ASCII('A') is 65 and not 58.
    Hope that helps.
    Savitha.
    http://otn.oracle.com/sample_code/content.html

  • Write to excel using Range function - Excel_write_range.vi

    I am using the write using range Excel function to dump some data into Excel.
    My data is an array consisting of decimal numbers (data type double) but I have to use "Number To Fractional String" before I can dump this array into Excel. And then when I open the output excel file, you have all these warnings for each cell saying, "number displayed as string". Is there a way to instead dump numbers (in format double) into the Excel. That way each cell in the excel output file will already be formatted as a number instead of string.
    Thanks in advance.

    I'm assuming you're actually using ActiveX to write out Excel files. I say this because a lot of people say "Excel files" when they're really talking about spreadsheet-formatted files, generated using the Write to Spreadsheet File VI. That said, the "Value" ("Value 2" in newer versions of Excel) is a variant, so you can wire any datatype to it. Just wire the numeric value directly.

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • My Macbook pro,s Airdrop isn't functional  plz help me to use it

    Hi everybody.
    My Macbook pro,s  Airdrop  isn't  functional  plz help me to use it.

    Mac Basics: AirDrop helps you share items with others nearby

  • Workflow Help - Using PRE function

    Hi,
    I need to create a workflow on "when modified record saved" trigger event using PRE function. I am currently using this syntax :
    (FieldValue('<IndexedPick0>')='Central') AND (FieldValue('<SalesStage>')='Qualified') OR (FieldValue('<SalesStage>')= 'Approach') OR (FieldValue('<SalesStage>')= 'Quote') OR (FieldValue('<SalesStage>')='Negotiation')
    What we want this workflow to do is to send an email only when a sales stage is modified or changed to the values above in the syntax, not anything else on the opportunity page.
    Waiting for a response.
    Thanks in advance
    Ahmed

    Hi !
    Try this :
    *&#91;&lt;IndexedPick0&gt;&#93; = 'Central' AND &#91;&lt;SalesStage&gt;&#93; &lt;&gt; PRE('&lt;SalesStage&gt;') AND (&#91;&lt;SalesStage&gt;&#93; = 'Qualified' OR &#91;&lt;SalesStage&gt;&#93; = 'Approach' OR &#91;&lt;SalesStage&gt;&#93; = 'Quote' OR &#91;&lt;SalesStage&gt;&#93; = 'Negotiation')*
    This will trigger only when salestage is modified to 1 of the 4 stages and indexedpick0 = 'Central'.
    Hope this will help, feel free to ask more !
    Max

  • I misplaced my ipad, so I remotely erased it.  Then I found it, but now I cannot use all of the options in the settings.  I have restored from backup, but it still is not letting me use all functionality.  Help!

    I misplaced my ipad, so I remotely erased it.  Then I found it, but now I cannot use all of the options in the settings.  I have restored from backup, but it still is not letting me use all functionality.  Help!

    Would throwing it in Recovery mode and restoring as new clear it up?
    (same for Ipad)
    Step 1: Turn off the iPhone. To do this press and hold the power button till you see the “Slide to Power off” screen. Now slide the button to turn it off.
    In case your iPhone is stuck in an infinite loop and the previous option is unavailable, press and hold the Power and Home button till the screen goes off. Remember to leave both the buttons as soon as the screen goes off and before the Apple logo appears again.
    Step 2: Connect the iPhone’s USB cable to your computer but not to your iPhone yet.
    Step 3: Now hold down the Home button and while you are holding it connect the USB cable. Keep holding the Home button till you see the Connect to iTunes screen on your iPhone(Screenshot shown below). iTunes will show an alert saying a device in recovery mode has been detected.
    Here’s what your iPhone screen will look like once its in the iPhone Recovery Mode.
    Read more: http://www.callingallgeeks.org/15018/how-to-put-iphone-or-ipod-touch-into-recove ry-mode/#ixzz296y04ygX
    Under Creative Commons License: Attribution No Derivatives
    THEN RESTORE THE DEVICE AND SETUP AS NEW. JUST YOU WILL HAVE TO DOWNLOAD YOUR APPS AGAIN(FREE) ETC....
    LEAST THE SECURITY WORKS HAHA!!! I also wouldnt get upset, be thankful you found it.

  • I am looking for a software to help me write in Ethiopic (Amharic) fonts just as I can using Tavultesoft keyman for Windows. Help?

    I am looking for a software to help me write in Ethiopic (Amharic) fonts the same way I use Tavultesoft Keyman in Windows. Can someone help?

    RMMT wrote:
    Try putting Summer Institute for Linguistics into Google and see if they have an Amharic font for you.
    Or just click on the url I provided earlier, which has a link to the exact SIL page.
    OS X already has an Amharic font, Kefa.  What you really need from SIL is the keyboard.

  • I have an ipod touch 3rd gen.I used the function of erasing all content and settings and now i am stuck on this screen with the apple logo and a loading sign for the past 17 hours.CAN SOMEONE PLEASE HELP!!!!!!!!!!!!

    i have an ipod touch 3rd gen.I used the function of erasing all contents and settings and now i am stuck with this screen showing the apple logo and the loading sign for the past 17 hours.CAN SOMEONE PLEASE HELP!!!!!!!!!!!!

    Hold down the on/off button and the home button for 20 to 30 sec, when the iPod starts and the Apple logo is on the screen release the on/off button but continue to hold the home button until you see the plug into iTunes screen.  Connect the iPod to iTunes and you should be good to go.

  • I have just updated my iPhone to version 5.1, and the camera button next to the "slide to unlock" button does not work at all. It used to function well before the update. Can someone help??

    I have just updated my iPhone to version 5.1. After the update, the camera button next to the "slide to unlock" button does not work at all. It used to function well before the update. It happens to my friends as well. What should I do? Can someone help?? Thanks!!!!

    Slide the camera button up

  • Hi, I have on my credit card monthly payments of fertilizer, and when I want to reveal to LR I get a reading indicating I should renew the subscription in order to use this function, alguine can help me ?? thx

    Hi, I have on my credit card monthly payments of fertilizer, and when I want to reveal to LR I get a reading indicating I should renew the subscription in order to use this function, alguine can help me ?? thx

    Thanks John, but this way is you get to this forum marinate options were
    not available
    2015-01-12 22:21 GMT-03:00 John T Smith <[email protected]>:
        Hi, I have on my credit card monthly payments of fertilizer, and when
    I want to reveal to LR I get a reading indicating I should renew the
    subscription in order to use this function, alguine can help me ?? thx
    created by John T Smith <https://forums.adobe.com/people/JohnTSmith> in *Adobe
    Creative Cloud* - View the full discussion
    <https://forums.adobe.com/message/7089860#7089860>

Maybe you are looking for

  • Message uses a character set that is not supported by the internet service

    Does any one have any advice on how to fix this problem? E-mails sent from my iphone 3G periodically arrive in an unreadable form at the recipient. The body of the e-mail has been replaced with the message "This message uses a character set that is n

  • How to Sort the report by clicking the column_header at runtime?

    Hi,<br /><br />Im New to Crystal Reports.<br /><br />Im Using Crystal report server XI. and JSP<br /><br />I need to  <strong>Sort</strong> the report by clicking the<strong> column_header</strong> at runtime.<br /><br />How to implement this ?<br />

  • Moving Elements 9 to Macbook?

    When I bought my old stationary PC I got a bundled version of Elements 9 (Photoshop and Premiere) with it. Since then I mainly use a Macbook for most of my media production and now of course I'd like to be able to move my Elements license to my Macbo

  • Oracle Express perfomance problem

    Hi, I am facing performance issues with following application in Oracle Express using OFA as front end. There are 9 dimensions in cube and one measure. DB size 18-20 GB. geography and time dimension is dense, all other are composite. Leaf level data

  • Manually arranging files in finder for slideshow order?

    I have a folder full of photo files from a recent vacation. Half of them are from my camera, half from my boyfriend's camera, and they all are named as the original file name the cameras gave them. I want to arrange them in chronological order, blend