Question of function-based Index

Hello Experts,

I am wondering something simple relating to the funcion according to index. Lets say I have a FBI something like the following.

CREATE INDEX idx my_fbi ON my_table (substr (nls_lower (my_column),1 25));

Maybe it's a very basic question, but SERIOUSLY, I want to know. My question is, when I use this index, including the rating should I use other side of the equal sign? and WHY?

SELECT * FROM my_table WHERE substr (nls_lower (my_column),1 25( ) = 'ali';

OR

SELECT * FROM my_table WHERE substr (nls_lower (my_column),1 25) = substr (nls_lower ("ali"),1 25( );

Thank you 1 million for your great comments.

Best regards

Charlie

using value once the '=' sign would be more effective if you already know the value because in this case Oracle does not need to evaluate the expression, but if the values are not known, then you have to use the expression.

Exact values are more efficient than expressions, especially when the expression is already evaluated and it must be evaluated at run time.

Onkar

Tags: Database

Similar Questions

  • A FUNCTION-based index

    Hi gurus

    I use SQL Developer and in the present, I have a cc_tv table and when I press shift F4 to display related table things while it contains the following information:

    index name = TTT_UK_I

    uniquiness UNIQUE =

    Status = valid

    Index_type = NORMAL according TO THE FUNCTIONS

    Temporary = N

    and the following condition = box 'logical_flag' when ' no can END NO other 'Class_ID.

    Another index with the same name but different condition

    index name = TTT_UK_I

    uniquiness UNIQUE =

    Status = valid

    Index_type = NORMAL according TO THE FUNCTIONS

    Temporary = N

    and the following condition = box 'logical_flag' when ' no can END NO other 'As_of_date '.

    Can someone explain the above things. Really appreciate your help. Thank you

    Hello

    It seems that you have a unique composite index based on a function.  To understand this, let's review what each of these terms means.

    A unique index ensures that the same value will not be on 2 or more lines.  (NULL, which is not a value, can be on any number of lines).  So if there is a unique index on the column "Class_ID", if the 2 lines have values in the column "Class_ID", these values must be different.

    A composite unique index ensures that the same combination of values will not be on 2 or more lines.  So if there is a unique index on the combination of columns ('Class_ID', 'As_of_date'), so and 2 rows have values in each column, 'Class_ID' or 'As_of_date', then 1 or two of these values must be different.  However, you can have any number of lines where both of these columns are NULL.

    An index based on a single composite function is as a single composite index, but the things that must be unique are not actually columns; they are expressions that come from columns.

    You have a unique composite index based on a function, where the combination of these 2 expressions (not columns) must be unique:

    Case 'logical_flag' when ' no can END NO other 'Class_ID.

    Case 'logical_flag' when ' no can END NO other 'As_of_date '.

    The effect is like a unique composite index on all columns ("Class_ID', 'As_of_date') which applies only to the lines where 'logical_flag' = 'n'.  If "logical_flag" is any other value (or NULL) then the other columns must be unique.  Why?  Because when 'logical_flag' is another value (or NULL), as well of the CASE the above expressions return NULL, and you can have a number any of columns where both of these expressions have the value NULL.

    Sorry, I don't know much about SQL Developer.  If you need to know something specific to SQL Developer, for example how it displays information about the index, then you should post a question in the SQL Developer forum

    https://community.oracle.com/community/developer/english/development_tools/application_development_in_pl_sql/sql_developer _(not_for_general_sql_plsql_questions)

    Not here.

  • How Oracle called the hidden for the function-based index columns?


    I came across an interesting problem today.  Statistics object for a schema that have been created on the basis of data X have been imported into a 'identical' to the database schema Y.

    The problem is that, on the basis of data X a group of hidden columns associated with index based service (FBIs) were named SYS_NC00182$ to SYS_NC00191$ and on the basis of data Y the same hidden columns were named SYS_NC00183$ to SYS_NC00192$!  The consequence was that statistical column for an FBI data base X have been used for a totally different FBI on the database Y.

    Now, of course, if this was g 11 or 12 c I could just create virtual columns and those of the index.  In this way the names of the columns would be compatible on databases.  However, it is a 10g database, and I do not have this option.

    I am curious to understand how Oracle generates these hidden column names.  I'm also curious if, in 10g, there is a way to identify the name of a column hidden for an FBI that doesn't involve a statement explain plan running on a query that uses all the expressions of the FBI for the table.

    The names of $ SYS_NCnnnnn are based on the internal column id - what is loosely based on the order of creation of the FBI. If you delete a column the column internal ids (after this column), which means the names for the SYS_NCnnnnn$ the change.  An opportunity to explain your results is that a (real) column on the X data table fell, but the column still exists on the database Y.

    If you want to get the link between the current internal name and expression, then you can start with dba_ind_expressions - and create a customized version of the view - e.g @.

    Select c.intcol #, c.name, io.name, idx.name, bo.name, base.name, c.default$, ic.pos #.

    of sys.col$ c, sys.obj$ idx, basis of sys.obj$, sys.icol$ ic.

    sys. User$ io, sys.user$ bo, sys.ind$ I

    where bitand(ic.spare1,1) = 1 / * expression * /.

    and (bitand (students, 1024) = 0) / * not bmji * /.

    and ic.bo # c.obj = #.

    and ic.intcol # c.intcol = #.

    and ic.bo # base.obj = #.

    and io.user # idx.owner = #.

    and bo.user # base.owner = #.

    and ic.obj # idx.obj = #.

    and idx.obj # i.obj = #.

    and however # (1, 2, 3, 4, 6, 7, 9)

    /

    The first two columns in the select ones that I added to the initial view definition.

    Concerning

    Jonathan Lewis

  • With the help of the index function based! =

    Hello

    Is it possible to create an index of basic function that is used when the! = operator is used?

    I have a question with the following in the where clause

    WHERE (SYMBOL = 1 AND LOGICAL_STATUS! = '8')

    Thank you

    Carl

    Published by: Carl Holmes on November 5, 2009 10:18

    But you can create a FBI such as the following which will be a NULL entry when the condition is not put in correspondence:

    CREATE INDEX .... ON TABLE .... (CASE WHEN SYMBOL=1 AND LOGICAL_STATUS !='8' THEN 1 ELSE NULL END);
    

    Then you might change your SQL to match the FBI:

    WHERE CASE WHEN SYMBOL=1 AND LOGICAL_STATUS !='8' THEN 1 ELSE NULL END = 1
    
  • simple question to function test of value chain

    Hey guys,.

    I m just started using teststand.

    My simple question is related to the function "test string value '. What is the difference between the "type of comparison' CASE SENSITIVE and IGNORE CASE? From my point of view are not really meaningful names.

    To avoid simple and stupid questions like that, I tried to use the internal helper function. I'm wrong when I say that the help features are not as good as in labView? I couldn t find any answer to my question... hmmm... How other people handle this situation? (outside of just trying?)

    Thanks for your help

    Hello

    Case SENSITIVE: it will fail if you compare "HELLO" with 'Hello' or 'A' with 'a '.

    IGNORE CASE: this will pass if you compare "HELLO" with 'Hello' or 'A' with 'a '.

    Hope that explains

    Jürgen

  • What is the purpose of the function Array Index in the example attached?

    Hello

    I'm fighting with the Array Index function. I found the attached VI on the OR site which was exactly what I wanted to do, but rather than simply accept that it works and use it, I wanted to understand.

    What is the purpose of the function Index of table inside the while loop? If I put a probe on part and on the other, the values are the same, but if I remove the service and connect directly to the > function, I get an error.

    I do not understand the tables but I don't understand what is happening here. Any help would be appreciated gratefully.

    Thanks in advance.

    It is just picking the first reading of the table in the waveform.  If it's good enough (I'd take at least the average of N samples), why not cela?

  • Listen to ObjectChoiceFields-based index

    HIi,

    I need to listen to ObjectChoiceFields based on the Index.

    I need to know how the default ringtone ObjectChoiceField work when we change the focus by trackball it gets the name of the targeted ring and play.

    is there a listener for it. I implement the fieldchangelistener, but it retrieves the selectedIndex property. but I need to retrieve the name of the targeted ring.

    Hey, I found the solution,

    just convert the field calling fieldChanged chain and you will get the name of the index targeted.

    FieldChangeListener listnr = new FieldChangeListener()

    {

    ' Public Sub fieldChanged (field field, int context)

    {

    String emringtoneS = (String) field.toString ();

    }

    };

  • Impossible to apply the functional base index


    Hi gurus

    For my learning, I am applying the functional index of basic but looks like I'm doing something wrong, see below for my code and appreciate your answers.

    Code example

    DROP TABLE my_table;

    CREATE TABLE my_table

    (

    AA: PRIMARY KEY number 4

    aa_desc VARCHAR2 (30),

    aa_type VARCHAR2 (10)

    ) ;

    CREATE INDEX first_name_idx ON my_table (aa > 10 and upper (aa_desc) = "SA" and aa_type is null).

    Thanks in advance

    Concerning

    Shu

    SQL> create table my_table1
      2    (
      3      aa      number(4) primary key,
      4      aa_desc varchar2(30),
      5      aa_type varchar2(10)
      6    ) ;
    
    Table created.
    
    SQL> create or replace function my_table_check
      2  (
      3    p_aa      in my_table.aa%type
      4  , p_aa_desc in my_table.aa_desc%type
      5  , p_aa_type in my_table.aa_type%type
      6  )
      7  return number
      8  deterministic
      9  as
     10  begin
     11     if (p_aa > 10 and upper(p_aa_desc) = 'SA' and p_aa_type is null) then
     12       return 1;
     13     else
     14       return 0;
     15     end if;
     16  end;
     17  /
    
    Function created.
    
    SQL> create index my_table_idx on my_table1(my_table_check(aa, aa_desc, aa_type));
    
    Index created.
    
    SQL> explain plan for
      2  select *
      3    from my_table1
      4   where my_table_check(aa, aa_desc, aa_type) = 1;
    
    Explained.
    
    SQL> set linesize 130
    SQL> set pagesize 200
    SQL>
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------
    Plan hash value: 3962327877
    --------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |              |     1 |    37 |     1   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| MY_TABLE1    |     1 |    37 |     1   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | MY_TABLE_IDX |     1 |       |     1   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------
    Predicate Information (identified by operation id):
    ---------------------------------------------------
       2 - access("V195588"."MY_TABLE_CHECK"("AA","AA_DESC","AA_TYPE")=1)
    Note
    -----
       - dynamic sampling used for this statement
    
    18 rows selected.
    
    SQL>
    
  • Groovy aggregate function based on condition

    Hi all

    I use jdev 12.1.3.0.0

    I've set up an aggregate function in my master EO as explained in the blog

    https://blogs.Oracle.com/ADF/entry/using_groovy_aggregate_functions_in

    I need to add a condition to the number of records based on an attribute of the object of details view. Algorithm for the use case is

    detailsAccessor.count ("SmsId")

    where detailsAccessor.MessageType is equal to "file."

    Could you help me write an expression to achieve this functionality.

    Thank you

    Mozakkir

    All aggregate in groovy functions accept a groovy as a parameter expression.

    So instead of detailsAccessor.count("SmsId") you can try something like: detailsAccessor.count ("MessageType is 'Applicant'")

    Or convert sum() like this: detailsAccessor.sum ("MessageType is"Applying"? 1: 0 ")"

    Dario

  • Question of function parameter

    OK, I have a function where I am going through a lot of vmhosts, but when I spend say get-vmhost for guests and print the $vmobject it only lists the first object.  What Miss me about the parameter part?

    function {} host_info

    (param

    [CmdletBinding()]

    [Parameter (Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelinebyPropertyName = $True)]

    $VMObject

    )

    $vmobject

    }

    Hello, markdjones82-

    Regarding the part parameter $VMHostObject Parameter(), you are not missing anything that is causing this behavior.  The 'missing' thing is the scriptblock {} in the body of the function.  To get it to behave like you want to, you must add a such scriptblock.  See the example below based on your initial function: he writes messages documented in each of the scriptblocks Begin, process, and end.  This is so that you can see the difference when you use the function with either a direct value by passing (to a param) or with values from the pipeline.

    function Get-VMHostInfo {    [CmdletBinding()]    Param (        [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelinebyPropertyName=$true)]        $VMHostObject    )    begin {Write-Verbose -Verbose "starting; this 'begin' scriptblock only runs one time, and, if a pipelining example, this is before any param variables have values (see:  the value of `$VMHostObject is '$VMHostObject')"}    process {        Write-Verbose -Verbose "in the process scriptblock, either once (non-pipeline example) or for each value passed in a pipelining example"        $VMHostObject    }    end {Write-Verbose -Verbose "in the 'end' scriptblock, and only once"}}
    

    When you take values from the pipeline, is an 'Advanced' function that PowerShell believes that it is, and the advanced functions behave a little differently.  To see the differences, to call this function in one of the following ways and verbose messages as well as the output objects must light up.

    ## non-pipeline example:  should have just three verbose messagesGet-VMHostInfo -VMHostObject (Get-VMHost myhosts.*)
    
    ## pipeline example:  should have larger number of verbose messages:##   one for begin{}, one for every VMHost in the pipeline, and one for end{}##   and, the value for VMHostObject in the verbose message in the begin{} should be emptyGet-VMHost myhosts.* | Get-VMHostInfo
    

    And the suggestion to the name of the function: use standard PowerShell verb-noun, for consistency, attractiveness, etc..  In addition, you can learn more about methods of treatment of function entry in the help topic for about_Functions_Advanced_Methods (Get-Help about_Functions_Advanced_Methods).

    How does do for you?

  • Question of functions table

    Hello people,

    I just want to know why I can't use indexed tables in the table as return type functions. For example when I write "pls_integer index" at the end of the holder_t code, table function does not work. I would like to know why? What are the differences?

    create or replace
    package my_pack
    is
    type holder_t is table of Hello % rowtype;
    / * When I type this table like this, type holder_t is table of the Hello % rowtype index by pls_integer; table function does not work * /.
    type ref_cur_t is ref cursor
    Hello return % rowtype;
    end;

    create or replace
    function pipeline (SLEEP my_pack.ref_cur_t)
    parallel_enable my_pack.holder_t return pipeline (partition SLEEP by any)
    is
    my_row Hello % rowtype;
    holder hello_o: = hello_o (null, null);
    Start

    loop
    When the exit SLEEP % notfound;
    extract SLEEP them in my_row;
    Holder.a: = my_row.a;
    Holder.b: = my_row.b;
    course of action (my_row);
    end loop;
    Close SLEEP;

    return;

    end;



    Thank you.

    Polat says:
    OK, but what are the differences with the type holder_t is table of Hello % rowtype and type holder_t table with % rowtype index by pls_integer Hello? I mean both of them are table, but if I then use as return type it gives an error, I am trying to understand this?

    Difference is

    type holder_t is table of hello%rowtype index by pls_integer;
    

    Is an associative array. Similar to a hash table. This is only one type of PL/SQL, SQL cannot be used.

    This

    type holder_t is table of hello%rowtype;
    

    Is a nested table, similar to a set (or bag). This can be used in SQL, too.

    Looking at the docs for functions in pipeline, type that see you back:

    The data type of the value returned by a function table in pipeline must be a collection type defined at the schema or within a packet level (therefore, it cannot be a type of associative array).
    The elements of the collection type should be given SQL type, not data types supported only by the PL/SQL (for example PLS_INTEGER and BOOLEAN).

    Looking for all ther son you have on this topic, you should certainly read and try under rest three different collection types offered:
    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/composites.htm#LNPLS00501

    Concerning
    Peter

  • Question of function @PRIOR

    Hi all, please explain me using @prior function (Member, offset, list of beaches)
    If I understand well here:
    members - only one Member, we want to return the value of
    Offset - number of periods/some_members of the list of beaches
    list of beaches - choose members for offset

    said, we are accountable
    ACC0
    Acc1
    ACC2

    How should I set the formula with the function @PRIOR if I want to calculate:
    (1) acc2 = acc1 from previous months of N, where N is stored in acc0
    (2) acc2 = acc2 in the previous months of N, where N is stored in acc2 in custom_member2 of custom_dimension2

    Have you tried that?

    "ACC".
    (
    "ACC" = @PRIOR ('ACC_VALUE', 1, "YearTotal");
    )

    Does it work?

    Have you tried that?
    "ACC".
    (
    IF ("ACC_PERIOD" == 1)
    "ACC" = @PRIOR ('ACC_VALUE', 1, "YearTotal");
    ENDIF
    )

    My question is this: your formula works by itself, or it is not? If she's not going without the IF, it is not likely to work next to YEW.

    Kind regards

    Cameron Lackpour

  • Satellite P200-1FZ: Question about Vista performance index?

    I recently bought a P200D-128 announced as having 256 MB of memory graphic dedicated only to find only has a HD2400 with 128 MB card (the name must have been an idea, I know).

    I was looking for a model with 256 MB I had read that it was recommended for good graphics performance in Vista.
    On the P200-128 model Vista performance index showed:

    Processor: 4.8
    Memory: 5.9
    Graphics: 3.3
    Games graphics: 3.7
    Hard drive: 5.2

    If the overall score of 3.3 seems not be limited by the graphics performance.

    I now plans to upgrade this model to a P200-1FZ (which has a HD2600 with 256 MB memory card), but would like to know if it significantly improves the score of graphics and Vista performance index.

    If anyone has this model (or a relative) and could tell me the VEI score, I would be very grateful.

    Thank you.

    Hello

    Just FYI: I Satellite P200D-111 with ATI Mobility Radeon X 2600 almost 5 months now. I use Vista Home Premium and to be honest, I'm quite satisfied with the performance of Vista. Up to now, I also tested with several games such as Call of Duty 2, Call of Duty 4, El Matador and older games like FarCry and Max Payne 2 WXP. It works perfectly.

    I like Call of Duty 4. He funs all simply fantastic. I do not even use complete running. At the moment I think to upgrade RAM to have better running OS. in the end, I can say one thing: for the reasonable price, I have large notebook.

    Good bye

  • Question very, very based on QML...

    I'm new to BB10 development and I have read on the provided tutorials and reference materials. As the title of my post, I have a very basic question for QML who may have a not so fundamental response:

    Just what exaclty QML can be used for? Literature in the documentation seems to suggest in places that QML is used for user interface elements scripts, while behind the scenes is done by code written in C++. Other documentation seems to hint that an application can be written in QML although the only examples I've seen of this apps that really only window UI elements.

    I guess that a shorter question would be: can I write a useful application entirely in QML without ever touching the C/C++?

    On a related note, when someone says that they wrote the app in "cascades", what are they referring to? Is the sequel to stunt development? It is referring to the use of QML / C + c++ / QT?

    You can think of as an extension of Qt which allows a more sophisticated user interface specially design for phones BB10 Cascades.

    QML we can consider, at its simplest, as a way to describe how you want to place controls on the screen.

    Where it gets complicated is the ability to use JavaScript in the QML himself file.

    So yes, it is possible to write completely competent applications entirely in QML/JavaScript and do not write any C++.

    A good starting point is the free to download the book of development...

    http://supportforums.BlackBerry.com/T5/social-lounge/free-BlackBerry-10-development-eBook/TD-p/28358...

  • question of functions call listItemComponent

    Hi all, how to call the function (which is defined outside the ListView) in listItemComponent?

    Container {
        id: cont
        function getColor() {
            return Color.Black
        }
        ListView {
           id: colorList
           listItemComponents: [
               ListItemComponent {
               type: "listItem"
               Container {
               id: item
               background: ???.getColor();
    

    If you want to do this, you need a double function call

    Container {
        id: cont    function getColor(){        return Color.Black;    }
        ListView {
           id: colorList       function getColor(){           return cont.getColor();       }
           listItemComponents: [
               ListItemComponent {
               type: "listItem"
               Container {
               id: item
               background: item.ListItem.view.getColor();
    

Maybe you are looking for