SQL tuning advisor recommnds to create the function SYS_OP_C2C function index

I have a large table and an index on it. I use a tool to fill data, this simple tool submits the sql for Oracle DB and it does NOT index to use for requests. When I run the sql tuning advisor, he recommends to create additional indexes and use the SYS_OP_C2C function, which I don't want.

When I run the query through sql plus picks it up in the index.
Someone of you came, why its recommend that additional nonsense?

create index abc.xxxx on this_table (SYS_OP_C2C ("this_column"));

Thank you

The internal Oracle SYS_OP_C2C function perform the conversion of a set of characters to another set of characters - C (haracterSet) 2 c (haracterSet). There are situations where you will see this conversion without explicit, as in this case command that should be a sign that the data types are not the same and the implicit conversion takes place and this could also be a problem from the point of view performance because it can disable the use of the index.

Make sure you the characterset and nls set of all of the database and the tool are the same.
Make sure that the data type of the column in the index is the same as the database.
Confirm the ETL vendor for your database support and fixes, etc..

Optimizer will only advise to use this function when the data type or the character set does not match.

Thank you
Kerry

Tags: Database

Similar Questions

  • SQL Tuning Advisor on a select Question

    Hi all.
    10.2.0.4 RAC
    I have a select sequential reading of file db high. I used sql tuning advisor on OEM, and the Adviser show me these recommendations:
    RECOMMENDATIONS
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    GENERAL INFORMATION SECTION
    -------------------------------------------------------------------------------
    Tuning Task Name                  : SQL_TUNING_1266335308111
    Tuning Task Owner                 : SYSTEM
    Scope                             : COMPREHENSIVE
    Time Limit(seconds)               : 1800
    Completion Status                 : COMPLETED
    Started at                        : 02/16/2010 16:48:44
    Completed at                      : 02/16/2010 16:50:06
    Number of SQL Profile Findings    : 1
    
    -------------------------------------------------------------------------------
    Schema Name: CRM
    SQL ID     : b7cd8jntqpcgu
    SQL Text   : select * from ( select this_.ENVIO_ID as ENVIO1_33_0_,
                 this_.NOMCLIENTE as NOMCLIENTE33_0_, this_.NOMCONTACTO as
                 NOMCONTA3_33_0_, this_.APLICACION_ID as APLICACION4_33_0_,
                 this_.PRIORIDAD as PRIORIDAD33_0_, this_.MEDIO as MEDIO33_0_,
                 this_.MEDIO_VALOR as MEDIO7_33_0_, this_.ESTADO as ESTADO33_0_,
                 this_.ESTADO_DESC as ESTADO9_33_0_, this_.FEC_PREVISTA as
                 FEC10_33_0_, this_.FECHA_ENVIO as FECHA11_33_0_,
                 this_.REC_CLIENTE as REC12_33_0_, this_.FECHACREA as
                 FECHACREA33_0_, this_.FECHAMODIF as FECHAMODIF33_0_,
                 this_.FLAGBLOQUEO as FLAGBLO15_33_0_, this_.FLAGBORRADO as
                 FLAGBOR16_33_0_, this_.COMENTARIOS as COMENTA17_33_0_,
                 this_.HORAENVIO as HORAENVIO33_0_, this_.EMISOR as EMISOR33_0_,
                 this_.IDENTIFICADOR as IDENTIF20_33_0_, this_.MEDIO_VALOR_DESC
                 as MEDIO21_33_0_, this_.DEBUG_TRACE as DEBUG22_33_0_,
                 this_.FORMULARIO_ID as FORMULARIO23_33_0_, this_.CAMPANYA_ID as
                 CAMPANYA24_33_0_, this_.CONTACTO_ID as CONTACTO25_33_0_,
                 this_.USUARIOCREA as USUARIO26_33_0_, this_.USUARIOMODIF as
                 USUARIO27_33_0_, this_.CLIENTE_ID as CLIENTE28_33_0_,
                 this_.CAMPPOS_ID as CAMPPOS29_33_0_, this_.ACTIVIDAD_ID as
                 ACTIVIDAD30_33_0_, this_.TAGCLICONEXT_ID as TAGCLIC31_33_0_ from
                 CRM.CRM_ENVIOS this_ where this_.MEDIO=:1 and this_.ESTADO=:2
                 and this_.FECHA_ENVIO<=:3 order by this_.ENVIO_ID asc ) where
                 rownum <= :4
    
    -------------------------------------------------------------------------------
    FINDINGS SECTION (1 finding)
    -------------------------------------------------------------------------------
    
    1- SQL Profile Finding (see explain plans section below)
    --------------------------------------------------------
      A potentially better execution plan was found for this statement.
    
      Recommendation (estimated benefit: 99.43%)
      ------------------------------------------
      - Consider accepting the recommended SQL profile.
        execute dbms_sqltune.accept_sql_profile(task_name =>
                'SQL_TUNING_1266335308111', replace => TRUE);
    
    -------------------------------------------------------------------------------
    ADDITIONAL INFORMATION SECTION
    -------------------------------------------------------------------------------
    - The optimizer could not merge the view at line ID 2 of the execution plan.
      The optimizer cannot merge a view that contains an "ORDER BY" clause unless
      the statement is a "DELETE" or an "UPDATE" and the parent query is the top
      most query in the statement.
    
    -------------------------------------------------------------------------------
    EXPLAIN PLANS SECTION
    -------------------------------------------------------------------------------
    
    1- Original With Adjusted Cost
    ------------------------------
    Plan hash value: 3505713201
    
    ----------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |              |     1 |  4416 |   604K  (1)| 02:00:53 |
    |*  1 |  COUNT STOPKEY                |              |       |       |            |          |
    |   2 |   VIEW                        |              |     1 |  4416 |   604K  (1)| 02:00:53 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| CRM_ENVIOS   |     1 |   352 |   604K  (1)| 02:00:53 |
    |   4 |     INDEX FULL SCAN           | SYS_C0020438 |  2718K|       |  8153   (1)| 00:01:38 |
    ----------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<=:4)
       3 - filter("THIS_"."MEDIO"=:1 AND "THIS_"."ESTADO"=:2 AND
                  "THIS_"."FECHA_ENVIO"<=:3)
    
    2- Using SQL Profile
    --------------------
    Plan hash value: 3391889105
    
    ------------------------------------------------------------------------------------------------------
    | Id  | Operation                      | Name                | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT               |                     |     1 |  4416 |  3431   (1)| 00:00:42 |
    |*  1 |  COUNT STOPKEY                 |                     |       |       |            |          |
    |   2 |   VIEW                         |                     |     1 |  4416 |  3431   (1)| 00:00:42 |
    |*  3 |    SORT ORDER BY STOPKEY       |                     |     1 |   352 |  3431   (1)| 00:00:42 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| CRM_ENVIOS          |     1 |   352 |  3430   (1)| 00:00:42 |
    |*  5 |      INDEX SKIP SCAN           | APLICACIONENVIO_IDX |     1 |       |  3429   (1)| 00:00:42 |
    ------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<=:4)
       3 - filter(ROWNUM<=:4)
       4 - filter("THIS_"."MEDIO"=:1 AND "THIS_"."FECHA_ENVIO"<=:3)
       5 - access("THIS_"."ESTADO"=:2)
           filter("THIS_"."ESTADO"=:2)
    
    -------------------------------------------------------------------------------
    I think the main problem is the order, but when I run autotrace traceonly without order by the plan of the explain command is diferent to advise:
    SELECT *
      2    FROM (SELECT this_.envio_id AS envio1_33_0_,
      3                 this_.nomcliente AS nomcliente33_0_,
      4                 this_.nomcontacto AS nomconta3_33_0_,
      5                 this_.aplicacion_id AS aplicacion4_33_0_,
      6                 this_.prioridad AS prioridad33_0_, this_.medio AS medio33_0_,
      7                 this_.medio_valor AS medio7_33_0_, this_.estado AS estado33_0_,
      8                 this_.estado_desc AS estado9_33_0_,
      9                 this_.fec_prevista AS fec10_33_0_,
     10                 this_.fecha_envio AS fecha11_33_0_,
     11                 this_.rec_cliente AS rec12_33_0_,
     12                 this_.fechacrea AS fechacrea33_0_,
     13                 this_.fechamodif AS fechamodif33_0_,
     14                 this_.flagbloqueo AS flagblo15_33_0_,
     15                 this_.flagborrado AS flagbor16_33_0_,
     16                 this_.comentarios AS comenta17_33_0_,
     17                 this_.horaenvio AS horaenvio33_0_, this_.emisor AS emisor33_0_,
     18                 this_.identificador AS identif20_33_0_,
     19                 this_.medio_valor_desc AS medio21_33_0_,
     20                 this_.debug_trace AS debug22_33_0_,
     21                 this_.formulario_id AS formulario23_33_0_,
     22                 this_.campanya_id AS campanya24_33_0_,
     23                 this_.contacto_id AS contacto25_33_0_,
     24                 this_.usuariocrea AS usuario26_33_0_,
     25                 this_.usuariomodif AS usuario27_33_0_,
     26                 this_.cliente_id AS cliente28_33_0_,
     27                 this_.camppos_id AS camppos29_33_0_,
     28                 this_.actividad_id AS actividad30_33_0_,
     29                 this_.tagcliconext_id AS tagclic31_33_0_
     30            FROM crm.crm_envios this_
     31               where this_.estado = 'Enviado'
     32           and this_.medio = 3482 AND this_.fecha_envio <= '02/04/10 00:00:00')
     33   WHERE ROWNUM <= 500;
    
    no rows selected
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1577868436
    
    ------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                 |   500 |   171K|  2425   (1)| 00:00:30 |
    |*  1 |  COUNT STOPKEY               |                 |       |       |            |          |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| CRM_ENVIOS      |   500 |   171K|  2425   (1)| 00:00:30 |
    |*  3 |    INDEX RANGE SCAN          | ESTADOENVIO_IDX |       |       |   104   (0)| 00:00:02 |
    ------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<=500)
       2 - filter(TO_NUMBER("THIS_"."MEDIO")=3482 AND "THIS_"."FECHA_ENVIO"<='02/04/10
                  00:00:00')
       3 - access("THIS_"."ESTADO"='Enviado')
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
         138277  consistent gets
          45240  physical reads
              0  redo size
           2629  bytes sent via SQL*Net to client
            488  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    I was looking for a way to see who wear's Advisor using his plan, but didn't see a way of knowing on docs, or at least I have not found it.
    Can someone show me that some light on what changes made Advisor to select to reach that way, or how can I watch this that select uses?
    Any help will be appreciate
    Thank you

    The Adviser does not create a new SQL statement - what it has done is create a SQL profile - to accept SQL profile for the task of tuning above:

        execute dbms_sqltune.accept_sql_profile(task_name =>
                'SQL_TUNING_1266335308111', replace => TRUE);
    

    as mentioned in the above report...

    A sql profile applys tips for change (correct) the cost of certain operations - and, to change the execution path chosen by the optiimizer.

  • additional licenses set forth for the use of Sql Tuning Advisor in SQL Developer 4.0.3

    Hello

    We have the Oracle 11 g Enterprise Edition Release 11.2.0.3.0 database. Do we need to acquire an oracle license extra for using SQL Tuning Advisor Option in SQL Developer 4.0.3

    No, they are installed by default.

    They must be licensed.

    Consult your contract or talk to your account manager Oracle for clarification.

  • License required for "Automatic SQL Tuning Advisor"?

    I noticed a lot of databases in my company show using a component called "Automatic SQL Tuning Advisor" or "Automatic maintenance - Setup SQL" in DBA_FEATURE_USAGE_STATISTICS.

    Do we know if this component requires a License Pack Tuning or it could be one of the internal out-of-box/system uses that do not require a license?

    Thank you!

    I need a License Pack - Tuning

    Options and Packs

    MOS Doc ID 276103.1

    Best to check with your sales representative

  • Package DBMS_ADVISOR can be used for SQL Tuning Advisor?

    Package DBMS_ADVISOR can be used for SQL Tuning Advisor?

    It seems that the DBMS_ADVISOR package is responsible for the workload and SQL Access Advisor of related tasks. Package DBMS_SQLTUNE is responsible for setting up SQL and SQL set related tasks.

    Jetq

  • I want to create the function for the function create for ODD or EVEN (NUMBER)

    I want to create the function for the function create for ODD or EVEN (NUMBER) also
    If number is odd, multiply by 5
    If there is an even number, multiply it by 10;

    Not tested,

    create or replace function fnc_env_odd(p_number in number)
    return number as
    begin
     if p_number>0  -- Remove if you want to consider negative numbers also
       if mod(p_number,2)=0 --Means even
          return p_number*10;
       else                 --Means odd
          return p_number*5
       end if;
     end if;
    end;
    /
    

    G.

  • SQL Tuning sets and SQL Tuning Advisor.

    Hello

    We run oracle11g r2 where under win server 2008 R2.

    How can I find out when Tuning SQL and SQL Tuning games advisors are enabled in my database.

    Is Oracle11g has default setting YES for this tuning packs

    Thank you

    It seems you found somone activated of sets and the setting of advisers.  as others have said, theyre part of the D & T and theyre always there but only, you become eligible for a permit after that you use.   This will tell you the first time they have been used if at all, the key here for you field be FIRST_USAGE_DATE that must be completed only if detected_usages > 0

    fixed lines 180

    Col name format a30

    SELECT name, version, detected_usages, FIRST_USAGE_DATE, last_usage_date

    of DBA_FEATURE_USAGE_STATISTICS

    where upper (NAME) like '% % TUNING '.

  • PL/SQL anonymous block - try to call the function within cursor

    Hello-

    I need to create an anonymous block that contains a cursor and function. I want to call the function from the cursor and function will essentially have an ID as parameter and will return a list of values comma separated.

    However, when I try to do it I get the error 'function 'GET_PAYMENT_DATES' is not usable in SQL.

    Does anyone know of a workaround? I'm trying to avoid having to store this function.

    Thank you
    Christine

    Well you can't do this using an sql not stored function.
    What you could do is to increase your sort_area_size which can help you to overcome the performance Bug.

    for example: alter session set sort_area_size = 64000;

    other than that, it seems that you need a stored function

  • Instance create the function

    Jyn

    I need some help with a game that I do. I have a list of instances, and I want to make a function that will create another symbol, similar to that was just clicked. The problem is that I don't know how to create the new instance... In my library, they are like 'next' link + name of the instance. Thank you for your help ^^,

    square_mc.addEventListener (MouseEvent.MOUSE_CLICK, Create);

    circle_mc.addEventListener (MouseEvent.MOUSE_CLICK, Create);

    ...

    triangle_mc.addEventListener (MouseEvent.MOUSE_CLICK, Create);

    function Create(event:MouseEvent):void

    {

    var name: String = "next" + event.target.name;

    var temp: Name = Name();

    addChild (temp);

    lines of code

    removeChild (temp);

    }

    Here's the right way to dynamically call an instance of the current class.

    var ClassRef: Class = Class (getDefinitionByName ("className");
    var classInstance: * = new ClassRef();
    addChild (classInstance);

    In your case, 'className' would be your "next" + event.target.name;

    and you can use event.currentTarget.name to be safer.  If your objects contain other objects in their midst, 'target' can point to them instead.  "currentTarget" will always point to the object with the listener who are entrusted to him.

  • Create the function of responsibility which would pass parameters to 3rd party app

    Hello all,.

    My organization uses Oracle HRMS but no payroll. We try to convert them into electronic heels and have developed a 3rd party app, but we do not want users to have to use a separate password for our instance of EBS. Is it possible to create a function to attach to the responsibility of the employee self-service that will launch the 3 web part app and validate the information as user_id to spend?

    Thanks in advance!
    Kristopher

    Hello

    You can use pageContext.putSessionValueDirect () API to do this, as this API set parameters directly in the HTTP session as

    pageContext.putSessionValueDirect ("Parameter1", value1);
    pageContext.putSessionValueDirect ("Parameter2", value2);
    pageContext.setForceForwardURL ('Page URL',
    NULL,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    NULL, null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
    OAWebBeanConstants.IGNORE_MESSAGES);
    }

    It could be useful!

    Ajay

  • Manual sql tuning advisor

    Hi all

    10g R2 on solaris 10

    task created as:
    declare
    my_task_name varchar2(30);
    my_sqltext clob;
    begin
    my_sqltext:='insert   into tabsbgr.PREP_FIRST_CALL_LAT SELECT  MIN(TRUNC(I.TRANSDATE)) "TRANSDATE", c.subno , c.contrno, c.prepost_paid,c.tariff_profile,DECODE(num_type, ''P'',''Platinium'',''G'',''Golden'',''S'',''Silver'',''B'',''Bronze'',''V'',''Regular'',num_type) NUMBER_TYPE, TRUNC(C.CREATION_DATE) "Activation Date",Sysdate "Idate",null,null FROM crm_user_info c, incalls i WHERE c.subno = i.subno AND C.PREPOST_PAID =''PREP'' AND c.subno LIKE ''5%'' AND ( c.subno NOT IN (SELECT subno FROM tabsbgr.PREP_FIRST_CALL_LAT l2 where l2.subno = c.subno and l2.termination_date is null ) or (c.subno in (SELECT subno FROM tabsbgr.PREP_FIRST_CALL_LAT l1  where c.subno = l1.subno and l1.termination_date < trunc(i.transdate) AND TERMINATION_DATE IS NOT NULL AND  L1.SUBNO NOT IN   (SELECT subno FROM tabsbgr.PREP_FIRST_CALL_LAT l3 where l3.subno = L1.subno and l3.termination_date is null ) ))) GROUP  BY c.subno , c.contrno, c.prepost_paid,c.tariff_profile , NUM_TYPE,TRUNC(C.CREATION_DATE)';
    my_task_name := dbms_sqltune.create_tuning_task (
    sql_text  => my_sqltext,
    user_name => 'TABS',
    scope     => 'COMPREHENSIVE',
    time_limit => 60,
    task_name => 'my_sql_tuning_task_feb',
    description => 'Task to tune a query for final');
    end;
    /
    run the same:
    begin  
    dbms_sqltune.execute_tuning_task( task_name => 'my_sql_tuning_task_feb');  
    end;  
    /  
    When selects the data as
    SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'my_sql_tuning_task_feb') from DUAL; 
    It's displaying the below info (with results)
    DBMS_SQLTUNE. REPORT_TUNING_TAS
    --------------------------------------------------------------------------------
    GENERAL INFORMATION SECTION
    ----------------------------------------------------
    When am running thorough db console, it works fine.(recommended to accept the sql profile) though I accepted it,the problem is the optimzer couldn't ifnd the sql profile when it runs the next time. SO iI decided to run it manually to attach the sql profile to the  sql query..
    
    Any idea why SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'my_sql_tuning_task_feb') from DUAL; not displaying any records ?..where as the same in dbconsole is giving the recommendations ?
    
    Thanks
    
    Kai                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Just a guess. Took you LONG to a large enough value?

  • Create the function object with custom connector ICF

    Hello

    I develop a Custom Connector ICF. When put into service a user, the user is created on the target correctly, but the process remains on the status of 'Provisioning '. When I check the log file, I see the following error message:

    [oim_server1] [ERROR] [] [ORACLE. IAM. CONNECTORS. ICFCOMMON. Prov. ICPROVISIONINGMANAGER] [tid: [ASSETS].] [ExecuteThread: '21' for queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: c4b0db765c688017:-2d2de9cf:13c04b25533, :-8000-0000000000002b20, 0] [APP: IOM #11.1.2.0.0] oracle.iam.connectors.icfcommon.prov.ICProvisioningManager: createObject: error while creating user []
    java.lang.IllegalArgumentException: null field label does not exist
    at oracle.iam.connectors.icfcommon.service.oim9.OIM9Provisioning.getFieldName(OIM9Provisioning.java:174)
    at oracle.iam.connectors.icfcommon.service.oim9.OIM9Provisioning.setFormField(OIM9Provisioning.java:63)
    at oracle.iam.connectors.icfcommon.service.oim11.OIM11Provisioning.setFormField(OIM11Provisioning.java:299)
    at oracle.iam.connectors.icfcommon.prov.ICProvisioningManager.createObject(ICProvisioningManager.java:277)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpICFCREATEOBJECT.CREATEOBJECT(adpICFCREATEOBJECT.java:109)
    at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpICFCREATEOBJECT.implementation(adpICFCREATEOBJECT.java:54)
    at com.thortech.xl.client.events.tcBaseEvent.run(tcBaseEvent.java:196)
    at com.thortech.xl.dataobj.tcDataObj.runEvent(tcDataObj.java:2492)
    at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(tcScheduleItem.java:3181)
    at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(tcScheduleItem.java:753)
    at com.thortech.xl.dataobj.tcDataObj.insert(tcDataObj.java:604)

    Thank you
    Fyigit
    There is no such thing as the NULL field label

    You must create the field back in the form of process and map this field with search for provisioning. In this research CodeKey should be your form field in process and Decode __UID__

    Test again commissioning...

  • CBO bug or not, or else develop do not consider the function index

    SQL> create table test_fun_or as select object_id+sysdate id,object_name from        
    
      2  dba_objects;
    
    Table created.
    
    SQL> create index i_test_fun_or on test_fun_or(id,'a') nologging;   
    
    //I don't know why oracle consider it as function index
    
    Index created.
    
    SQL> create index i_test_fun_or_1 on test_fun_or(object_name) nologging;
    
    Index created.
    
    SQL> set autot trace exp
    
    SQL> exec dbms_stats.gather_table_stats(user,'TEST_FUN_OR',estimate_percent=>null,method_opt=>'for all columns size 1');
    
     
    
    PL/SQL procedure successfully completed.
    
     
    
    SQL> select * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3247456674
    
     
    
    ---------------------------------------------------------------------------------
    
    | Id  | Operation         | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ---------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT  |             |     3 |    87 |   219   (3)| 00:00:03 |
    
    |*  1 |  TABLE ACCESS FULL| TEST_FUN_OR |     3 |    87 |   219   (3)| 00:00:03 |
    
    ---------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       1 - filter("OBJECT_NAME"='aa' OR "ID"=SYSDATE@!)
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa'; 
    
    //or expand don't use index i_test_fun_or
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3161566054
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |   224   (3)| 00:00:03 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   TABLE ACCESS FULL          | TEST_FUN_OR     |     1 |    29 |   219   (3)| 00:00:03 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       2 - filter("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')
    
     
    
    SQL> drop index i_test_fun_or;
    
     
    
    Index dropped.
    
     
    
    SQL> create index i_test_fun_or on test_fun_or(id,object_name) nologging;
    
     
    
    Index created.
    
     
    
    SQL> alter table test_fun_or modify object_name not null;
    
     
    
    Table altered.
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 1705821130
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |     8   (0)| 00:00:01 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   INDEX RANGE SCAN           | I_TEST_FUN_OR   |     1 |    29 |     3   (0)| 00:00:01 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
        2 - access("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')

    Jinyu wrote:
    Thanks Jonathan, I don't have 11.2.0.2 on-site, I'll test it later, I just test it on 11.2.0.1

    If you see the notes of fixed a bug fixes for 11.2.0.2 Group (Doc ID:1179583.1) it's bug 8352378 "allow index GOLD-Expansion functions.

    Concerning
    Jonathan Lewis

  • SQL Tuning Advisor error

    I wanted to use the SQL in the SQL worksheet setting feature. The DBA privilege me ADVISE system. But when I tried to use the feature, I get the following errors:
    An error was encountered performing the requested operation:
    
    ORA-06550: line 20, column 101:
    PLS-00103: Encountered the symbol "ANYDATA" when expecting one of the folllowing:
    
    .(),*%&=-+</> at in is mod remainder not rem
    <an exponenet (**) <> or != or ~= >= <> and or like LIKE2_
    LIKE4_LIKEC_between|| multiset member SUBMULTISET_
    The symbol "." was substituted for "ANYDATA" to continue.
    ORA-6550: line 20, column 140:
    PLS-00103: Encountered the symbol "ANYDATA" when expecting one of the folllowing:
    
    .(),*%&=-+</> at in is mod remainder not rem
    <an exponenet (**) <> or != or ~= >= <> and or like LIKE2_
    LIKE4_LIKEC_between|| mul
    ORA-6550:line 20, column 179:
    PLS-00103: Encountered the symbol "ANYDATA" when expecting one of the folllowing:
    
    .(),*%&=-+</> at in is mod remainder not rem
    <an exponenet (**) <> or != or ~= >= <> and or like LIKE2_
    LIKE4_LIKEC_between|| multiset
    06550,00000 - "line %s, column %s:\n%s"
    *Cause: Usually a PL/SQL compilation error.
    *Action:
    Vendor code 6550
    Then I get this right after the other:
    An error was encountered performing the requested operation:
    
    
    ORA-13605: The specified task or boject staName12325 does not exist for the current user.
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.PRVT_ADVISOR", line 4841
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 1093
    ORA-06512: at line 2
    13605.0000 - "The specified task or object %s does not exist for the current user."
    *Cause:   The user attempted to reference an advisor task or object
        using a anme that does not exist in the Advisor repository.
    *Action:  Adjust the name and retry the operation.
    Vendor code 13605
    Can someone help me please? I'm not a DBA, so I confused these error codes.

    Oracle SQL Developer 3.0.04 Build hand - 04.34
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0

    Robert

    Hi Robert,.

    SQL Setup seems stifling bind variables of your query clause-BETWEEN to_date function. Substitute a literal date string, and it seems to handle well. What is a solution?

    I ping the responsible developer and I hope he has time to investigate and to connect to a bug.

    Kind regards
    Gary Graham
    SQL development team

  • How to create the function inline within a test script

    I have a test script. I want to create an inline function that will do a few things. How can I make syntatically.
    declare 
      -- Local variables here
      i integer;
    begin
      -- Test statements here
      -- have a function spec and body how?
    end;

    Hello

    You can define a function in the DECLARE section and use it in the BEGIN section, like this:

    declare
      -- Local variables here
      i integer;
    
         -- Defining successor function
         FUNCTION successor (in_num  IN NUMBER)
         RETURN      NUMBER
         IS
         BEGIN
              RETURN     in_num + 1;
         END     successor;
    begin
    
         dbms_output.put_line ( successor (1) || ' = successor (1)');
    end;
    /
    

Maybe you are looking for