Table is recognized in a SQL statement, but in a stored procedure.

Hello
I'm using Oracle 9.2.0.6.0.

I'm trying to compile a package of procedure in a 10 g database which has been cloned from a 9i database.

I get an error that there is no sys.dba_refresh table (PL/SQL: ORA-00942: table or view does not exist). Here is the procedure from the package:
  procedure refresh_group
  (
   errbuf                 out varchar2
  ,retcode                out varchar2
  ,p_refresh_group_owner      varchar2
  ,p_refresh_group_name       varchar2
  ,p_trace_flag               varchar2 default 'N'
  )
  is
    cursor c_rg is
      select
             job
            ,broken
      from
             sys.dba_refresh
      where
             rowner = upper(p_refresh_group_owner)
      and
             rname = upper(p_refresh_group_name)
      ;
    v_job     number  default null;
    v_broken  char(1) default null
    ;
  begin
    /*
    ** Standard FORX Startup
    */
    forx_module.start_module('FORX_SNAPSHOT.REFRESH_GROUP')
    ;
    /*
    ** Verify parameters / status of request group
    */
    for c_rg_rec in c_rg
    loop
      v_job    := c_rg_rec.job;
      v_broken := c_rg_rec.broken;
    end loop
    ;
    if v_job is null
    then
      raise e_invalid_request_group;
    else
      if v_broken = upper('y')
      then
        raise e_dbms_job_is_broken;
      end if
      ;
    end if
    ;
    /*
    ** Move next execute date out one year (it will be scheduled via concurrent manager.)
    */
    dbms_refresh.change(p_refresh_group_owner || '.' || p_refresh_group_name
                       ,sysdate + 365
                       ,'sysdate + 365'
                       )
    ;
    forx_module.commit_force
    ;
    /*
    ** Refresh the specified group. Check the trace flag before. If Y then set the events
    ** to 4045 for the session
    */
    -- Disable query rewrite

    execute immediate ('alter session set query_rewrite_enabled=false');

    if (p_trace_flag = 'Y') then
    -- Set the event to trace ORA-4045 error
       fnd_file.put_line(fnd_file.log,'alter session set events = ''4045 trace name errorstack level 3'''
                         || ' : '
                         || to_char(sysdate,'MM-DD-YYYY / HH:MI:SS AM')
                        )
    ;

      execute immediate ('alter session set events = ''4045 trace name errorstack level 3''');
    end if;

    dbms_refresh.refresh(p_refresh_group_owner || '.' || p_refresh_group_name)
    ;
    forx_module.commit_force
    ;
    if (p_trace_flag = 'Y') then
       execute immediate ('alter session set events = ''4045 trace name errorstack off''');
    end if;
    -- Enable query rewrite
    execute immediate ('alter session set query_rewrite_enabled=true');

    fnd_file.put_line(fnd_file.output,'Snapshot refresh group: '
                                   || p_refresh_group_owner || '.' || p_refresh_group_name
                                   || ' refreshed on/at: '
                                   || to_char(sysdate,'MM-DD-YYYY / HH:MI:SS')
                     )
    ;
    /*
    ** Standard end-of-module processing.
    */
    forx_module.end_module(errbuf
                          ,retcode
                          )
    ;
  exception
    when e_invalid_request_group then
      forx_module.end_module(errbuf
                            ,retcode
                            ,'ERROR'
                            ,'Error!  Refresh group: '
                          || upper(p_refresh_group_owner)
                          || '.'
                          || upper(p_refresh_group_name)
                          || ' does not exist.'
                            )
      ;
    when e_dbms_job_is_broken then
      forx_module.end_module(errbuf
                            ,retcode
                            ,'ERROR'
                            ,'Error!  The refresh dbms_job (job: '
                          || to_char(v_job)
                          || ') for refresh group: '
                          || upper(p_refresh_group_owner)
                          || '.'
                          || upper(p_refresh_group_name)
                          || ' is flagged as BROKEN.  Seek DBA Assistance.'
                            )
      ;
    when others then
      forx_module.end_module(errbuf
                            ,retcode
                            ,'ERROR'
                            ,sqlcode || '-' || sqlerrm
                            )
      ;
  end refresh_group
  ;

  --
  -- Refresh an Individual Materialized View
  --
I am able to describe the table. I am also able to execute the SQL statement in the cursor c_rg.
    select
             job
            ,broken
      from
             sys.dba_refresh;
Anyone know if it has to do with the removal of this particular code in 10g 9i or is there a more general reason for this?

Subsidies on the table are the same. The table was created as it was in the Database 9i with a public synonym. I don't see anything other than the DBA forgot to do.

Does anyone have any ideas?

Hello

Make sure that all the necessary privileges have been granted directly to the owner of the package, not to a role that is the owner of the package. (The roles do not count in stored procedures).

Tags: Database

Similar Questions

  • LOV SQL statements - where its get stored?

    Hello

    I had a big doubt in it. When we create the LOV through a dynamic list of value, we used the sql statement to retrieve all the data in the table.

    Where exactly the stored SQL statement?

    Help me in this doubt.

    See you soon,.

    Shan

    Hello

    Check APEX_APPLICATION_LOVS.
    Run the query in sql workspace Studio

    SELECT *
    FROM APEX_APPLICATION_LOVS
    

    The LIST_OF_VALUES_QUERY column indicates your lov query

    BR, Jari

  • How to combine towing sql statements.

    Hi all

    I try to combine the two sql statements. but it is giving error 907, I can't stand no less. Please correct me if am wrong.
    Here's my query



    Select a.A1, b.C1, a.B1 in)
    (select C1, sum (s.amount_sold) cust_first_name
    customers c, s sales where c.cust_id = s.cust_id
    C.cust_first_name group),
    (select t.calendar_year A1, sum (c.unit_cost) B1
    the time period t, cost c where
    t.TIME_ID = c.TIME_ID and t.calendar_year
    ((1998,1999) group by t.calendar_year) b) order of 1, 2


    Thank you
    Sree

    I found two [a start and closing] and additional fasteners - from parentheses after FROM and closing introductory "order by".

    Try this:

    SELECT a.A1, b.C1, a.B1
      FROM
                 (  SELECT cust_first_name C1, SUM (s.amount_sold)
                 FROM customers c, sales s
                WHERE c.cust_id = s.cust_id
              GROUP BY c.cust_first_name) a,
                (select t.calendar_year A1,sum(c.unit_cost) B1
                from times t,costs c where
                t.time_id=c.time_id and t.calendar_year
                in (1998,1999) group by t.calendar_year) b
    order by 1,2
    

    Published by: user130038 on Sep 1, 2011 08:19

  • PL/SQL statement.

    I'm in the process of data blocking oracle, how I can wright in PL/SQL or storeprocedure in Oracle SQL Developer. So instead of using the sql OLEDB data variable from command access mode, I'd use sql command to execute the stored procedure. DECLARE @Today datetime,

    @FirstDay DateTime,

    @LastDay DateTime,

    @LastMonthFirstday varchar (9).

    @LastMonthLastDay varchar (9)



    SET @Today = CAST (CONVERT (nvarchar (10), GETDATE(), 120) AS datetime)-time strips off

    SET @LastDay = DATEADD (day,-DAY (@Today), @Today)-last day of the previous month

    SET @FirstDay = DATEADD (month,-2, DATEADD (day, 1, @LastDay))-first day of the previous month

    Set @LastMonthFirstday = Cast (Replace (Convert (varchar (9), @FirstDay, 6), ' ', '-') As varchar (9))--@FirstDay

    Set @LastMonthLastDay = Cast (Replace (Convert (varchar (9), @LastDay, 6), ' ', '-') As varchar (9))--@LastDay



    INSERT INTO STAGINGTABLE

    SELECT TABLE1.*, TABLE2.*, TABLE3.*FROM TABLE1, TABLE2, TABLE3WHERE TABLE1. CASE_DATE BETWEEN to_date ('LastMonthFirstday') AND to_date ('LastMonthLastDay') AND TABLE1. MEASURE_ID = TABLE2. MEASURE_IDAND TABLE1. MEASURE_ID = TABLE3. MEASURE_ID;
    INSERT INTO STAGINGTABLE
       SELECT TABLE1.*,
              TABLE2.*,
              TABLE3.*
       FROM   TABLE1,
              TABLE2,
              TABLE3
       WHERE  to_date(TABLE1.CASE_DATE,'DD-MM-YY') BETWEEN trunc(add_months(sysdate,-1),'MM')  -- Last month 1st day
                                   AND trunc(sysdate,'MM')-1                 -- Last month Last day
       AND    TABLE1.MEASURE_ID = TABLE2.MEASURE_ID
       AND    TABLE1.MEASURE_ID = TABLE3.MEASURE_ID;
    
  • Call the stored procedure to support bean w / table setting dimensional bi

    Hi all, I use jdeveloper 11g

    I have a requirement where instead of calling several times a "insert into" statement rather call a stored procedure, a table shipping two-dimensional bi as a parameter.

    The table must have size [n] [4] and [0] [0] = string and others must have numbers.

    This is because users will be inserting thousands of records at a time, remote sites, so the load of sending of a should be avoided.

    Any suggestions?

    Thank you.

    Miguel,
    If you use ADFbc (VO and EO sense), you can use batch insert for this archive.
    However, he must think about the user interface and how to transfer data from the client to the server taking the place of the insert.

    How you accumulate the data to insert into the DB?
    Are able to collect you say 1000 records a time and transfer them in a single segment on the server?
    How about data validation and exception handling while inserting into the db?

    I'm sure you can use a pl/sql procedure to do the Insert, but the questions above should always be answered.

    Timo

  • How to create temporary tables in stored procedures.

    Hello

    I am new to oracle, I have a requirement where I need to run a query in a loop for different values of where condition. Here, I need to record the results of the query on each iteration. After the end of the loop, I need to send the results to the front end. I did a lot of research for the concept of the temporary table in oracle, but I found myself unresolved except headaches. Everyone is showing how to create temporary tables in general but not in stored procedure.

    Bad, I need the concept of temporary tables, or is there an alternative way to store temporary results. My procedure looks like this.

    create or replace
    procedure uspMatchCode (parWord varchar2, p_recorderSet to types.cursor_type)
    as
    smallint parCnt;
    Start
    parcnt: = 0;
    Select count (1) in parCnt of...;
    If parcnt > 0 then
    Open for P_recorderSet
    Select field1, field2, field3,... of table1, table2, table2 where < < condition > >
    on the other
    -Here, I want to create a temporary table and store the result for the loop shape into the temporary table.
    CREATE TEMPORARY TABLE global my_temp_table (NUMBER of Column1, Column2) ON COMMIT DELETE ROWS.
    FOR parCnt in 0.3
    loop
    INSERT into my_temp_table select Field1, Field2, field3,... from table1, table2, table2 where < < condition > >
    end loop;
    Open for P_recorderSet
    Select * from < < temporary table > >
    end if;
    end;

    Any help would be great to check me on the problem.

    Thank you
    Kiran.

    This is a change to the query Kiss has posted:

    with data_text like)
    Select regexp_substr (' sales financing marketing ',' [^] +', 1, level ") val
    of tconnect by level<= length('sales="" finance="" marketing')-="" length(replace('sales="" finance="" marketing','="">
    )
    Select * from t, data_text, where t.colname like '% "| data_text. Val |' %'

    This will help you. Please change the column names and the name of the table as a result

  • How can I pass a condition of the table in the sql statement?

    For example, in the table in the COND Varchar2 column (200) there is the value ' VAR > 10'.

    | COND |

    |' VAR > 10' |

    where VAR is the name of the table column. I would like to make statement CASE WHEN VAR > 10 AND 0... I tried with as subquery

    WHEN BOX (SELECT COND FROM TABLE WHERE...) THEN 0, but it does not work.

    Hello

    You can do this by using dynamic SQL.

    that is to say:

    declare
      v_stm      varchar2(4000);
      v_cond      varchar2(100);
      v_result    integer;
    begin
      select cond
        into v_cond
        from yourtable
      where a=1;
    
      v_stm := 'select case when '||v_cond||' then 0 ...';
    
      -- dynamic sql
      execute immediate v_stm
        into v_result;
    
    end;
    /
    

    Remember that, in general, dynamic SQL has a performance degradation that SQL static and should be avoided when possible.

    Storage condition or the SQL statements in the tables is not a good practice.

    Kind regards.

    Alberto

  • How to execute a SQL statement that is stored within a SQL Table

    Hello

    If someone please help me with the following problem I would be eternally grateful

    I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.

    Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.

    Thanks in advance!

    This is what it looks like more or less:

    Display result for:

    ---------------------

    SELECT TRIM (OBJ_VALU_TXT)

    OF OBJ_VALU_DOC

    WHERE TYPE_OBJET = 'FLD '.

    AND OBJECT_CODE = 15443

    AND OBJ_VALU_CD = 'CAB '.

    ORDER BYDOC_SEQ_NO

    00001

    ------------------------------------------------------------------

    SELECT

    VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)

    THE FRONT DESK

    WHERE (RECEIPT_NO BETWEEN

    (: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR

    (RECEIPT_NO >: OUT-COMP-FACTOR AND)

    (: OUT-TO-NUMBER = 0)

    Here's a demo of your condition.

    create table t (col1 varchar2 (200));

    table created

    insert into values t ('select * from double ');

    1 row inserted

    declare
    v_col varchar2 (200);
    v_val varchar2 (200);
    Start

    Select col1 in t v_col;

    run immediately v_col in v_val;
    dbms_output.put_line (v_val);
    end;

    -----
    X

    Use in the clause, you can use as many variables as needed. But the basic approach remains the same.

    But storage in DB SQL is not an efficient design.

    Ishan

  • Under certain conditions, update a table based on the comparison with a SQL statement

    I have a table (table 1) that has 4 columns:

    UID. THE NEST | VALUE1 | VALUE2

    I have another statement SQL (STMT) that returns the 3 columns of a few other tables:

    UID. THE NEST | VALUE1

    Now this is the condition of the way in which I want to put up-to-date TABLE1:

    First, to compare a pair of UID and PID of STMT with those in TABLE1,

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    I can't seem to come with a solution for condition 2. Any help is appreciated!

    Hello

    Here's one way:

    MERGE INTO  table1  dst
    USING          (
                 SELECT  ...   -- your stmt query goes here
             )   src
    ON         (    src.uid  = dst.uid
             AND      src.pid  = dst.pid
             )
    WHEN MATCHED THEN UPDATE
    SET           dst.value1 = CASE
                                   WHEN   dst.value2 > 0
                        OR     (   dst.value2 = 0
                             AND dst.calue1 != src.value1
                        )
                        THEN   src.value1
                               END
    WHERE   dst.value2 > 0
    OR (    dst.value2 = 0
       AND  dst.calue1 != src.value1
       )
    ;
    

    This assumes that the combination (uid, pid) is unique in stmt. It doesn't have to be unique in table1.

    sb92075 wrote:

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    FUSION could also do parts 1 and 2 together, in the same statement.

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    Why are they not simply your needs ' uid and pid that already exist in stmt and table1, if table1.value2 > = 0, then the value table1.value1 = stmt.value1 "? Are you concerned about shooting triggers unnecessarily? It has something to do with null values? The MERGE statement above does exactly what you asked, but, depending on your needs, something simpler and more efficient could do it as well.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, June 6, 2012 14:51

  • EXECUTE A STORED IN A TABLE SQL STATEMENT

    I have a table t1 with a column varchar2 "T", which contains after the plsql query statement

    Select P_Cod from t1

    Nothing in the table except that select statement.

    I want to run this query statement following a procedure / function / sql statement, any thing.

    Any body can help me emergency?

    user12570554 wrote:
    I have a table t1 with a column varchar2 "T", which contains after the plsql query statement

    PL/SQL does not query instructions, only SQL performs.

    Basically, what you're trying to do is a very bad idea. Why I say this is the thought crossed my mind sometimes, back and I initially thought that it's a cool thing to store SQL table. But after several discussions, I learned to know the bad side of this.

    You can check this post in ask tom. I posted a few months ago.

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:1943344500346351703

  • table in the sql statement

    Hi all

    I just created a function that returns a TABLE;

    I am grateful if some body guide me how to display the values in the table at the call of my sqlplus as function

    Select * from func_avg_cost() of double;

    its fine when you return a single value of work. But I'm back a table to retrieve the value from the table in the sql statement

    Thank you!

    now, I must return two numbers function. as possible through table.

    which is also possible with a simple object:

    SQL> create or replace type my_number_typ as object (n1 number, n2 number)
    /
    Type created.
    
    SQL> create or replace function my_numbers (n1 number := 0, n2 number := 0)
       return my_number_typ
    as
    begin
       return my_number_typ (n1, n2);
    end my_numbers;
    /
    Function created.
    
    SQL> select   my_numbers (2, 3) from dual
    /
    MY_NUMBERS(2,3)
    --------------------------------------------------
    (2; 3)
    1 row selected.
    
    SQL> select   my_numbers (sal, deptno) my_numbers  from   emp where   empno = 7788
    /
    MY_NUMBERS
    --------------------------------------------------
    (3000; 20)
    1 row selected.
    
    SQL> select   my_numbers (sal, deptno).n1 sal, my_numbers (sal, deptno).n2 deptno
      from   emp where   empno = 7788
    /
           SAL     DEPTNO
    ---------- ----------
          3000         20
    1 row selected.
    
  • How to use the T distribution table in sql statements?

    Hi all

    I'm in the need to use the T distribution table in sql... I don't know how to use...

    Is there a function to use the values of table in sql statements?

    Can someone please help me in this?

    How about this http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions157.htm#i1279931?

    Concerning

    Etbin

  • What are these SQL statements?

    Hello!

    We are our applications running on Windows Server 2003 where it works fine, using Oracle via OCI 12.1.

    Now, we have the application installed on Windows Server 2012 and it works very slowly.

    When comparing these two environments trace files came a surprise: Oracle generates a lot of SQL statements when run on Windows Server 2012!  By operating on Windows2003 it only executes the SQL from the applicaton instructions.  These additional SQL statements must be the reason for the slowness, but why Oracle it generates them and how could we get arrested?

    An example:

    PARSING IN CURSOR #46985062096816 len = 210 dep = 2 uid = 0 oct = cover 3 = 0 tim = hv 1439277877325893 = ad 864012087 = "4db599f28" sqlid = "96g93hntrzjtr."

    Select / * + rule * / bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp #, sample_size, minimum, maximum, distcnt, lowval, hival, density, col #, spare1, spare2, hist_head avgcln $ where obj #=: 1 and intcol #=: 2

    END OF STMT

    ANALYSIS #46985062096816:c = 1000, e = 456, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 0, tim = 1439277877325890

    EXEC #46985062096816:c = 0, e = 498, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326455

    FETCH #46985062096816:c = 0, e = 56, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326533

    STAT #46985062096816 id = 1 cnt = 1 pid = 0 obj = op 411 = pos = 1 "TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr = 3 pr = 0 pw = time 0 = 55 US)"

    "STAT #46985062096816 id = 2 cnt = 1 pid = 1 pos = 1 obj = op 413 ='INDEX RANGE SCAN I_HH_OBJ #_INTCOL # (cr = 2 pr = 0 pw = time 0 = 32 US)"

    OUTCOME #46985062096816:c = 0, e = 37, dep = 2, type = 3, tim = 1439277877326601

    EXEC #46985062096816:c = 0, e = 23, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326702

    FETCH #46985062096816:c = 0, e = 18, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326738

    OUTCOME #46985062096816:c = 0, e = 8, dep = 2, type = 3, tim = 1439277877326765

    EXEC #46985062096816:c = 0, e = 19, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326837

    FETCH #46985062096816:c = 0, e = 21, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326923

    OUTCOME #46985062096816:c = 0, e = 10, dep = 2, type = 3, tim = 1439277877326954

    Thank you very much in advance!

    Best regards

    Jaakko Terhonen

    Thank you all for the reply!  This time, the reason was a problem in network traffic (TCP protocol): a lot of retransmissions for a still unknown reason.  If it had nothing to do with Oracle after all.

    I cried for help here because as a common application programmer, I wasn't familiar with the Interior details of SQL analysis and after seeing it in the trace, I assumed that these strange SQL statements - which, for some reason, is appeared only in W2012-trace - were the reason for the slowness.

    Thank you, I'm a little wiser now - and I hope that many others find this thread before asking the same question!

    Best regards

    Jaakko Terhonen

  • Cannot query a view in PL/SQL package but it can query in SQL * more

    Hello

    Logged on as a user, I can query the table DBA_SEGMENTS, but I can't question via a slider or select from a PL/SQL package.

    I get the following error message:

    LINE/COL ERROR

    -------- -----------------------------------------------------------------

    28/4 PL/SQL: statement ignored

    33/5 PL/SQL: ORA-00942: table or view does not exist

    28 select

    29                             count(*)

    30 in

    31                             n

    32 of

    33 dba_segments;


    Can someone explain to me what is the missing privilege that I need?

    Thank you in advance.

    Kind regards.

    It seems that you have granted to dba_segments by role.

    To use this object in pl/sql or sp, you need directly.

    Ask your dba to grant:

    SQL > grant select on dba_segments to your_user;

    Mustafa DOGANAY

    http://Doganay.WordPress.com

  • Order of execution of SQL statements

    Hello

    I have two SQL statements where the first statement executes on a table with more than 40 million lines, the second statement is running on a table more 6 million lines.  When they are running their own each take about 0.15 seconds to run, but when combined they take 20 minutes to run, (the second SQL statement is inserted in the WHERE clause of the statement of first).  It would seem that after combining these statements, the first statement goes through all 40 million lines before it performs the SELECT in the WHERE clause.  I think that what is necessary is to ensure the SELECT in the WHERE clause is executed first... or something like that!  Anyone has any ideas on how to combine these statements but not suffer from the performance impact?

    The first statement is:

    Select csi.instance_id,

    OEL.ordered_item

    of apps.csi_item_instances csi,.

    Apps.oe_order_lines_all oel

    where csi.instance_id in

    (1718000,3698000,48740202)

    and csi.last_oe_order_line_id = oel.line_id;

    The second statement is:

    Select / * + INDEX (IEA (attribute_id)) * /.

    IEA.instance_id

    apps.csi_iea_values do

    where iea.attribute_id = 10004

    and iea.attribute_value is not null;

    The joint return is:

    Select csi.instance_id,

    OEL.ordered_item

    of apps.csi_item_instances csi,.

    Apps.oe_order_lines_all oel

    where csi.instance_id in

    (select / * + INDEX (IEA (attribute_id)) * /)

    IEA.instance_id

    apps.csi_iea_values do

    where iea.attribute_id = 10004

    and iea.attribute_value is not null)

    and csi.last_oe_order_line_id = oel.line_id;

    Thanks for any help,

    Mike

    Your subquery returns probably just two values that you did originally as constants - but the optimizer thinks that you're going to get 564 K lines.  This is why the indicator for the simple query has a beneficial effect, it forces the Oracle to use an index when it would otherwise make a search.

    When the subquery is incorporated, however, the optimizer uses its cardinality expected to decide whether to use a nested loop join or the hash join to CSI_ITEM_INSTANCES, since the large enough estimate, he uses the hash with a join analysis complete.  That's why I pointed out that the fact to tell the optimizer to how many lines outside the subquery should make a difference.

    Have you tried the "common table expression" approach, rather than approach no_merge, but it would not help because it does not change the optimizer for cardinality estimate.  If you want to repeat the method CTE adding boards / * + materialize cardinality (2) * / to the query in the WITH clause, you should get the desired result.

    Concerning

    Jonathan Lewis

Maybe you are looking for

  • How I increase and maintain the police increased for an another ikons/websites?

    If I swing fonts in an ikon the police for another ikons remains low. It is necessary to maintain the size of the fonts for all client icons.

  • Labels of bubble in figures

    I want each point of my bubble chart have a different label, pointing to the name of the series. How to do? I want something like this: Data point X Y Z Point 1 4 2 1 Point 2 6 4 2 Point 3 2 6 1 Point 4 10 3 8 So I want that each bubble (with the X p

  • XP to Windows 7 upgrade

    I want to improve my windox xp pro to windows 7. Do I have to purchase the full version of windows 7 or just the upgrade disc, because there is a significant difference in the price. Thank you Chris

  • ScriptUI: get the dimensions of the container using the automatic formatting?

    No there is no way to get the dimensions of a ScriptUI container that uses the automatic formatting?  What container root (Panel or window)?  I'm writing a presentation for a group and I would like to react to the dimensions of the window or Panel, a

  • Create button events

    Hello I need to create an event and business of a subscription, but the buttons 'Create event' or "Create Subscription" are not displayed to the top.Y at - it a profile option that must be set so that they will display. e-Business Version: 11.5.10.2