ONE ROW COUNT

Hi
wat is the1 ROW COUNT key figure in reporting

Do you want to use the count in a query or just for informational purpose? If you want to use it in the query then check out this How-To paper:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7e58e690-0201-0010-fd85-a2f29a41c7af
If you want the count for informational purpose then you can just do a listcube and check the "Output Number of Hits" this will get you the count according to your selection criteria in list cube.
If you want the total count for the cube you can look at the database level via transaction se16 and look at the E and F table for the particular Infocube.

Similar Messages

  • How to Plot number and string in one row (data logger counter via MODBUS) ?

    hi all i made data log quantity using Digital Counter via modbus (RS-485) to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Solved!
    Go to Solution.
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Hi rhiesnand,
    right now you add 2 new rows to your array.
    The solution is to concatenate both row parts to one bigger 1D array before adding that array as new row to your 2D array!
    Like this:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to Plot number and string in one row (data logger counter) ?

    hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Duplicate and answered - http://forums.ni.com/t5/LabVIEW/How-to-Plot-number-and-string-in-one-row-data-logger-counter-via/m-p...

  • Counting consecutive numbers into one row

    Hello everyone,
    I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need. The pivoting function results to something like this:
    01,02,03,05,06,07,08,09,10,11,12,13,14,16,17,20,21,23,25What I actually need is something like this:
    1-17, 20-21,23,25I really don't know how to start solving this but so far I have the below query:
    SELECT DISTINCT
         MAX(DECODE(wldw.wafernumber,'01', '01'))
          || MAX(DECODE(wldw.wafernumber,'02', ',02'))
          || MAX(DECODE(wldw.wafernumber,'03', ',03'))
          || MAX(DECODE(wldw.wafernumber,'04', ',04'))
          || MAX(DECODE(wldw.wafernumber,'05', ',05'))
          || MAX(DECODE(wldw.wafernumber,'06', ',06'))
          || MAX(DECODE(wldw.wafernumber,'07', ',07'))
          || MAX(DECODE(wldw.wafernumber,'08', ',08'))
          || MAX(DECODE(wldw.wafernumber,'09', ',09'))
          || MAX(DECODE(wldw.wafernumber,'10', ',10'))
          || MAX(DECODE(wldw.wafernumber,'11', ',11'))
          || MAX(DECODE(wldw.wafernumber,'12', ',12'))
          || MAX(DECODE(wldw.wafernumber,'13', ',13'))
          || MAX(DECODE(wldw.wafernumber,'14', ',14'))
          || MAX(DECODE(wldw.wafernumber,'15', ',15'))
          || MAX(DECODE(wldw.wafernumber,'16', ',16'))
          || MAX(DECODE(wldw.wafernumber,'17', ',17'))
          || MAX(DECODE(wldw.wafernumber,'18', ',18'))
          || MAX(DECODE(wldw.wafernumber,'19', ',19'))
          || MAX(DECODE(wldw.wafernumber,'20', ',20'))
          || MAX(DECODE(wldw.wafernumber,'21', ',21'))
          || MAX(DECODE(wldw.wafernumber,'22', ',22'))
          || MAX(DECODE(wldw.wafernumber,'23', ',23'))
          || MAX(DECODE(wldw.wafernumber,'24', ',24'))
          || MAX(DECODE(wldw.wafernumber,'25', ',25'))  AS WAFERS     
    FROM a_wiplothistory wl
    JOIN Container C ON (wl.containerid = c.containerid OR wl.containerid= c.splitfromid )
    JOIN a_wiplotdetailshistory wld ON wl.wiplothistoryid = wld.wiplothistoryid
    JOIN a_wiplotdetailswafershistory wldw ON wld.wiplotdetailshistoryid = wldw.wiplotdetailshistoryid
    WHERE c.containername = :lotThanks for helping guys.
    Edited by: 1001275 on May 15, 2013 6:28 PM

    Hi,
    1001275 wrote:
    Hello everyone,
    I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need...You said it!
    First, you need some way of grouping consecutive rows together (1-17 in one group, 20-21 in anoter, 23 as a group all by itself, and so on).
    Then you need GROUP BY to get infmation about each goup, such as the smallest and largest number in the group.
    Finally, you need to combine all that information into one big string. This is actually an example of String Aggregation , rather than pivoting. The two are closely related. Pivot means you're taking 1 column on multiple rows, and putting them into multiple columns on one row. String Aggregation is taking 1 column on multple row, and concatenating all their contents into one big string column.
    Here's one way to do it:
    WITH     got_group_id     AS
         SELECT     wafernumber
         ,     ROW_NUMBER () OVER (ORDER BY wafernumber)
                      - wafernumber          AS group_id
         FROM     wldw
    ,     got_group_info     AS
         SELECT       TO_CHAR (MIN (wafernumber))
                || CASE
                         WHEN  COUNT (*) > 1
                    THEN  '-' || TO_CHAR (MAX (wafernumber))
                     END             AS group_label
         ,       ROW_NUMBER () OVER (ORDER BY  MIN (wafernumber))
                             AS group_num
         FROM      got_group_id
         GROUP BY  group_id
    SELECT  SUBSTR ( SYS_CONNECT_BY_PATH (group_label, ',')
                , 2
                )     AS txt
    FROM    got_group_info
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     group_num      = 1
    CONNECT BY     group_num     = PRIOR group_num + 1
         AND     prior sys_guid () is not null
    ;I find the first part of this query to be the trickiest. I used the Fixd Difference technique to assign a common group_id to consecutive rows. See {message:id=9953384} and/or {message:id=9957164} foran explantaion of the Fixed Difference technique.
    Next, in sub-query got_group_info, I used aggregate functions to produce a group_label, such as '1-17', and to assign consecutive numbers to each group. This is also a little tricy, because it involves nesting an aggregate function (MIN in this case) inside an analytc function (ROW_NUMBER).
    Finally, I used SYS_CONNECT_BY_PATH to do the string aggregation.
    Output:
    TXT
    1-17,20-21,23,25Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data. For example:
    CREATE TABLE     wldw
    (       wafernumber     NUMBER (3)     PRIMARY KEY
    INSERT INTO wldw (wafernumber) VALUES ( 1);
    INSERT INTO wldw (wafernumber) VALUES ( 2);
    INSERT INTO wldw (wafernumber) VALUES ( 3);
    INSERT INTO wldw (wafernumber) VALUES ( 4);
    INSERT INTO wldw (wafernumber) VALUES ( 5);
    INSERT INTO wldw (wafernumber) VALUES ( 6);
    INSERT INTO wldw (wafernumber) VALUES ( 7);
    INSERT INTO wldw (wafernumber) VALUES ( 8);
    INSERT INTO wldw (wafernumber) VALUES ( 9);
    INSERT INTO wldw (wafernumber) VALUES (10);
    INSERT INTO wldw (wafernumber) VALUES (11);
    INSERT INTO wldw (wafernumber) VALUES (12);
    INSERT INTO wldw (wafernumber) VALUES (13);
    INSERT INTO wldw (wafernumber) VALUES (14);
    INSERT INTO wldw (wafernumber) VALUES (15);
    INSERT INTO wldw (wafernumber) VALUES (16);
    INSERT INTO wldw (wafernumber) VALUES (17);
    INSERT INTO wldw (wafernumber) VALUES (20);
    INSERT INTO wldw (wafernumber) VALUES (21);
    INSERT INTO wldw (wafernumber) VALUES (23);
    INSERT INTO wldw (wafernumber) VALUES (25);I realize that your table (and your query) are a lot more complicated, but it looks like you can show the part you don't already understand using just this one table with this one column.
    Also, whenever you have a question, say which version oif Oracle you'e using (e.g., 11.2.0.2.0).
    The query above should work in Oracle 10.1 and up. I got the wong results in the main query in Oracle 10.2, however. (Oracle 10.2 has a lot of bugs related to CONNECT BY.) It worked fine in version 11.1.
    If you're using Oracle 11.2, you'll want to use LISTAGG, not SYS_CONNECT_BY_PATH, to do the string aggregation.
    For more about string aggregation in various versions of Oracle, see this Oracle Base page.

  • One row expected but not counted with resultSet.next()

    Hi all, I am using the following method to check an entry in my database. The problem is that the while(rs.next()) loop is not entered and therefore not counting the rows within the resultSet. This only occurs when one row is retrieved from the db. The query executed definitely works.
            private boolean enteredInDaily(String date, String chan)
              int rowCnt = 0;
              String query =  "SELECT id FROM daily WHERE " +
                   "name = '" + name+ "' AND " +
                   "start_date <= '" + date + "' AND " +
                   "finish_date >= '" + date + "'";          
              try {
                   Class.forName("org.gjt.mm.mysql.Driver");
                   Connection dbCon = DriverManager.getConnection("jdbc:mysql://localhost/dbname?user=&password=");
                   Statement stmt = dbCon.createStatement();
                   ResultSet rs = stmt.executeQuery(query);               
                   while(rs.next()) {
                                    //this loop not entered
                        System.out.println(rs.getInt("id"));
                        rowCnt++;
              catch(ClassNotFoundException ex) {
                                    System.out.println(ex); }
              catch(SQLException ex) {
                                    System.out.println(ex); }
              System.out.println("rowCnt = " + query);
              if (rowCnt == 0)
                   return false;
              else
                   return true;
         }Can anyone shed any light on this problem??? Thanks.

    How very silly of me!! I was connecting to the real database and not my test db. Sorry to waste a post.

  • Show Column Data In One Row

    Hello,
    Tell Me how i can show a single column data in one row.
    10
    20
    30
    To
    10,20,30

    If you are OK with displaying comma separated list or column data you could:
    SQL> select  ltrim(sys_connect_by_path(ename,','),',') ename_list
      2    from  (
      3           select  ename,
      4                   row_number() over(order by 1) rn,
      5                   count(*) over() cnt
      6             from  emp
      7          )
      8    where rn = cnt
      9    start with rn = 1
    10    connect by rn = prior rn + 1
    11  /
    ENAME_LIST
    SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,MILLER,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,CLARK
    SQL> To display as separate columns you would need to either know number of rows:
    SQL> select  min(case rn when 1 then ename else null end) ename1,
      2          min(case rn when 2 then ename else null end) ename2,
      3          min(case rn when 3 then ename else null end) ename3,
      4          min(case rn when 4 then ename else null end) ename4,
      5          min(case rn when 5 then ename else null end) ename5,
      6          min(case rn when 6 then ename else null end) ename6,
      7          min(case rn when 7 then ename else null end) ename7,
      8          min(case rn when 8 then ename else null end) ename8,
      9          min(case rn when 9 then ename else null end) ename9,
    10          min(case rn when 10 then ename else null end) ename10,
    11          min(case rn when 11 then ename else null end) ename11,
    12          min(case rn when 12 then ename else null end) ename12
    13    from  (
    14           select  ename,
    15                   rownum rn
    16             from  emp
    17          )
    18  /
    ENAME1  ENAME2  ENAME3  ENAME4  ENAME5  ENAME6  ENAME7  ENAME8  ENAME9  ENAME10  ENAME11  ENAME12
    SMITH   ALLEN   WARD    JONES   MARTIN  BLAKE   CLARK   SCOTT   KING    TURNER   ADAMS    JAMES
    SQL> or use dynamic SQL.
    SY.

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • How to find out which sub query returns more than one row

    Hi all,
    Can any one give me clue ,how to find out which sub query returns more than one row in the following query .
    /* Formatted on 2011/05/17 19:22 (Formatter Plus v4.8.8) */
    SELECT a.*, ROWNUM AS rnm
      FROM (SELECT DISTINCT '1' AS "Page View", ou.org_unit_name AS "Org",
                            prxm.mbr_idntfr AS "Beneficiary ID",
                               md.last_name
                            || ', '
                            || md.first_name AS "Beneficiary Name",
                            pci.idntfr AS "Tracking No.",
                            TO_CHAR (TRUNC (req.pa_rqst_date),
                                     'MM/dd/yyyy'
                                    ) AS "Request Date",
                            sts.status_name AS "Status",
                            req.pa_rqst_sid AS "Request #",
                            prxm.mbr_sid AS "Mbr_sid",
                            TO_CHAR
                                  (TRUNC (req.pa_revision_date),
                                   'MM/dd/yyyy'
                                  ) AS "Last Updated",
                            TO_CHAR (psd.TO_DATE, 'MM/dd/yyyy') AS "TO_DATE",
                            prxpl.prvdr_lctn_iid AS "PRVDR_LCTN_IID",
                            pd.prvdr_sid AS "PRVDR_SID", 'Y' AS "State View",
                            DECODE
                               ((SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                0, (SELECT prxplo.prvdr_lctn_idntfr
                                      FROM pa_request_x_provider_location prxplo
                                     WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                       AND prxplo.oprtnl_flag = 'A'
                                       AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT prxplo.prvdr_lctn_idntfr
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "NPI/ID",
                            DECODE
                               ((SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT    pd.last_name
                                              || ', '
                                              || pd.first_name
                                              || ' '
                                              || pd.middle_name
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "Prvdr Name",
                            TO_CHAR (psd.from_date,
                                     'MM/dd/yyyy'
                                    ) AS "Srvc From Date",
                            TO_CHAR (req.validity_start_date,
                                     'MM/DD/YYYY'
                                    ) AS "Due Date",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>Left",
                            req.pa_mode_type_lkpcd AS "Source",
                            TO_CHAR (TRUNC (wmdtl.rtng_date),
                                     'MM/dd/yyyy'
                                    ) AS "Assigned On",
                            NVL (wmdtl.assigned_to_user_name,
                                 'Not Assigned'
                                ) AS "Assigned To",
                            req.org_unit_sid AS "OrgUnitSid",
                            TO_CHAR
                                 (wmdtl.modified_date,
                                  'MM/dd/yyyy hh24:mi:ss'
                                 ) AS "WTRD_MODIFIED_DATE",
                            TO_CHAR (wmdtl.rtng_date,
                                     'MM/dd/yyyy'
                                    ) AS "WTRD_RTNG_DATE",
                            req.status_cid AS "PA_STATUS_CID",
                            TO_CHAR (req.modified_date,
                                     'MM/dd/yyyy'
                                    ) AS "PA_REQ_MODIFIED_DATE",
                            prs.state_pa_srvc_type_code
                                                     AS "STATE_PA_SRVC_TYPE_CODE",
                            wmdtl.wm_pa_task_rtng_dtl_sid
                                                        AS "WM_TASK_RTNG_DTL_SID",
                            wmdtl.assigned_to_user_acct_sid
                                              AS "WTRD_Assigned_to_user_acct_sid",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>LeftSort",
                            wmdtl.assigned_to_org_unit_sid
                                                  AS "WTRD_Assigned_to_OrgUntSid",
                            DECODE
                               ((SELECT COUNT (*)
                                   FROM pa_request_status prs
                                  WHERE prs.pa_rqst_sid = req.pa_rqst_sid
                                    AND prs.status_cid = 5
                                    AND prs.oprtnl_flag = 'I'),
                                0, 'N',
                                'Y'
                               ) AS "SHOW_UTILIZATION"
                       FROM   pa_request req,
                             pa_certification_identifier pci,
                             status sts,
                             pa_request_x_member prxm,
                             wm_pa_task_routing_detail wmdtl,
                             pa_service_date psd,
                             org_unit ou,
                             pa_request_service prs,
                             pa_request_x_provider_location prxpl,
                             provider_location pl,
                             provider_detail pd,
                             provider p,
                             mbr_dmgrphc md
                      WHERE req.oprtnl_flag = 'A'
                        AND req.status_cid NOT IN
                                     (20, 30, 70, 25, 80, 96, 85, 5, 97, 98, 101)
                        AND req.org_unit_sid IN
                               (3057, 3142, 3058, 3143, 3059, 3144, 3060, 3145,
                                3061, 3146, 3062, 3147, 3063, 3148, 3064, 3149,
                                3065, 3150, 3066, 3151, 3067, 3152, 3068, 3153,
                                3069, 3154, 3070, 3155, 3071, 3156, 3072, 3157,
                                3073, 3158, 3074, 3159, 3075, 3160, 3076, 3161,
                                3077, 3162, 3078, 3163, 3079, 3164, 3080, 3165,
                                3081, 3166, 3082, 3167, 3083, 3168, 3084, 3169,
                                3085, 3170, 3086, 3171, 3087, 3172, 3088, 3173,
                                3089, 3174, 3090, 3175, 3091, 3176, 3092, 3177,
                                3093, 3178, 3094, 3179, 3095, 3180, 3096, 3181,
                                3097, 3182, 3098, 3183, 3099, 3184, 3100, 3185,
                                3101, 3186, 3102, 3187, 3103, 3003, 75000104,
                                75000108, 2006, 75000103, 75000102, 75000113,
                                75000111, 75000109, 2001, 2009, 75000105,
                                75000107, 2004, 2010, 2013, 2014, 2005, 2011,
                                75000112, 2002, 1001, 2012, 75000106, 2007,
                                75000101, 2003, 75000110, 2008, 3001, 3002, 3019,
                                3104, 3020, 3105, 3021, 3106, 3022, 3107, 3023,
                                3108, 3024, 3109, 3025, 3110, 3026, 3111, 3027,
                                3112, 3028, 3113, 3029, 3114, 3030, 3115, 3031,
                                3116, 3032, 3117, 3033, 3118, 3034, 3119, 3035,
                                3120, 3036, 3121, 3037, 3122, 3038, 3123, 3039,
                                3124, 3040, 3125, 3041, 3126, 3042, 3127, 3043,
                                3128, 3044, 3129, 3045, 3130, 3046, 3131, 3047,
                                3132, 3048, 3133, 3049, 3134, 3050, 3135, 3051,
                                3136, 3052, 3137, 3053, 3138, 3054, 3139, 3055,
                                3140, 3056, 3141)
                        AND req.pa_rqst_sid = prs.pa_rqst_sid
                        AND prs.oprtnl_flag = 'A'
                        AND prs.pa_rqst_srvc_sid = psd.pa_rqst_srvc_sid
                        AND psd.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = pci.pa_rqst_sid
                        AND pci.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxm.pa_rqst_sid
                        AND prxm.oprtnl_flag = 'A'
                        AND md.oprtnl_flag = 'A'
                        AND md.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN md.from_date AND md.TO_DATE
                        AND prxm.mbr_sid = md.mbr_sid
                        AND ou.org_unit_sid = req.org_unit_sid
                        AND ou.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxm.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND pci.pa_rqst_sid = prxm.pa_rqst_sid
                        AND pci.pa_rqst_sid = wmdtl.subsystem_task_sid
                        AND pci.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxpl.pa_prvdr_type_lkpcd = 'RR'
                        AND prxpl.oprtnl_flag = 'A'
                        AND req.status_cid = sts.status_cid
                        AND sts.status_type_cid = 3
                        AND sts.oprtnl_flag = 'A'
                        AND prxpl.prvdr_lctn_iid = pl.prvdr_lctn_iid
                        AND p.prvdr_sid = pd.prvdr_sid
                        AND p.prvdr_sid = pl.prvdr_sid
                        AND pd.oprtnl_flag = 'A'
                        AND pd.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN pd.from_date AND pd.TO_DATE
                        AND wmdtl.subsystem_task_sid = req.pa_rqst_sid
                        AND wmdtl.subsystem_lkpcd = 'PA'
                        AND wmdtl.oprtnl_flag = 'A'
                        AND req.pa_rqst_date > (SYSDATE - 365)
                                       ORDER BY TO_DATE ("Request Date", 'MM/dd/yyyy hh24:mi:ss') DESC,
                            "Beneficiary Name" ASC) a
    WHERE ROWNUM < 102;regards,
    P Prakash
    Edited by: BluShadow on 17-May-2011 15:01
    added {noformat}{noformat} tags around the code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    833560 wrote:
    Can any one give me clue ,how to find out which sub query returns more than one row in the following query .This is why smaller, simpler queries are easier to work with than huge ones - when something like this goes wrong smaller queries are much eaiser to debug. Unfortunately using smaller, easier-to-work with queries is not always an option
    Ganesh is right - you will have to dissect the big query bit by bit until you find the offending subquery. If there is another way I would like to find out about it too.
    The easiest way to do this is probably to use block comments to isolate parts of the query bit by bit until you find the offending part. If you carefully examine the subqueries you might be able to figure out which one is returning multiple rows without commenting everything
    Good luck!

  • Java.sql.SQLException: while calculating row count: Unexpected exception :

    I am working with JDBC that is connected to MS Access 2003 file.
    I wrote and tested in MS Access following query and all it is working well. If I write this query and execute it is working well.
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +
    "ParameterGroupMember.Member_Parameter_id = ApplicationReadsParameter.Parameter_id)" +
    "INNER JOIN Parameter ON ApplicationReadsParameter.Parameter_id = Parameter.id " +
    "WHERE (ParameterGroupMember.Group_Parameter_id=40) " +
    "UNION ALL SELECT Parameter.Name, Parameter.id FROM " +
    "Parameter INNER JOIN ApplicationReadsParameter ON " +
    "ApplicationReadsParameter.Parameter_id=Parameter.id WHERE (Parameter.id=40); ");
    rs = pstm.executeQuery();
    When I use code, that sets parameters in the statement it is firing following exception
    java.sql.SQLException: while calculating row count: Unexpected exception : 1
    at sun.jdbc.odbc.JdbcOdbcResultSet.parameterQuery(JdbcOdbcResultSet.java:6417)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcResultSet.java:6336)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:155)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:424)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:93)
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +
    "ParameterGroupMember.Member_Parameter_id = ApplicationReadsParameter.Parameter_id)" +
    "INNER JOIN Parameter ON ApplicationReadsParameter.Parameter_id = Parameter.id " +
    "WHERE (ParameterGroupMember.Group_Parameter_id=?) " +
    "UNION ALL SELECT Parameter.Name, Parameter.id FROM " +
    "Parameter INNER JOIN ApplicationReadsParameter ON " +
    "ApplicationReadsParameter.Parameter_id=Parameter.id WHERE (Parameter.id=?); ");
    pstm.setInt(1, 40);
    pstm.setInt(2, 40);
    rs = pstm.executeQuery();
    Further I found that the problem is with the setting of the second parameter in the statement. Is there different way how to set the second parameter if union is used?
    Thanks and regards,
    Jan

    Jan.Hv wrote:
    I am working with JDBC that is connected to MS Access 2003 file.
    Use code tags when you post code.
    I wrote and tested in MS Access following query and all it is working well. You mean it works in MS Access. Not that it works in java.
    >
    pstm = DBConnect.prepareStatement(
    "SELECT Parameter.Name, Parameter.id FROM " +
    "(ParameterGroupMember INNER JOIN ApplicationReadsParameter ON " +I STRONGLY suggest that rather than putting spaces at the end of each part put it at the beginning. It makes it much easier to get it right.
    I also suggest formatting the code. There are various ways.
            // Wrong
            String sql = "select x, y z "
                             + "from table1 t1, idtable idt"
                             + "where t1.tim=idt.tim "
                             +  "and t1.book = idt.book";
            // Right (spaces) - one way to format
            String sql = "select"
                             + "         x, y z"
                             + " from table1 t1, idtable idt"
                             + " where"
                             + "          t1.tim=idt.tim"
                             + "          and t1.book = idt.book";Your code is in fact missing a space. No idea if that is a problem or not.
    Remove the semicolon from the end.
    PRINT the sql before you use it, copy/paste and use that string in MS Access (replace the ?) to see if it work.
    Further I found that the problem is with the setting of the second parameter in the statement. Is there different way how to set the second parameter if union is used?The MS Access ODBC driver isn't really great for actually reporting errors correctly. So usually any error means something is wrong and it is up to you to figure out the exact problem.

  • Oracle database link to MySQL select only one row

    Hello,
    I have created a connection from the Oracle batabase 11.2 to a MySQL database via database link. The following statement shows, that 35 rows are in the mySQL table:
    SQL>  select count(*) from "main_pages"@MOREWEB;
      COUNT(*)
            35
    But a normal select statement only return 1 row.
    SQL> select "subject" from "main_pages"@MOREWEB;
    subject
    Übersicht: Referenzen
    I am using the mysql-connector-odbc-3.51.30-winx64 driver. A newer version cann't be installed because on Windows Server 2008 R2 I get an error with an missing dll-file. The DataDirect-ODBC-driver is not possible, because we like to use the free MySQL-database an DataDirect only support the enterprise edition.
    I also have tried to limit the HS_OPEN_CURSORS or dont limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one row.
    HS Init.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = moreweb
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_FETCH_ROWS=1
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    HS tracefile
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
        Version 11.2.0.1.0
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "ON"
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "1"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using mpgw as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    SQL text from hgopars, id=1, len=36 ...
         00: 53454C45 43542043 4F554E54 282A2920  [SELECT COUNT(*) ]
         10: 46524F4D 20606D61 696E5F70 61676573  [FROM `main_pages]
         20: 60204131                             [` A1]
    Deferred open until first fetch.
    Performing delayed open.
    SQL text from hgopars, id=1, len=40 ...
         00: 53454C45 43542041 312E6073 75626A65  [SELECT A1.`subje]
         10: 63746020 46524F4D 20606D61 696E5F70  [ct` FROM `main_p]
         20: 61676573 60204131                    [ages` A1]
    Deferred open until first fetch.
    Performing delayed open.
    Please can help me someone.
    Thanks.
    Bianca

    mxallen wrote:
    Bianca,
    If you log directly into MySQL and issue the same query (select "subject" from "main_pages";) what data is returned?
    I looks to me that you count is the number of rows in the entire table "main_pages"
    while you select is for the data in the "subject" column only.
    This seems to indicate that you have just one row in that subject column.
    Regards,
    Matt
    WHAATT?
    What do you mean by "just one row in that subject column"?
    That makes no sense at all.  A row is a row.  A column is a part of a row.  All rows have all columns, though not all columns of all rows will necessarily have an assigned value.  Lacking a WHERE clause to filter rows, any SELECT should return all rows.

  • Select Single * and Select upto one row

    Hi all,
    Can anybody tell me what is difference between Select single * and select upto one row?
    And which one is better?
    Thanks in advance.......

    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly: to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
    Mainly: to check if entries exist.
    Select Single is the best one compared to UPto one rows.
    Select Single will get the first record from the table which satisfies the given condition.So it will interact once with the database.
    UTO 1 rows will get the list of the records for the given match and iwll show the first record from the list.So it will take time to get the record.
    SELECT SINGLE VBELN from VBAK
    where MATNR = '1M20'.
    ---Thjis will get the first matched record and will display the record
    SELECT VBELN from VBAK
    where MATNR = '1M20' upto 1 rows.
    ---Thjis will get the list of matched records and will display the first record
    The Major difference between Select Single and Select UPTO 1 rows is The Usage Of Buffer for each.
    Select Single will search for all the satisfied data and bring all that data into Buffer and later it will give to that data to the program.
    Select UPTO 1 Rows will end the search after getting the 1st satisfied record and gives that record to the program.
    Thus Select Single will take much processing time when compare with Select UPTO 1 rows.
    Also
    check these threads..
    Difference between Select Single and Selct upto 1 row
    Difference between Select Single and Select upto 1 row
    Difference between select single and select upto one row
    Difference between 'select single *' and 'select upto 1 rows'
    difference between select single and select up to 1 rows
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • SQL*Plus two fetches for getting one row.

    Hi all.
    I have tested following script.
    alter session set events '10046 trace name context forever, level 12';
    select * from dual;And achieved such results (extract from .trc file).
    SQL*Plus: Release 11.2.0.1.0; (Oracle Version 10.2.0.4.0, 11.2.0.1.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2      0.00       0.00          0          0          0           1
    total        4      0.00       0.00          0          0          0           1SQL*Plus: Release 8.1.7.0.0; (Oracle Version 8.1.7.0.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch        2      0.00       0.00          0          1          4           1
    total        5      0.00       0.00          0          1          4           1Allround Automations PL/SQL Developer 8.0.4; (Oracle Version 10.2.0.4.0, 11.2.0.1.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          0          0           1
    total        3      0.00       0.00          0          0          0           1Allround Automations PL/SQL Developer 8.0.4; (Oracle Version 8.1.7.0.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          1          4           1
    total        3      0.00       0.00          0          1          4           11) I can't figure out why sqlplus does TWO fetches for getting ONE row (instead of pl/sql developer).
    8i raw trace
    PARSING IN CURSOR #1 len=31 dep=0 uid=0 oct=3 lid=0 tim=0 hv=3549852361 ad='4a0155c'
    select 'hello world' from dual
    END OF STMT
    PARSE #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=0
    BINDS #1:
    EXEC #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=0
    WAIT #1: nam='SQL*Net message to client' ela= 0 p1=1111838976 p2=1 p3=0
    FETCH #1:c=0,e=0,p=0,cr=1,cu=4,mis=0,r=1,dep=0,og=4,tim=0
    WAIT #1: nam='SQL*Net message from client' ela= 0 p1=1111838976 p2=1 p3=0
    FETCH #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=0
    WAIT #1: nam='SQL*Net message to client' ela= 0 p1=1111838976 p2=1 p3=0
    WAIT #1: nam='SQL*Net message from client' ela= 0 p1=1111838976 p2=1 p3=0
    STAT #1 id=1 cnt=1 pid=0 pos=0 obj=195 op='TABLE ACCESS FULL DUAL '11g raw trace
    PARSING IN CURSOR #3 len=30 dep=0 uid=96 oct=3 lid=96 tim=1581355246985 hv=1158622143 ad='b8a1bcdc' sqlid='5h2yvx92hyaxz'
    select 'hello world' from dual
    END OF STMT
    PARSE #3:c=0,e=130,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1388734953,tim=1581355246984
    EXEC #3:c=0,e=40,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1388734953,tim=1581355247154
    WAIT #3: nam='SQL*Net message to client' ela= 7 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=1581355247252
    FETCH #3:c=0,e=18,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=1388734953,tim=1581355247324
    STAT #3 id=1 cnt=1 pid=0 pos=1 obj=0 op='FAST DUAL  (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)'
    WAIT #3: nam='SQL*Net message from client' ela= 193 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=1581355247735
    FETCH #3:c=0,e=2,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,plh=1388734953,tim=1581355247800
    WAIT #3: nam='SQL*Net message to client' ela= 5 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=15813552478552) Is there any possibility to view data provided by each fetch?
    Thanks in advance!
    P.S.
    SQL> sho arraysize
    arraysize 15

    Thanks.
    I have tested two statements.
    select 'hello world' from dual where 1=1;
    select 'hello world' from dual where 1=0;When query returns no data, there is only one SQL*Net roundtrip (and one fetch)
    SQL> set autot on statistics
    SQL> select 'hello world' from dual where 1=1;
    'HELLOWORLD
    hello world
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            528  bytes sent via SQL*Net to client
            492  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> select 'hello world' from dual where 1=0;
    no rows selected
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            329  bytes sent via SQL*Net to client
            481  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedBut in both cases i found in client trace this sequence of bytes:
    ] nsprecv: 00 00 36 01 00 00 00 00  |..6.....|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 90 19 43 13 00 00  |....C...|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 19 4F 52 41 2D 30  |...ORA-0|
    ] nsprecv: 31 34 30 33 3A 20 6E 6F  |1403:.no|
    ] nsprecv: 20 64 61 74 61 20 66 6F  |.data.fo|
    ] nsprecv: 75 6E 64 0A              |und.    |In first case - it was in 2nd packet and in second case (query returns no data) - part of 1st packet.

  • Exists (SQL query returns at least one row) condition with MAX on 10.2.0.4

    I just wanted to note this on the forum..
    I'm using Apex 3.0.1.00.08
    My DEV environment has just been upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
    I created the following process to select some values into some items on my Form page.
    select  MAX(STAT_YEAR+1)
          , pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id
    into    :P11_STAT_YEAR
          , :P11_PCT_ID
          , :P11_STAT_TYPE_ID
          , :P11_STAT_PERIOD_TYPE_ID
          , :P11_MEASUREMENT_ID
    from  plant_commodity_data pcd
        , stat_type stt
    where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
      and pcd.pct_id = :P0_PCT_ID
      and stt.stat_type = 'PRD'
    group by pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id;The process should run conditionally if there was at least one row to select...
    So I copied the SQL into the Process condition, removed the "into" section and set the condition type to be "Exists (SQL query retruns at least one row) ...
    select  MAX(STAT_YEAR+1)
          , pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id
    from  plant_commodity_data pcd
        , stat_type stt
    where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
      and pcd.pct_id = :P0_PCT_ID
      and stt.stat_type = 'PRD'
    group by pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id;This worked perfectly until the DEV environment was upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
    The condition would fire even if there were no rows returning.
    I pasted the condition code into SQL Developer connected to the DEV (10.2.0.4.0) environment and it returned no rows.
    To solve the problem, I removed the MAX.
    You can test this using this code if you have access to the two versions... select  MAX(1)
          , sysdate
          , 'Gus'
    from  dual
    where 1 = 2
    group by sysdate, 2Now I know the MAX isn't required in the condition as I'm just trying to find out if any rows exist, but it was there as I copied the code in... I was just wondering why this happened between 10.2.0.2.0 and 10.2.0.4.0?
    Gus..

    Hi Gus,
    try to execute
    select count(*) from dual where exists (select  MAX(1)
          , sysdate
          , 'Gus'
    from  dual
    where 1 = 2
    group by sysdate, 2)in SQL Developer. The above statement is generated by APEX for an "Exists (SQL query retruns at least one row)". Can't test it, because I don't have a 10.2.0.4.0 at hand.
    Does SQL Developer now show the same behavior?
    Patrick
    My APEX Blog: http://www.inside-oracle-apex.com
    The APEX Builder Plugin: http://builderplugin.oracleapex.info/
    The ApexLib Framework: http://apexlib.sourceforge.net/

  • Cursor ORDER BY Clause Changing Row Count In BULK COLLECT ... FOR LOOP?

    Oracle 10g Enterprise Edition Release 10.2.0.4.0 running on Windows Server 2003
    Oracle Client 10.2.0.2.0 running on Windows 2000
    I have some PL/SQL code that's intended to update a column in a table based on a lookup from another table. I started out by testing it with the UPDATE statement commented out, just visually inspecting the DBMS_OUTPUT results to see if it was sane. During this testing I added/changed the cursor ORDER BY clause to make it easier to read the output, and saw some strange results. I've run the code 3 times with:
    1. no ORDER BY clause
    2. ORDER BY with two columns (neither indexed)
    3. ORDER BY with one column (not indexed)
    and get three different "rows updated" counts - in fact, when using the ORDER BY clauses it appears that the code is processing more rows than without either ORDER BY clause. I'm wondering why adding / changing an ORDER BY <non-indexed column> clause in a cursor would affect the row count?
    The code structure is:
    TYPE my_Table_t IS TABLE OF table1%ROWTYPE ;
    my_Table my_Table_t ;
    CURSOR my_Cursor IS SELECT * FROM table1 ; -- initial case - no ORDER BY clause
    -- ORDER BY table1.column1, table1.column2 ; -- neither column indexed
    -- ORDER BY table1.column2 ; -- column not indexed
    my_Loop_Count NUMBER := 0 ;
    OPEN my_Cursor ;
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    EXIT WHEN my_Table.COUNT = 0 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value <> my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    END LOOP ;
    COMMIT ;
    END LOOP ;
    CLOSE my_Cursor ;
    DBMS_OUTPUT.PUT_LINE( 'Processed ' || my_Loop_Count || ' Rows ' ) ;

    Hello (and welcome),
    Your handling the inner cursor exit control is suspect, which will result in (seemingly) erratic record counts.
    Instead of:
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    EXIT WHEN my_Table.COUNT = 0 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    END LOOP ;
    COMMIT ;
    END LOOP ;Try this:
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    EXIT WHEN my_Cursor%NOTFOUND;
    END LOOP ;
    END LOOP ;
    COMMIT ;Which also takes the COMMIT outside of the LOOP -- try to never have a COMMIT inside of any LOOP.
    Additionally, not too sure about these:
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;Any one of those EXITs will bypass your my_Loop_Count increment.
    Edited by: SeánMacGC on Jul 9, 2009 8:37 AM
    Had the cursor not found in the wrong place, now corrected.

  • One column one row w/ separator to be hierarchical columns

    Dear Gurus,
    I want to present the "+one column/one row data+"
    F:\JDeveloper\Tut\TIJ4-code\generics\watercolors\Watercolors.javaas this follow:
    id               parent_id
    Watercolors.java     watercolors
    watercolors          generics
    generics          TIJ4-code
    TIJ4-code          Tut
    Tut               JDeveloper
    JDeveloper          F:Id better using an sql rather than pl/sql.
    regards,

    I think you'd struggle to do this in SQL alone, unless you use some fancy MODEL clause or Michaels can come up with some nifty XML solution. I would probably go with some PL/SQL as a pipelined function...
    SQL> create table treedata as
      2  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Adding Window Event Listener. Working with MDI.swf' as cp from dual union all
      3  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Finger Icon.swf' from dual union all
      4  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating Key Icon.swf' from dual union all
      5  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Containing Information on Fingers.swf' from dual union all
      6  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class Handling Shift Press.swf' from dual union all
      7  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 1).swf' from dual union all
      8  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KBLayout\Creating the Class KBLayout (Part 2).swf' from dual union all
      9  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyCode.swf' from dual union all
    10  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 1).swf' from dual union all
    11  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class KeyIcon\Creating the Class KeyIcon (Part 2).swf' from dual union all
    12  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Key Systemization .swf' from dual union all
    13  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating Supplementary Classes\Creating the Class for Saving Information on Keys.swf' from dual union all
    14  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Creating the Main Window (the Class MainWindow).swf' from dual union all
    15  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Class Constructor.swf' from dual union all
    16  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Fill.swf' from dual union all
    17  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 1).swf' from dual union all
    18  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Creating Methods Responsible for Icon Highlight\Creating Methods Responsible for Icon Highlight (Part 2).swf' from dual union all
    19  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 1).swf' from dual union all
    20  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Defining Some Static Variables\Defining Some Static Variables (Part 2).swf' from dual union all
    21  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Highlighting Icons.swf' from dual union all
    22  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method run.swf' from dual union all
    23  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Overriding the Method setVisible.swf' from dual union all
    24  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\Registering Keyboard in the Main Window of Application .swf' from dual union all
    25  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\KeyboardGUI\The Methods new_icon and new_fingericon.swf' from dual union all
    26  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Adding Keyboard Listener to the Application.swf' from dual union all
    27  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating Methods to Test the Efficiency of the User''s work.swf' from dual union all
    28  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class ExerciseGUI.swf' from dual union all
    29  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Creating the class Lessons and Working with It in the Class ExerciseGUI.swf' from dual union all
    30  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Handling Pressed Keys.swf' from dual union all
    31  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Improving Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    32  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Setting Position and the Sizes of the Main Window.swf' from dual union all
    33  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Statistics.swf' from dual union all
    34  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Graphical Interface of the Class ExerciseGUI.swf' from dual union all
    35  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\The Class ExerciseGUI\Working with Keyboard Events.swf' from dual union all
    36  select 'F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\Working with Main Window Menu. Positioning the Main Window.swf' from dual
    37  /
    Table created.
    SQL>
    SQL>
    SQL>
    SQL> CREATE OR REPLACE TYPE pth IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION tree RETURN pth PIPELINED IS
      2    l_maxlen      NUMBER;
      3    l_parent_path VARCHAR2(255);
      4    type t_output is table of varchar2(32767) index by pls_integer;
      5    l_output      t_output;
      6    l_cnt         NUMBER := 0;
      7    PROCEDURE show_children(p_path IN VARCHAR2, p_lvl IN NUMBER, p_tree IN VARCHAR2) IS
      8      l_ch_path_cnt number;
      9      CURSOR cur_children_elements IS -- non path children
    10        select replace(cp,p_path) as ch
    11        from   treedata
    12        where  instr(replace(cp,p_path),'\') = 0
    13        order by 1;
    14      CURSOR cur_children_paths IS -- path children
    15        select pth
    16              ,row_number() over (order by pth) as rn
    17              ,count(*) over () as cnt
    18        from (
    19              select distinct substr(replace(cp,p_path),1,instr(replace(cp,p_path),'\')) as pth
    20              from   treedata
    21              where  instr(cp,p_path) > 0
    22              and    instr(replace(cp,p_path),'\') > 0
    23              order by 1
    24             );
    25    BEGIN
    26      select count(*)
    27      into   l_ch_path_cnt
    28      from   treedata
    29      where  instr(cp,p_path) > 0
    30      and    instr(replace(cp,p_path),'\') > 0;
    31      for c in cur_children_elements
    32      loop
    33        l_cnt := l_cnt + 1;
    34        if l_ch_path_cnt = 0 then
    35          l_output(l_cnt) := replace(replace(substr(p_tree,1,length(p_tree)-2)||'  ','+',' '),'-',' ')||'  '||c.ch;
    36        else
    37          l_output(l_cnt) := replace(replace(p_tree,'+',' '),'-',' ')||'  '||c.ch;
    38        end if;
    39      end loop;
    40      if l_ch_path_cnt = 0 then
    41        l_cnt := l_cnt + 1;
    42        l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2);
    43      else
    44        l_cnt := l_cnt + 1;
    45        l_output(l_cnt) := p_tree;
    46      end if;
    47      for p in cur_children_paths
    48      loop
    49        if p.rn != p.cnt then
    50          l_cnt := l_cnt + 1;
    51          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'+-'||substr(p.pth,1,length(p.pth)-1);
    52          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'| | ');
    53        else
    54          l_cnt := l_cnt + 1;
    55          l_output(l_cnt) := substr(p_tree,1,length(p_tree)-2)||'\-'||substr(p.pth,1,length(p.pth)-1);
    56          show_children(p_path||p.pth, p_lvl+1, substr(p_tree,1,length(p_tree)-2)||'    ');
    57        end if;
    58      end loop;
    59    END;
    60  BEGIN
    61    -- first display the common parent path
    62    select max(length(txt)) as max_ln
    63    into   l_maxlen
    64    from (
    65          select substr(cp,1,rn) as txt
    66          from   treedata, (select rownum rn from dual connect by rownum <= 255)
    67          group by substr(cp,1,rn)
    68          having count(*) = (select count(*) from treedata)
    69         );
    70    select substr(cp,1,l_maxlen)
    71    into   l_parent_path
    72    from   treedata
    73    where  rownum = 1;
    74    PIPE ROW(l_parent_path);
    75    -- now recurse the data
    76    show_children(l_parent_path, 1, '| ');
    77    for i IN 1..l_cnt
    78    loop
    79      PIPE ROW(l_output(i));
    80    end loop;
    81    RETURN;
    82  END tree;
    83  /
    Function created.
    SQL>
    SQL> select * from table(tree);
    COLUMN_VALUE
    F:\Teach_Pro_JAVA\Teach_Pro_JAVA\Teachpro\Working Over the Project\
    |   Adding Window Event Listener. Working with MDI.swf
    |   Creating the Main Window (the Class MainWindow).swf
    |   Working with Main Window Menu. Positioning the Main Window.swf
    |
    +-Creating Supplementary Classes
    | |   Creating Finger Icon.swf
    | |   Creating Key Icon.swf
    | |   Creating the Class Containing Information on Fingers.swf
    | |   Creating the Class Handling Shift Press.swf
    | |   Creating the Class KeyCode.swf
    | |   Creating the Class for Key Systemization .swf
    | |   Creating the Class for Saving Information on Keys.swf
    | |
    | +-Creating the Class KBLayout
    | |     Creating the Class KBLayout (Part 1).swf
    | |     Creating the Class KBLayout (Part 2).swf
    | |
    | \-Creating the Class KeyIcon
    |       Creating the Class KeyIcon (Part 1).swf
    |       Creating the Class KeyIcon (Part 2).swf
    |
    +-KeyboardGUI
    | |   Class Constructor.swf
    | |   Creating Methods Responsible for Icon Fill.swf
    | |   Highlighting Icons.swf
    | |   Overriding the Method run.swf
    | |   Overriding the Method setVisible.swf
    | |   Registering Keyboard in the Main Window of Application .swf
    | |   The Methods new_icon and new_fingericon.swf
    | |
    | +-Creating Methods Responsible for Icon Highlight
    | |     Creating Methods Responsible for Icon Highlight (Part 1).swf
    | |     Creating Methods Responsible for Icon Highlight (Part 2).swf
    | |
    | \-Defining Some Static Variables
    |       Defining Some Static Variables (Part 1).swf
    |       Defining Some Static Variables (Part 2).swf
    |
    \-The Class ExerciseGUI
          Adding Keyboard Listener to the Application.swf
          Creating Methods to Test the Efficiency of the User's work.swf
          Creating the class ExerciseGUI.swf
          Creating the class Lessons and Working with It in the Class ExerciseGUI.swf
          Handling Pressed Keys.swf
          Improving Graphical Interface of the Class ExerciseGUI.swf
          Setting Position and the Sizes of the Main Window.swf
          Statistics.swf
          Working with Graphical Interface of the Class ExerciseGUI.swf
          Working with Keyboard Events.swf
    51 rows selected.
    SQL>

Maybe you are looking for

  • Problem with Business Connector 4.8

    Hi Everybody, first of all I would like to clarify that this is a question about SAP BC and NOT XI, but I did not know wherelse to put this message. I have installed SAP BC 4.8. Created a new RFC map (SAP BC -> SAP) of a FM called Z_PO_GET_LIST. Then

  • Photo app crashing

    I upgraded to Ios5, and it worked really well for a few days but now my photo gallery just won't open - ie I tap 'photos', it shows me my album and when I tap it to open it, the app just closes. It doesn't matter how I try to access it - through phot

  • Doing proper NAT to FTP connections on non-standard port

    Router 1712, IOS 12.3 There is an article from Cisco, "Using Non-Standard FTP Port Numbers with NAT". http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080094e76.shtml It explains how to enable NATting router to perform proper

  • CFMAIL not writing to spool

    I am working on CFMX7 Enterprise Edition. The CFMAIL was working perfectly fine until sometime ago. Now, the CFMAIL doesn't work at all. Ran all customary checks and found that the .cfmail files are not written in the spool folder at all. When i phys

  • JQuery Cycle Plugin possible with sliced image site from Photoshop? CS5

    Hi all, I'm in a real pickle here. I'm an architecture & interior design graduate. I know not a lot about web design. I have managed to design my website, slice it in Photoshop and link it in Dreamweaver. I am trying to use JQuery Cycle for my slides