How it warns Oracle to use an index for the join of two tables...

How to prevent the Oracle to use an index for the join of two tables to get a view online that is used in an update statement?

O.K. I think I should explain what I mean:

When you join two tables that have many entries sometimes there're better is not to use an index on the column that is used as a criterion to join.

I have two tables: table A and table B.

Table A has 4,000,000 entries and table B has 700,000 entries.

I have a join of two tables with a numeric column as join criteria.

There is an index on this column in A table.

So I instead of
  where (A.col = B.col)
I want to use
  where (A.col+0 = B.col)
in order to avoid Oracle using the index.

When I use the join in a select query, it works.

But when I use the join as inline in an update statement I get the error ORA-01779.

When I remove the '+ 0' the update statement works. (The column is unique in table B).

Any ideas why this happens?

Thank you very much in advance for any help.

Hartmut cordially

You plan to use a NO_INDEX hint as shown here: http://www.psoug.org/reference/hints.html

Tags: Database

Similar Questions

  • Parent index for the data in a table?

    Is there a way to index a child table with a function to include a column from a parent table?

    Example:

    I want to see how many children live in a zip code (and their address is listed with their parents)

    Select count (*)

    class c of child, parent p

    where c.parent_id = p.parent_id

    and p.zipcode = "12345"

    Is there a way to make an index of children with a function that gets parents zip code?

    Thanks for the help?

    An index on the child table can reference only the columns of the child table.  You can't have an index on the child table that is based on information from the parent table.

    There are the function-based index, but they may involve only constants and deterministic functions (and, of course, the columns of the table).  For example, the child table could have a clue on UPPER (name), where last_name is a column of the table, but he could not have a clue about get_zip (parent_id), where get_zip is a function defined by the user who queries the parent table.

    Well - you "might" have a functional indication if you did to be deterministic, but it is not recommended because if the changed zip_code parent would really not deterministic and the change would not be included in the index.

    This apart from this code will work properly if the zip_code data does not change:

    CREATE TABLE parent (COL1 number primary key, zip VARCHAR2 (5))
        
    create the child table (col1 number, parent_key number);

    create or replace function get_zip (number p_key) return deterministic varchar2 as
    v_zip varchar2 (5);
    Start
    Select zip from v_zip of the parent where col1 = p_key;
    Return v_zip;
    end;

    /

    create indexes on children (get_zip (parent_key)) child_zip;

  • How do good group when the join of two tables?

    Hi all

    The slot using join query, I'd like to get an output will depend on the number of 'Classes' (for example: if I want the result for 15 classes, then, he must return to 16 lines from 0 to 16).
    I n query below, I use the group as
    "GROUP BY report_parameters.report_parameter_value  "
    .

    Error that says "this is not group by expression.

    If I have commented here, here he returns 320 rows instead of 16 ranks.

    Could someone help me?

     SELECT 'SUM('
        || 'CASE '
        || 'WHEN edr_class_by_gvw_report_data.bin_id >= ' || report_range_parameters.report_parameter_min_value || ' 
             AND edr_class_by_gvw_report_data.bin_id  < ' || report_range_parameters.report_parameter_max_value || '
            THEN edr_class_by_gvw_report_data.bin_value '    
        || 'ELSE 0 '
        || 'END '
        || ') "Class ' || report_parameters.report_parameter_value || '" '    
          FROM report_parameters
          JOIN report_range_parameters
            ON report_parameters.report_parameter_id = report_range_parameters.report_parameter_id 
         WHERE report_range_parameters.report_parameter_id    = 2316    
           AND report_range_parameters.report_parameter_group = 'GVW_GROUP'
           AND report_range_parameters.report_parameter_name  = 'GVW_NAME'
           AND report_parameters.report_parameter_group = 'CLASS'
           AND report_parameters.report_parameter_name  = 'CLASS' 
         GROUP BY
          report_parameters.report_parameter_value  
         ORDER BY  report_range_parameters.report_parameter_min_value ASC;
    Thank you.

    Published by: user10641405 on June 11, 2009 12:23

    Published by: user10641405 on June 11, 2009 12:30

    Hello

    Let me explain what I'm trying to do.
    I want to write a query that produces this output:

    SUM(CASE WHEN edr_class_by_gvw_report_data.gvw >= 0 AND edr_class_by_gvw_report_data.gvw  < 5 THEN edr_class_by_gvw_report_data.gvw_count ELSE 0 END ) "Class 0"
    SUM(CASE WHEN edr_class_by_gvw_report_data.gvw >= 5 AND edr_class_by_gvw_report_data.gvw  < 10 THEN edr_class_by_gvw_report_data.gvw_count ELSE 0 END ) "Class 1"
    SUM(CASE WHEN edr_class_by_gvw_report_data.gvw >= 10 AND edr_class_by_gvw_report_data.gvw  < 15 THEN edr_class_by_gvw_report_data.gvw_count ELSE 0 END ) "Class 2"
    SUM(CASE WHEN edr_class_by_gvw_report_data.gvw >= 15 AND edr_class_by_gvw_report_data.gvw  < 20 THEN edr_class_by_gvw_report_data.gvw_count ELSE 0 END ) "Class 3"
    SUM(CASE WHEN edr_class_by_gvw_report_data.gvw >= 20 AND edr_class_by_gvw_report_data.gvw  < 25 THEN edr_class_by_gvw_report_data.gvw_count ELSE 0 END ) "Class 4"
    

    using data from tables report_parameters and report_range_parameters, which are like your tables.
    Right now, I don't have report_parameters and report_range_parameters tables.
    I need to create and put the data in them that is like your data.
    If I have the same data you have, and if I can produce the results that you want from the data, so I'll post my query, and you can use it.

    I do not see how to INSERT statements like this:

    INSERT INTO "class_by_gvw_report_data"
              SELECT site_id,
                  site_lane_id,
                 site_direction_id,
                site_direction_name,
                  bin_start_date_time,
                  bin_end_date_time,
                  bin_id,
                bin_value
             FROM "class_by_gvw_bin_data"
    

    can help me. Is the table "class_by_gvw_report_data" invloved in this problem? Is this the same as report_parameters or report_range_parameters? If Yes, I need to create it, and put the data into it, so to use the above statement I need all data of "class_by_gvw_bin_data".

    I need to have something that I can run, so that my paintings will have sample data which would result in the desired output.
    I need the CREATE TABLE statements, but I can probably guess what they should be if I have your data. If this isn't the case, I will seek further clarification later.
    I can't guess what your data, and why is it causing problems. If I just do a few data, LII is virtually no chance he's going against hepatitis has a relationship between the tables that are causing you problems of the same nature.

    Please post INSERT statements that I can run and produce the same type of data that is causing problems.

  • How to use an index with the clause 'in '.

    Hi all

    I have a sql statement with "" * in the clause * "."

    for example:
    select emp_id from emp where ename in ("vikas", "krishna", "John", "scott");
    When I check the plan explain he uses the index here even if the statistics was entered. He always goes for the full table scan.
    There is an index created for the ename column.

    Please tell me a technique on how to make use of the index here.


    Thank you and best regards,
    Vikas Krishna

    Vikas,

    What version of Oracle you are running.
    CLAUSE IN will use the index as appropriate.
    In your example Optimizer may decide to use FTS (Full Tablle Scan) for various reasons. May be that the table is very small.
    SE for example below where he uses an index on the CLAUSE IN...
    The essential point being that I made "wide enough" table (in this case including a column of type CHAR) makes use of INDEX more effective than a FTS.

    select * from v$version where rownum < 2;
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    
    create table bigt (c int, s char(100));
    
    insert into bigt select level, 'X' from dual connect by level < 501;
    
    create index bigt_in1 on bigt (c );
    
    exec dbms_stats.GATHER_TABLE_STATS('SUDHAKAR', 'BIGT');
    
    explain plan for select c,s from bigt
    where c in (1,2,3,43,5);
    
    select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    
    Plan hash value: 238667275
    
    -----------------------------------------------------------------------------------------
    | Id  | Operation                    | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |          |     5 |   520 |     3   (0)| 00:00:01 |
    |   1 |  INLIST ITERATOR             |          |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| BIGT     |     5 |   520 |     3   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | BIGT_IN1 |     5 |       |     2   (0)| 00:00:01 |
    -----------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - access("C"=1 OR "C"=2 OR "C"=3 OR "C"=5 OR "C"=43)
    

    VR,
    Sudhakar B.

  • How to start a job using DBMS_SCHEDULER depending on the result of other JOBS

    How to start a job using DBMS_SCHEDULER depending on the result of other JOBS

    For example I have two jobs A and B of EMPLOYMENT, I would like to start JOB B only when a JOB is complete, is an option like that?

    Hello

    Yes, you can create a channel with the Scheduler, see the documentation:

    Creation and management of channels of employment

    http://docs.Oracle.com/CD/E11882_01/server.112/e25494/scheduse.htm#ADMIN10021

  • Oracle of the MAF error ' cannot read the DataControl uses on loadDataControl for the id:

    Need help!

    I created a simple SOAP web service for a remote database that works very well in 12 c WebLogic Server and also in the Jdeveloper HTTP Analyzer. When I use the same web service in the attached code, I get the following error (I've included output System.out.println in Ref. to the flow of the code) I use Jdeveloper 12 c MAF 2.0.0.0.41 on Mac OSx 10.9.

    Chk #0

    Processing line # 1

    Chk #1

    Chk #2

    [SEVERE - oracle.adfmf.framework - AmxBindingContext - loadDataControlById] Cannot read the DataControl uses on loadDataControl for the id: WLFNewActWS. [SEVERE - oracle.adfmf.framework - SynchronizationDC - syncDataFromOfflineToOnline] [Ljava.lang.StackTraceElement;@467c53d3

    @


    Sorry about that, I think I'm wrong you.

    OK, I created an example to test what goes wrong.

    1. server side, create a project named Employee_ws

    a. Department_ws.java

    public interface {Department_ws}

    public boolean addDepartment (a Department);

    }

    b. Department.java

    public class {Department

    public Department() {}

    Super();

    }

    int departmentId.

    String departmentName;

    locationId int;

    managerId int;

    {} public void setDepartmentId (int departmentId)

    this.departmentId = departmentId;

    }

    public int getDepartmentId() {}

    return departmentId.

    }

    {} public void setDepartmentName (String departmentName)

    this.departmentName = departmentName;

    }

    public String getDepartmentName() {}

    return departmentName;

    }

    {} public void setLocationId (int locationId)

    this.locationId = locationId;

    }

    public int getLocationId() {}

    return locationId.

    }

    {} public void setManagerId (managerId int)

    this.managerId = managerId;

    }

    public int getManagerId() {}

    return managerId;

    }

    }

    c. Department_impl.java

    @WebService

    / public class Department_impl implements Department_ws {}

    public Department_impl() {}

    Super();

    }

    @Override

    @WebMethod

    {} public boolean addDepartment (@WebParam (name = "arg0") a Department)

    If (Department! = null) {}

    int departmentId = department.getDepartmentId ();

    String departmentName = department.getDepartmentName ();

    int locationId = department.getLocationId ();

    managerId int = department.getManagerId ();

    Connection Conn;

    try {}

    Conn = ConnectionFactory.getConnection ();

    conn.setAutoCommit (true);

    Statement šment = conn.createStatement ();

    String inset_sql =

    "INSERT INTO dept (department_name, location_id, department_id, manager_id) VALUES ('+ '.

    departmentId + "," "" + departmentName + "'," + locationId + "," + managerId + ")";

    šment. Execute (inset_sql);

    Returns true;

    } catch (Exception e) {}

    System.out.println (e);

    }

    }

    Returns false;

    }

    }

    d. ConnectionFactory.java

    import java.sql.Connection;

    to import java.sql.DriverManager;

    import java.sql.SQLException;

    Connect to the database

    public class {ConnectionFactory

    public ConnectionFactory() {}

    Super();

    }

    protected static connection conn = null;

    public static connection getConnection() bird Exception {}

    If (conn == null) {}

    try {}

    String driver = "oracle.jdbc.driver.OracleDriver";

    String url = "jdbc:oracle:thin:@localhost:1521:orcl";

    User String = "employee";

    String password = "employee";

    Class.forName (driver);

    Conn = DriverManager.getConnection (url, user, password);

    } catch (SQLException e) {}

    System.Err.println (e.getMessage ());

    }

    }

    return conn;

    }

    public static {} Sub closeConnection()

    try {}

    If (conn! = null) {}

    Conn.Close ();

    Conn = null;

    }

    } catch (Exception ex) {}

    throw new RuntimeException (ex);

    }

    }

    }

    You can run Department_impl.java to start the Web service. i.e. http://127.0.0.1:7001 / Employee_ws-Client-context-root/Department_implPort? WSDL

    Server side sql:

    CREATE USER employee IDENTIFIED BY employee DEFAULT TABLESPACE users

    Temp TEMPORARY TABLESPACE

    Users WE QUOTA UNLIMITED;

    GRANT create employee to logon.

    GRANT alter used to logon.

    GRANT create any employee at table;

    GRANT create trigger employee TO;

    GRANT create any employee to view;

    GRANT create sequence employee TO;

    GRANT create synonym employee TO;

    GRANT create type employee TO;

    GRANT create employee to procedure;

    CREATE TABLE (DEPT

    DEPARTMENT_ID NUMBER (7, 0) NOT NULL,

    DEPARTMENT_NAME VARCHAR2 (50).

    NUMBER OF LOCATION_ID (7, 0),

    MANAGER_ID NUMBER (7.0)

    );

    2 create a mobile application of CRG named Dept

    a. Department.java (even for the server)

    b. SynchronizationDC.java

    import java.util.ArrayList;

    import java.util.List;

    Import oracle.adfmf.framework.api.AdfmfJavaUtilities;

    Import oracle.adfmf.framework.exception.AdfInvocationException;

    public class SynchronizationDC {}

    public SynchronizationDC() {}

    Super();

    }

    public void syncDataFromOfflineToOnline() {}

    It's just for testing, so I build Department manually instead of mobile db data, please replace in your business logic

    A Department = new Department();

    department.setDepartmentId (1);

    department.setDepartmentName("1");

    department.setLocationId (1);

    department.setManagerId (1);

    NamesList list = new ArrayList (1);

    List ParamsList = new ArrayList (1);

    List TypesList = new ArrayList (1);

    namesList.add ("arg0");

    paramsList.add (department);

    typesList.add (Department.class);

    try {}

    AdfmfJavaUtilities.invokeDataControlMethod ("Dept_WS", null, "addDepartment", namesList, paramsList,

    typesList);

    } catch (AdfInvocationException e) {}

    System.out.println (e);

    }

    }

    }

    c. new an AMX pag called Dept.amx

    "http://www.w3.org/2001/XMLSchema-instance" xmlns:amx ="http://xmlns.oracle.com/adf/mf/amx"

    xmlns:dvtm ="http://xmlns.oracle.com/adf/mf/amx/dvt" >. "

    Text = "syncDataFromOfflineToOnline."

    Disabled = "#{!}" Bindings.syncDataFromOfflineToOnline.Enabled}"id ="cb3"/ >

    d. deploy on Android Simulator

    Click the button and a new record have been db insert through the webservice, search the remote db recording

    If above does not solve your problem, please let me know, thanks.

    Byron

  • How to assign URLs dynamically using button/link on the page of peoplesoft? Please provide detailed instructions.

    How to assign URLs dynamically using button/link on the page of peoplesoft? Please provide detailed instructions.

    1. define the URL, the Z_URL1 or the Z_URL2 definitions

    2. in the change of field button:

    If true Condition then

    ViewURL (URL. Z_URL1);

    On the other

    ViewURL (URL. Z_URL2);

    End - if

  • How to make a stationary State (or equivalent) for the form to change color and reveal some hidden above text...? is there a widget I could use?

    How to make a stationary State (or equivalent) for the form to change color and reveal some hidden above text...? is there a widget I could use?

    There are many solutions. A more simple: put the text and the items colored in the back and put the 'shape' on it. Configuration of the 'shape' become transparent in a stationary state.

  • How can I use a video for the preview looks like instead of the fixed image?

    How can I use a video for the preview looks like instead of the fixed image? I use android lollipop.

    Hi Ali,

    Video preview for looks is not currently supported on Android. Your feature request was noted by the team.

    In the meantime, there is a video on the device you want to use as an overview, I would recommend taking a perforated CAP and still image as loading preview.

    Best,

    Bronwyn

  • Can Oracle 10g - I use a variable for the access of the user identifywhat tablesto?

    I have the following code in a trigger (PL/Sql block) of a form:

    Select fieldname in user1.sometable myvar;

    is it possible to use a variable instead of coding hard "user1"? And on the same subject, this variable would also be declared in the world?

    Thanks in advance,
    Darren

    Hello!

    User1 is the owner of the table sometable.

    If only the User1 runs your form, there is no need to put the tableowner in front of the tablename parameter.

    If other users run your form, you must create a public or private (for each user) synonym of this table.
    After that, you don't need to use owner.tablename in your sql statement.

    But:
    You cannot use a variable for the user name without using dynamic sql
    as you do if you create a recordgroup.

    Concerning

  • Index for the Group of readonly cache table

    Hello

    Suppose I have a table in Oracle which is cached in TT as a readonly cache group.
    The oracle table has a primary key, based on columns (c1, c2, c3).

    Now, the oracle table also has a unique index (for example defined on columns c4, c5) in support of some queries.

    (1) is there a way to propagate this unique index for the cache group? (so that we can perform queries effectively TimesTen)

    (2) is it correct to assume that the group create cache statement MUST have the columns (c1, c2, c3) for the primary key? (that is, exactly the same as the pharmacokinetics of the oracle)


    Thank you!

    (1) after you have created the cache in TimesTen group, simply create the index needed on the tables of cache in TimesTen (using CREATE [UNIQUE] INDEX) as you would for any table.

    (2), it depends. A caching table must have a primary key defined in TimesTen. This PK must map to either a real PK defined in Oracle (same column names, order of the columns, data types, nullability, etc..) or a unique index defined on a set of columns not null (column names of the soul, order of the columns, types of data etc.).

    Chris

  • TreeSize Professional - using this tool for the first time - need help to run the report

    Using TreeSize Professional for the first time and I need search records to analyze documents containing invalid characters and path names that are too long.  We are moving the content in SharePoiint and SharePoint will not accept path names that are more than 250 characters and invalid characters.

    Does anyone know how to do this research?

    [Moved from the community centre of Participation]

    What is a TreeSize question or a question of SharePoint?

    Try SharePoint forums on the left side of

    https://social.technet.Microsoft.com/forums/en-us/home?category=SharePoint&filter=AllTypes&sort=lastpostdesc

    Don

  • How to check what Qt application is run for the first time?

    How to check what Qt application is run for the first time? I need for the creation of trial version of my application. Any help is greatly appreciated

    Probably use file data and put an I_ran_at_least_one_time file and verify its existence. This file is not accessible to the user and is not changed even if you upgrade the application.

  • How to setting assisted by Hardvare activate virtualiziation for the computer?

    How to setting assisted by Hardvare activate virtualiziation for the computer?

    Original title: the Hardvare-assisted virtualization

    Activation of hardware assisted virtualization is in the BIOS of your motherboard. How depends on the BIOS and the hardware you have.

    See http://blogs.technet.com/b/jhoward/archive/2008/01/08/how-to-turn-on-hardware-assisted-virtualization.aspx .

    If your system is a laptop or made by a major system provider such as Dell or HP, the system may not have the option in the BIOS, even if the hardware is able to use hardware assisted virtualization.

  • Given the file name or path contains Unicode or DBCS characters. Retry using ASCII characters for the file name and path whatever that means? This happens when I publish an OAM

    Given the file name or path contains Unicode or DBCS characters. Retry using ASCII characters for the file name and path

    What does that mean? It happens when I try to publish an OAM for Dreamweaver.

    Also: How can I specify the onboard browser animate? It's just going as far. Are there no preference to animate it dashboard?

    BTW. Just call him edge. Seriously. You call Illustrator draw? Photoshop editing?

    No, my file name is mainContent.oam

    My project name is mainContent.an

    This error occurs when I try to import into Dreamweaver. Sorry, I was unclear about that earlier.

    I thought maybe it was because I had saved my image as a png image. So re-saved as an svg, still get the error.

    Should I have a setting is CC of Dreamweaver that will not? I should try this in Dreamweaver CS6? I might try that next.

    Why is this so difficult program? I know that Flash. I know that After Effects. I can work the chronology part simply awesome. He's still export I have problems.

    On a MacPro, 10.7.

    You are a person of Adobe or simply a beautiful assistance program?

Maybe you are looking for

  • Question about the graphics card of the Satellite P50t-B-108

    Hello I think to buy the Toshiba Satellite P50t-B-108 model.Can you tell me if this phone has some kind of graphic hibrid (he uses both the graphic processor Embedded Intel and AMD one?) or simply the radeon graphics processor? I need to install a li

  • Installation disk or memory stick

    I'm trying to fix my non technical friend's cell phone. It's a 15-n267sa, purchase of 2014, Windows 8.1. On the attempt to start, I gte a blue screen with lots of words, and the computer turns off while I'm writing them down. GRRR! It said that the s

  • screen - vertical to horizontal display

    Display screen has changed from horizontal to vertical. How can I permanently change this back?

  • Printing blank Page

    I have an officejet pro 8500 wireless using Windows7 and networked via ethernet.  After a print job, the printer load another page.  At the beginning of the next print job, he sends the white page through and then prints normally.

  • Incorrect serial number

    Downloaded Adobe Pro 9 of our Web site and using my volume license key. I get the message incorrect serial number.