Reg: Order of row fetched -

Hi Experts,
Scenario -
A file has data in sorted order and it is inserted into Oracle table by SQL Loader (Direct-path load enabled).
If the table is queried (without any ORDER BY clause), is there a guarantee that the ordering will be same as in the text file?
I'm quite sure it's "NO" , and has been discussed several times that - without any explicit ORDER BY clause there's no guarantee that rows will be fetched in order.
But is there any way to demonstrate this?
I tried the below workout... (but rows were always fetched in the inserted order):
CREATE TABLE table_x
AS
SELECT /*+ APPEND */ LEVEL lvl
FROM dual
CONNECT BY LEVEL <= 10
ORDER BY 1 desc;
DECLARE
    CURSOR cur_x
    IS
    SELECT lvl FROM table_x;
BEGIN
  FOR j IN 1..100
  LOOP
      FOR i IN cur_x
      LOOP
            Dbms_Output.put_line(i.lvl);
      END LOOP;
    Dbms_Output.put_line('-------LOOP '||j||'------------');
  END LOOP;
END;
Help much appreciated!
Thanks and Regards
-- Ranit

one example could be:
drop table t;
create table t
as
select rownum id
  from dual
connect by level <= 1000000;
select /*+ parallel(8) */ * from t where rownum < 30;
        ID
    262801
    262802
    262803
    262804
    262805
    262806
    262807
    262808
    262809
    262810
    262811
    262812
    262813
    262814
    262815
    262816
    262817
    262818
    262819
    262820
    262821
    262822
    262823
    262824
    262825
    262826
    262827
    262828
    262829
So parallel access does change the order.
I think Tom Kyte mentioned the importance of an explicit order by rather frequently (a good example is http://tkyte.blogspot.de/2005/08/order-in-court.html) - almost as frequently as he mentioned the importance of bind variables...

Similar Messages

  • Problem with type conversion and primary key during row fetch

    [Note, this error occurs in Oracle XE, APEX 2.1.0.00.39]
    I have been having a problem with Automatic Row Fetch:
    ORA-01460: unimplemented or unreasonable conversion requested
    So in an effort to resolve this, I created a PL/SQL process with the query below and was able to isolate the same error. The problem seems to come from one of the primary keys being a "number" type (APP_ID). The error occurs on the line:
    where u.app_id=:P5_APP_ID
    I have tried the following variations on this line in an effort to resolve this, but all generate the same error:
    1) where to_char(u.app_id) = :P5_APP_ID
    2) where u.app_id = to_number(:P5_APP_ID)
    3) where to_char(u.app_id) = to_char(:P5_APP_ID)
    I've also tried the laternate syntax "&__." and "#__#", but these don't function in the Source field and show up as syntax errors.
    Any suggestions are welcome.
    begin
    for r in (
    select app_name, apptype, appcreator, appurl
    from application_users u, application_info i
    where u.app_id=:P5_APP_ID
    and i.app_id=u.app_id
    and u.username=:P5_USERNAME)
    loop
    begin
    :P5_APP_NAME := r.app_name;
    :P5_APPURL := r.appurl;
    exception
    when others then
    raise_application_error(-20000,'In Loop Failure',true);
    end;
    end loop;
    exception
    when others then
    raise_application_error(-20000,'Out of Loop Failure',true);
    end;
    Thanks in advance,
    Barney

    I found a prior post referencing a similar issue and it was solved by using the "v(__)" syntax. This did resolve my issue, however, I have a quick follow-on which I'm hoping someone can answer quickly...
    Since the "v(__)" syntax won't work for the Automatic Row Fetch (at least to the best of my knowledge), I have to do a manual process. However, the manual query as shown above doesn't actually populate any of the form values through the bind variables. They all remain at their cached values from prior data entry on the form.
    Is using the bind variables for assignment incorrect, or is there something that must be done to get the updates to show up in the form (ordering of processes, etc.).
    My manual process is running in the Load: Before Header state so I would have expected it to update all of the fields.
    Thanks in advance,
    Barney

  • Bug Report: Automatic Row Fetch/Automatic Row Processing and invalid column

    Hi,
    if an invalid column name is specified for a page item of type "Database Column", no error is reported by the Automatic Row Fetch/Automatic Row Processing process. It's just ignored and nothing is returned!!! That makes it kind of hard to identify such an error.
    The problem can happen for example when a column is renamed or if there is a typo in the column name during creation.
    The problem seems to be related to the following query which doesn't use an outer join.
    SELECT C.COLUMN_NAME, C.DATA_TYPE, I.NAME, I.FORMAT_MASK, I.DISPLAY_AS
    FROM
    SYS.ALL_TAB_COLUMNS C, WWV_FLOW_STEP_ITEMS I WHERE C.OWNER = :B4 AND
      C.TABLE_NAME = :B3 AND I.SOURCE = C.COLUMN_NAME AND I.SOURCE_TYPE =
      'DB_COLUMN' AND I.FLOW_ID = :B2 AND I.FLOW_STEP_ID = :B1 AND (C.DATA_TYPE
      IN ('DATE','NUMBER','CLOB','LONG','FLOAT') OR C.DATA_TYPE LIKE 'NUMBER%' OR
      C.DATA_TYPE = 'CHAR' OR C.DATA_TYPE LIKE '%VARCHAR%' OR C.DATA_TYPE LIKE
      'TIMESTAMP%') ORDER BY C.COLUMN_IDBTW, if an invalid table/view name is specified for a Automatic Row Fetch/Automatic Row Processing process, the error message during runtime isn't very speaking.
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignoredMaybe that could be changed too.
    Thanks
    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/

    It says filed (with an L) not fixed (with an X). That means they have noted down the bug, but it may or may not have been fixed yet.

  • Set memory cache - automated row fetch

    I would like to know more about the difference between
    Set Memory Cache On Display and
    Set Memory Cache On Fetch
    option, given in the Automated Row Fetch process.
    I noticed that it makes a difference in some cases - especially where I have a master-detail relation and need to perform multiple drill down:
    e.g. the report shows what was expected but export to .csv returns no rows. After switching from the default 'Set Memory Cache On Fetch' to 'Set Memory Cache On Display' everything works fine.
    Where could I find something about this option?
    Denes Kubicek

    Denes - I'd need to see an example to explain it. It is not the behavior I would expect. Can you create a simple test case on htmldb.oracle.com? Please post the workspace name and app/page ID when you have it.
    A bit more info: when the DML Fetch Mode is set to 'Set Memory Cache On Display', references to items sourced by the fetch, say &P1_ENAME., will not return the value that would be displayed in the form item P1_ENAME until after the code that emits P1_ENAME executes. So if your page had a before-header DML Fetch process that fetched a value for P1_ENAME (from EMP) and region A that displayed conditionally based on P1_ENAME = 'SMITH' and then region B containing the form item P1_ENAME and then region C that displayed conditionally based on P1_ENAME = 'JONES', the condition on region A would not see the fetched value of P1_ENAME but the condition on region C would see the value. However, if you set 'DML Fetch Mode to 'Set Memory Cache On Fetch', the condition in region A would see the fetched value.
    When you have a csv link or chart region that references a value from session state, that value must have been committed to session state (which happens when you run a computation, do an explicit assignment or "select into" a bind variable associated with a page or application item, or when you submit a form) in order for the csv or chart page to access the current value.
    Scott

  • Can we use the built-in Row fetch for Multiple reports in a page?

    I need to create a page with multiple report regions. Each of it is based on a table. Those tables are different. I somewhat remembered that we can NOT use the built in automatic row fetch process if there are multiple report regions, neither the built in DML process. You have to make your own fetch and insert/update/delete process if you intend to.
    Also if I write my own row fetch and update processes, do I have to consider lock mechnism? or just simply write select and insert/update?
    Any input is appreciated.

    I think I found the answer. Would Scott or other gurus take a look at the thread and confirm it, in case the limitation is not in 2.0?
    Re: automatic row fetch
    What I am concered about is that the locking mechanism. If I have to write my own process to fetch and insert/update, other than the regular select and insert/update statements, do I have to put commit by myself, or htmldb can handle it automatically? Is there an example for this?
    Thanks in advance.

  • How to get a single row fetched in a form?

    Hi,
    I would like to make a profile page , where the (currently logged in) user can change his adress, e-mailadress etc.
    This page must have only a form with input fields, filled with data from the database that the user can change. A report is not necessary because the user may only see his own data.
    I tried already several things, but i get allways a form with no data from the database, with the possibility to create records (sometimes, depending on what i choosed in the wizard, also an update button).
    I also changed in the 'Automated Row Fetch' the property WHERE CLAUSE with :P9_ID = 1 and even with ID = 1, but both clauses doesn't make a difference.
    (1 is the value of the ID-column in my table) // (:P9_ID is a field on my page, linked to the ID-column in my table) // (ID is the PK and columnname in my table)
    Is this possible to make an input form containing existing data (that a user can change), and how?
    Thx.

    Hi,
    Whats the table column which stores user login ID? lets say its APEX_LOGIN_ID then create a page item P1_APEX_LOGIN_ID and put default value to :APP_USER. Now in the ARF process, for "Item containing primary key value" put P1_APEX_LOGIN_ID and "Primary Key Column" to APEX_LOGIN_ID.
    Cheers,
    Hari

  • Row fetching, session state, multi-page processing of 1 row - problems

    I'm building an application that's updating a couple of tables via an updateable view and an instead-of trigger. That portion of it works OK, EXCEPT for the problems that I'm having with the APEX end.
    I've got 3 pages; the first page reads the row in via the automated row fetch and has, say columns 1-20.
    Page 2 has, say, columns 20-40 and page 3 has the remainder.
    I have the row fetch set up conditionally so that it only executes the first time that page 1 is displayed. All the columns are set as Database Columns.
    It seems that if I fill in fields on page 1, move to page 2, and back to page 1, the contents of the fields on page 1 are destroyed unless I set their 'Source used' to 'Only when the current value in session state is null'.
    Furthermore, upon update (which is on page 3, via an automated row update), the only columns that get updated are those that exist on page 3. The column values from the other pages no longer exist.
    Does navigation to another page not retain the session-state of database-column items?
    Am I better off just writing my own processes to perform the updates?
    Any other suggestions?
    Frank

    Hello Frank,
    >>I have the row fetch set up conditionally so
    that it only executes the first time that page 1 is
    displayed …
    It seems that if I fill in fields on page 1, moveto page 2, and back to page 1, the contents of the
    fields on page 1 are destroyed unless I set their
    'Source used' to 'Only when the current value in
    session state is null'.
    It seems that the first sentence is not consistent
    with the second one. The only reason the values are
    destroyed, as you call it, is that the ARF is running
    again. What condition are you using on your ARF?
    In any case, the right way to deal with it is to
    change the source used to "Only …", as I understand
    you already did.
    Hi Arie,
    I set an item after the first ARF. I then have the ARF set to execute conditionally based on the presence of that item. (I also display a success message on the ARF, so I know that the ARF is only occurring once). I move to subsequent pages by submitting the current pages.
    >>Does navigation to another page not retain the
    session-state of database-column items?
    Navigating to another page does retain the session state values.
    It's depends on what you mean by navigating.
    Submitting the page set/update session state.
    Redirect without submitting the page will not
    set/update the session state.
    >>Furthermore, upon update (which is on page 3,
    via an automated row update), the only columns that
    get updated are those that exist on page 3. The
    column values from the other pages no longer
    exist.
    Automatic DML is working only with the current page
    items. You can't use it to insert/update other page
    items, even if they are in session state. However, in
    your case, it's not the Automatic DML performing the
    actual updates, but your triggers. Are your triggers
    relying on session state values?
    I think this statement 'Automatic DML is working only with the current page
    items.' answers my question. My trigger is working on session state values. It's an 'instead-of' trigger, so I was letting the automatic DML perform the 'update' on the view, while allowing the trigger to do the actual update of several tables that the view joins by referring to their :NEW. values in the trigger. Since the DML occurs on my last page, those were the only session state values that my trigger ultimately saw.
    >>Am I better off just writing my own processes to
    perform the updates?
    I believe the correct way is to submit the page and
    then branch to the next one. Submitting the page will
    save all your items in session state, and allow these
    items to be available for page 3 DML.
    Regards,
    Arie.I'm doing that already - all the values do appear to be in session sate, except only the items that are on the last page actually make it to the automatic DML update, which seems to agree with your previous statement.
    I suppose I could write my own process to perform the update, as the values are available in session state.
    Thanks,
    Frank

  • Automatic row fetch and items initialization

    Hi team,
    I was modifying a page and I came across the following situation:
    I had a form with MRU processing and automatic row fetch and I wanted to make SAVE and DELETE buttons conditional basing on a certain flag contained in the row being read.
    The flag is read into a hidden item having sequence number lower than any button, however I found out that the condition could not be reliably tested as the value in the session state was coming from a previous visit to the page. Some times the buttons were there, some not, at the beginning it was puzzling.
    So, I added a computation based on a SQL query where the hidden flag was computed before the header, basing on the primary key being passed from the calling page and the problem was gone, but for some reason I didn't feel satisfied, it was too cumbersome.
    I thought session state items would be assigned beforehand, but for some reason it looked like they were assigned at a later time, even if the automatic fetch process is supposed to run before the header.
    Then I noticed an "innocent" option in the fetch process definition saying "set memory cache on Fetch / set memory cache on Display".
    In my case was checked the former, but as soon as I checked the latter, I could remove the unnecessary SQL query computation.
    So, I started off posting a problem and ended up with the solution...
    Bye,
    Flavio

    Flavio,
    Thanks for the testimonial. That feature (new in 1.6) is for the very situation you described. When you create new row fetch processes they will have the "set memory cache on Fetch" option selected by default. For existing processes, the option must be manually changed.
    Scott

  • ORA-01403: no data found Problem when using AUTOMATIC ROW FETCH to populate

    ORA-01403: no data found Problem when using AUTOMATIC ROW FETCH to populate a form.
    1) Created a FORM on EMP using the wizards. This creates an AUTOMATIC ROW FETCH
    TABLE NAME - EMP
    Item Containing PRIMARY KEY - P2099_EMPNO
    Primary key column - EMPNO
    By default the automatic fetch has a ‘Process Error Message’ of ‘Unable to fetch row.’
    2) Created a HTML region. Within this region add
    text item P2099_FIND_EMPNO
    Button GET_EMP to submit
    Branch Modified the conditional branch created during button creation to set P2099_EMPNO with &P2099_FIND_EMPNO.
    If I then run the page, enter an existing employee number into P2099_EMPNO and press the GET_EMP button the form is populated correctly. But if I enter an employee that does not exist then I get the oracle error ORA-01403: no data found and no form displayed but a message at the top of the page ‘Action Processed’.I was expecting a blank form to be displayed with the message ‘Unable to fetch row.’
    I can work around this by making the automated fetch conditional so that it checks the row exists first. Modify the Fetch row from EMP automated fetch so that it is conditional
    EXIST (SQL query returns at least one row)
    select 'x'
    from EMP
    where EMPNO = :P2099_EMPNO
    But this means that when the employee exists I must be fetching from the DB twice, once for the condition and then again for the actual row fetch.
    Rather than the above work around is there something I can change so I don’t get the Oracle error? I’m now wondering if the automatic row fetch is only supposed to be used when linking a report to a form and that I should be writing the fetch process manually. The reason I haven’t at the moment is I’m trying to stick with the automatic wizard generation as much as I can.
    Any ideas?
    Thanks Pete

    Hi Mike,
    I've tried doing that but it doesn't seem to make any difference. If I turn debug on it shows below.
    0.05: Computation point: AFTER_HEADER
    0.05: Processing point: AFTER_HEADER
    0.05: ...Process "Fetch Row from EMP": DML_FETCH_ROW (AFTER_HEADER) F|#OWNER#:EMP:P2099_EMPNO:EMPNO
    0.05: Show ERROR page...
    0.05: Performing rollback...
    0.05: Processing point: AFTER_ERROR_HEADER
    I don't really wan't the error page, either nothing with the form not being populated or a message at the top of the page.
    Thanks Pete

  • How to preset the order of rows in the outer query of a correlated query ?

    Good morning,
    I have the following simple query:
    select empno,
           ename,
           sal,
           sum(case
                 when rn = 1 then sal
                 else -sal
               end) over (order by sal, empno) as running_diff
       from (
             select empno,
                    ename,
                    sal,
                    row_number() over (order by sal, empno) as rn
               from emp
              where deptno = 10
             );That calculates a running difference and uses "row_number() over (...)" which is an Oracle specific feature to do so. It yields the following result (which we will consider correct):
         EMPNO ENAME             SAL RUNNING_DIFF
          7934 MILLER           1300         1300
          7782 CLARK            2450        -1150
          7839 KING             5000        -6150I wanted to come up with a solution that was not Oracle specific different solution. I tried the following code:
    (EDIT: after additional thought, that code is totally different in meaning and will never come close, to the above result. Consider it wrong and ignore this attempt altogether.)
    select a.empno,
           a.ename,
           a.sal,
           (select case
                     when a.empno = min(b.empno) then sum(b.sal)
                     else sum(-b.sal)
                   end
              from emp b
             where b.empno <= a.empno
               and b.deptno = a.deptno) as running_diff
      from emp a
    where a.deptno = 10;but the result is
         EMPNO ENAME             SAL RUNNING_DIFF
          7782 CLARK            2450         2450
          7839 KING             5000        -7450
          7934 MILLER           1300        -8750which is a long way from the original result. I've tried everything I could think of to order the rows before the running difference is calculated but, have been unsuccessful.
    Is there a way to change this second query --(without using Oracle specific features)-- without using windowing features that would yield the same result as the first query ?
    Rephrase of the above question:
    Is there a way, using plain vanilla SQL (that is aggregate functions and set operations such as joins and unions) to create a query that yields the same result as the first one ?
    Also, this is not for production code. This is simply an exercise in set manipulation that I'd like to see a solution for.
    Thank you for your help,
    John.
    Edited by: 440bx - 11gR2 on Jul 18, 2010 12:50 AM - correct "ho w" to "How"
    Edited by: 440bx - 11gR2 on Jul 18, 2010 1:42 AM - struck out all references to row_number and windowing features being Oracle specific features.
    Edited by: 440bx - 11gR2 on Jul 18, 2010 3:51 AM - Noted that my try is woefully wrong and restated the objective to make it clearer.

    Hi, John,
    One way to get a running total (which is basically what you want) is to do a self-join. Join each row (let's call it the current row, or c) to itself and everything that came before it (let's call this the previous row, or p), and do a regular aggregate SUM, like this:
    WITH     got_base_sal     AS
         SELECT       deptno
         ,       2 * MIN (sal)     AS base_sal
         FROM       scott.emp
         GROUP BY  deptno
    SELECT       c.deptno
    ,       c.empno
    ,       c.ename
    ,       c.sal
    ,       b.base_sal - SUM (p.sal)     AS running_diff
    FROM       scott.emp     c
    JOIN       scott.emp     p     ON     c.deptno     = p.deptno
                        AND     (     c.sal     > p.sal
                             OR     (     c.sal     =  p.sal
                                  AND     c.empno     >= p.empno
    JOIN       got_base_sal     b     ON     c.deptno     = b.deptno
    WHERE       c.deptno     IN (10)
    GROUP BY  c.deptno
    ,       c.empno
    ,       c.ename
    ,       c.sal
    ,       b.base_sal
    ORDER BY  c.deptno
    ,       running_diff     DESC
    ;Output:
        DEPTNO      EMPNO ENAME             SAL RUNNING_DIFF
            10       7934 MILLER           1300         1300
            10       7782 CLARK            2450        -1150
            10       7839 KING             5000        -6150I said you basically want a runninng total. There are two differences between a running total and your requirements
    (1) You want to have a total of the negative of what's in the table. That's trivial: use a minus sign.
    (2) You want the first item to count as positive instead of negative. That's not so trivial. The query above counts all sals as negative, but adds an offset so that it appears as if the first item had been counted as positive, not negative.
    You didn't say what you want to do in case of a tie (two or more rows having the same sal). The query above uses empno as a tie-breaker, so that all sals are calculated as if they were distinct. This is similar to what analytic functions do when the windowing is based on rows. If you want something similar to windowing by range, that might actually be simpler.
    The query above calculates a separate running_diff for each deptno, similar to "PARTITION BY deptno" in analytic functions. You happen to be interested in only one deptno right now, but you can change the main query's WHERE clause, or omit it, and the query will still work. If you don't want this feature (analagoud to not having any PARTITION BY), it's easy to modify the query.
    You could also get these results using a recursive WITH clause. That meets the criteria of avoiding analytic functions and Oracle-specific features, but not the one about using only plain, simple SQL features.

  • Ordering of rows are showing difference when migration db from 9.2.0.8.0-32bits(windows 3) to 10.2.0.5.0 - 64bit(windows 8)?

    Dears,
    After migration(via export/import), we are facing ordering of rows are mis-match  in these two databases.
    the following same query I am running on the these two databases. but different output. output are below.
    [CODE]
    SELECT ROWNUM AS RowNo, TBL1.*
      FROM (    SELECT COUNT (PG_ID) AS TotalCount,
                     PG_DESC AS PageDescription,
                     CURR_EPR_QUEUE AS CurrentQueue,
                     PG_NME AS PageName,
                     QUEUE_TYP_CDE AS QueueTypeCode,
                     PG_ID AS PageID
                FROM SASV_TB_CNT_APPL_JUDG_2----this is a view
               WHERE (CURR_EPR_QUEUE = 'test' AND QUEUE_TYP_CDE = '01')
                     OR (    JUD_RACIF_ID = 'test'
                         AND CMPLTD_IND = '0'
                         AND DSPLY_IND = '1')
                        AND TOTAL_CNT > 0
            GROUP BY PG_ID,
                     PG_NME,
                     PG_DESC,
                     CURR_EPR_QUEUE,
                     QUEUE_TYP_CDE            
                      ) TBL1
    [/CODE]
    output- from
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
    TNS for 32-bit Windows: Version 9.2.0.8.0 - Production
    1
    7
    Other Documents(Hearing)
    askinj
    HG01_Other_Documents
    1
    HG01-TB02
    2
    3
    Pending Award
    askinj
    HG01_Pending_Order
    1
    HG01-TB05
    3
    19
    Motion(ADR)
    askinj
    MD01_Motion
    1
    MD01-TB01
    4
    5
    Other Documents(ADR)
    askinj
    MD02_Other_Documents
    1
    MD01-TB02
    5
    1
    Scheduling(ADR)
    askinj
    MD01_Scheduling
    1
    MD01-TB03
    6
    8
    Mediations
    askinj
    MD01_Mediations
    1
    MD01-TB04
    output from--
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    1
    3
      Pending Award
    askinj
    HG01_Pending_Order
    1
    HG01-TB05
    2
    7
      Other   Documents(Hearing)
    askinj
    HG01_Other_Documents
    1
    HG01-TB02
    3
    8
      Mediations
    askinj
    MD01_Mediations
    1
    MD01-TB04
    4
    5
    Other Documents(ADR)
    askinj
    MD02_Other_Documents
    1
    MD01-TB02
    5
    1
    Scheduling(ADR)
    askinj
    MD01_Scheduling
    1
    MD01-TB03
    6
    19
    Motion(ADR)
    askinj
    MD01_Motion
    1
    MD01-TB01
    the views query is below
    SASV_TB_CNT_APPL_JUDG_2
    [code]
    (SELECT spm.PG_ID,
               spm.PG_NME,
               spm.PG_DESC,
               DECODE (TAJD.ABS_IND, 1, GUEST_JUD_ID, JUDG_ID) CURR_EPR_QUEUE,
               QUEUE_TYP_CDE,
               1 "TOTAL_CNT",
               DECODE (TAJD.ABS_IND, 1, GUEST_JUD_ID, JUDG_ID) JUD_RACIF_ID,
               CMLTD_IND CMPLTD_IND,
               NULL DSPLY_IND
          FROM SA_PG_MSTR SPM, TMST_APPEAL_JUDGE_DETAIL TAJD, SA_WRK_ITM SWI
         WHERE     SWI.WRK_ITM_ID = TAJD.WRK_ITM_ID
               AND swi.tb_pg_id = spm.pg_id
               AND SWI.CURR_EPR_QUEUE = 'AppellateCommonJudgeUser'
               AND CMLTD_IND = '0'
               AND tajd.LEAD_JUD_IND != '3'
        UNION ALL
        SELECT spm.PG_ID,
               spm.PG_NME,
               spm.PG_DESC,
               CURR_EPR_QUEUE,
               QUEUE_TYP_CDE,
               1 "TOTAL_CNT",
               CURR_EPR_QUEUE judg_racif_id,
               '0' CMPLTD_IND,
               NULL DSPLY_IND
          FROM SA_PG_MSTR spm, SA_WRK_ITM SWI
         WHERE SCCS_IND = '1' AND SWI.ACTIVE = '1' AND spm.pg_id = swi.tb_pg_id
        UNION ALL
        SELECT spm.PG_ID,
               spm.PG_NME,
               spm.PG_DESC,
               CURR_EPR_QUEUE,
               QUEUE_TYP_CDE,
               1 "TOTAL_CNT",
               JUD_RACIF_ID,
               CMPLTD_IND,
               DSPLY_IND
          FROM ST_WRK_ITM_JUD_DTL SWIJD, SA_WRK_ITM SWI, SA_PG_MSTR spm
         WHERE     SWI.WRK_ITM_ID = SWIJD.WRK_ITM_ID
               AND swi.tb_pg_id = spm.pg_id
               AND swi.queue_typ_cde IN ('01', '05')
               AND swi.dup_ind <> 1);
    [code]
    parameters in 9i are belows
    [code]
    aq_tm_processes    1
    background_dump_dest    D:\oracle\admin\TEST\bdump
    compatible    9.2.0.0.0
    cursor_sharing    similar
    db_block_size    8192
    db_cache_size    947912704
    db_domain
    db_file_multiblock_read_count    16
    db_keep_cache_size    167772160
    db_name    TEST
    fast_start_mttr_target    300
    hash_area_size    1073741824
    hash_join_enabled    TRUE
    instance_name    TEST
    java_pool_size    67108864
    job_queue_processes    10
    large_pool_size    109051904
    local_listener    (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.51)(PORT=1521))
    log_archive_format    %t_%s.dbf
    log_archive_start    TRUE
    log_buffer    26214400
    open_cursors    700
    optimizer_index_caching    80
    optimizer_index_cost_adj    20
    optimizer_mode    FIRST_ROWS
    pga_aggregate_target    1468006400
    processes    800
    query_rewrite_enabled    TRUE
    remote_login_passwordfile    EXCLUSIVE
    session_cached_cursors    400
    sga_max_size    2149134244
    shared_pool_size    788529152
    sort_area_size    1073741824
    star_transformation_enabled    FALSE
    timed_statistics    TRUE
    undo_management    AUTO
    undo_retention    10800
    undo_tablespace    UNDOTBS1
    utl_file_dir    H:\ICMS_TO_GO
    workarea_size_policy    AUTO
    [code]
    parameters in 10 are belows
    [code]
    aq_tm_processes    1
    compatible    10.2.0.5.0
    db_block_size    8192
    db_domain
    db_file_multiblock_read_count    16
    db_name    TEST
    db_recovery_file_dest    C:\oracle/flash_recovery_area
    db_recovery_file_dest_size    171798691840
    dispatchers    (PROTOCOL=TCP) (SERVICE=TESTXDB)
    job_queue_processes    10
    log_archive_format    ARC%S_%R.%T
    open_cursors    800
    open_links    10
    open_links_per_instance    10
    pga_aggregate_target    3984588800
    processes    1200
    recyclebin    OFF
    remote_login_passwordfile    EXCLUSIVE
    session_cached_cursors    400
    sessions    1325
    sga_max_size    10485760000
    sga_target    10485760000
    undo_management    AUTO
    undo_tablespace    UNDOTBS1
    utl_file_dir    H:\ICMS_TO_GO
    optimizer_dynamic_sampling    2
    optimizer_features_enable    10.2.0.5
    optimizer_index_caching    80
    optimizer_index_cost_adj    20
    optimizer_mode    FIRST_ROWS
    optimizer_secure_view_merging    FALSE
    plsql_optimize_level    2
    [code]
    where can we look into for this issue? actually we need rows will be the same ordering as it was in 9i.
    we are facing this problem in lot of queries, this is a sample one.
    Regards
    Halim

    Hi Jgarry,
    why do you need a particular physical order?
    Actually i don't know the .net application behave or code yet . but after migration, I am facing this issue.
    one more thing we changed the server machine so Is there any registry parameter (in windows) related to this. Have you any idea.
    the application is running since 8 years and I think nobody can rely on implicit data distribution arising from how the data is entered to develop a application.
    Hi Hoek,
    According to Oracle White Paper(page 17), If I change below parameter. Is there any hope to get same order.
    "After you upgrade to Oracle Database 10g, if you
    wanted to revert back to 9.2 optimizer behavior you can set
    OPTIMIZER_FEATURES_ENABLE = 9.2.0 "
    Regards
    Halim

  • Db link tables in processes and row fetch

    I have an application I developed in schema A that is referencing tables in schema B. I have been told that these tables need to be moved to another database for which I have created a database link. I know this database link is working because it tests ok and I can pull user names from a user table in an item.
    Also, on the first page I have a report that sources from the dblink:
    SELECT TRK_CALLS.ID, TRK_CALLS.USER_, TRK_CALLS.ASSIGNED_TO, TRK_CALLS.PROBLEM, TRK_CALLS.SOLUTION, TRK_CALLS.STATUS
    FROM TRK_CALLS@DBLINK_IM3
    WHERE
    ( STATUS = 'Open' and :P2_REPORT_SEARCH is null )
    or
    ( regexp_like( USER_ || '#' || ASSIGNED_TO || '#' || PROBLEM || '#' ||
    SOLUTION || '#' || STATUS, :P2_REPORT_SEARCH, 'i' ) )
    This is working correctly.
    I have edit buttons for the rows in the report that redirect to page 6. I get any error unable to fetch row.
    In the row source I placed
    trk_calls@DBLINK_IM3
    I only have one selection as table owner WEBB so this may be part of the problem but I am not sure how to fix this. I tried to create a new row fetch under the the owner GIS which is the right owner but it still diplays WEBB once created. Is this even part of the Solution?
    Is there a better way to do this? PL/SQL expression?
    I have many other processes that will have insert, apply changes, etc to the tables so if I can get this to work I may be on my way to making the db link work.
    Please help me in any way possible.
    Thanks,
    Kirk

    Kirk,
    you get this error because it is impossible to use the returning clause, probably because you are using a DB link.
    You can cicrumvent this by determing the primary key value in the PL/SQL before doing the insert and then including its value in the insert:
    Thanks alot for the info on creating the view. It is working to a certain point.
    I am getting a 'ORA-22816: unsupported feature with RETURNING clause' error now. I created the view and referenced the view in all of my pages. Simply put, wherever I had TRK_CALLS in a source or SQL expression I replaced it with TRK_CALLS_VIEW.
    The application didn't have the error before and the only thing I changed was this. What could be the problem?
    This is the expression that the error is referring to:
    declare
    l_CALL_ID number;
    begin
    /* determine CALL ID */
    i_call_id := get_call_id; /* some function returning new call id */
    insert into webb.TRK_CALLS_VIEW
    (+id+, USER_, ASSIGNED_TO, PROBLEM, SOLUTION, STATUS)
    values
    (+i_call_id+,:P3_USER_, :P3_ASSIGNED_TO, :P3_PROBLEM, :P3_SOLUTION, :P3_STATUS)
    good luck, DickDral

  • JDBC Sender Adapter - Restrict number of rows fetched, Oracle

    Hi,
    Is it possible to restrict the number of rows fetched by the JDBC Sender adapter at each run? What would the appropriate Select and Update statements be to make sure a limited number of rows are selected and flagged as processed?
    We are connecting to a Oracle RDBMS.
    //Johan

    hi,
    have a look at this info:
    about oracle and limiting number of rows
    http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • CUSTOM ROW FETCH USING PLSQL BLOCK DOESN'T WORK

    Hello,
    I'm using Apex 3.0, and I'm trying to use a anonymous block to populate page items instead of automatic row fetch. Apparently the block works fine but the page doesn't display the items with the values that I fetched.
    I'm using something like:
    Declare
    v_test varchar2(10);
    begin
    select name into v_test from emp where emp_no=:p10_id;
    :p10_name:=v_test;
    end;
    Does anyone have a clue ? The process is defined to run on "OnLoad - After header", but I've tried other options, but the results are the same: P10_name appears blank.
    thank you for your help
    JAV

    But there is a catch.....on the item definition, the "SOURCE USED" must be set to "Only when current value in session is null", otherwise, it doesn't show what you want.
    Cheers
    JAV

  • Automatic row fetch based on a select list

    db11gxe , apex 4.0 , firefox 24 ,
    hi all ,
    i want to do automatic row fetch when the value of a select list changes ?
    but first i should ofcourse create a tabular form to fetch the data into it , but what i want is ,if i fetch 2 rows then the report contains only two rows , if i fetch 3 , the report contains only 3
    , if i fetch nothing , the report has nothing ?
    thanks

    Assuming all your page items are on separate rows, under your Page Attributes Header and Footer section, add the below function under Header Text:
    <script>
    function f_toggleNM() {
       // if P2_ATTACHMENT_TYPE value is D, then show row holding P2_CUSTOM_NAME and P2_CUSTOM_MSG. Else hide them
       $f_Show_On_Value_Item_Row('P2_ATTACHMENT_TYPE', [ 'P2_CUSTOM_NAME', 'P2_CUSTOM_MSG' ], 'C');
       // if P2_ATTACHMENT_TYPE value is C, then show row holding P2_DEFAULT_NAME and P2_DEFAULT_MSG. Else hide them
       $f_Show_On_Value_Item_Row('P2_ATTACHMENT_TYPE', [ 'P2_DEFAULT_NAME', 'P2_DEFAULT_MSG' ], 'D');
    </script>Under Footer Text, add the below:
    <script>
    f_toggleNM();
    </script>And on the P2_ATTACHMENT_TYPE item, Element tab, HTML Form Element Attributes, add below:
    onchange="f_toggleNM();"Hope this helps. Thanks!
    JMcG

Maybe you are looking for