Creating Index in Procedure and defined variables

Hallo,
I have a procedure and in this I want to create a Index. The table in which I want to create the index in I have defined with a variable.
The variables I have declared before.
CREATE OR REPLACE PROCEDURE PROCEDURE_NAME
IS
-- variables
sql_STMT VARCHAR2(4000);
BEGIN
-- do something
SQL_STMT := 'CREATE INDEX XYZ_IX ON &TABLE_XYZ(GEO) INDEXTYPE IS MDSYS.SPATIAL_INDEX';
     EXECUTE IMMEDIATE SQL_STMT;
END;
And I get this error message:
CALL PROCEDURE_NAME()
FEHLER in Zeile 1:
ORA-29855: Fehler bei Ausf³hrung der Routine ODCIINDEXCREATE
ORA-13249: internal error in Spatial index: [mdidxrbd]
ORA-13249: Error in Spatial index: index build failed
ORA-13249: Error in R-tree: [mdrcrtscrt]
ORA-13231: Index-Tabelle [MDRT_25CEB$] konnte wõhrend Erstellen von R-Baum nicht
erstellt werden
ORA-13249: Stmt-Execute Failure: CREATE TABLE MDRT_25CEB$ (NODE_ID NUMBER
, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE
2
ORA-29400: Data Cartridge-Fehler
ORA-01031: Nicht ausreichende Berechtigungen
ORA-06512: in "MDSYS.SDO_INDEX_METHOD_10I", Zeile 10
ORA-06512: in "STREET_SEGMENT", Zeile 65
So what is wrong? I can not see the error.
Kind Regards and thanks

The user executing this procedure should have explicit create table and create view privileges.
This is required if the index is created via the procedure even though these explicit privileges are not required
when the index is created directly in SQL.
siva

Similar Messages

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • Create index in SQL using a variable

    Hello, need to programatically create an index in a SQL script using a variable for the tablespace name.
    VARIABLE ts_name VARCHAR2(50)
    BEGIN
    SELECT tablespace_name INTO :ts_name
    from user_indexes
    where TABLE_NAME = 'PREFERRED_CUSTOMER';
    end;
    How would I now issue a create index statement like the one below but substituting the tablespace name with the ts_name variable from above?
    CREATE UNIQUE INDEX XAK2PREFERRED_CUSTOMER ON FOCUS.PREFERRED_CUSTOMER (PREFERRED_CUST_NUM) TABLESPACE FOCUSPCIX;
    Thank you,
    David

    I am upgrading a customer database to unicode and I need to convert certain columns to NCHAR base. I am using an alter table command to do this. To make it fasted I need to drop indexes and recreate them at the end. Not all of our customers have used the default tablespace naming conventions so rather than having to change the script each time I was hoping to make the tablespace name portion of the create index DDL dynamic. Thank you,
    David

  • How to create index - Fuzzy Matching and Stemming

    Hi,
    I have a problem with creating and index for fuzzy matching and stemming with my expect behavious
    I Have table customer and column sortname. This table ussally contains values in format: "Surname, FirstName"
    "Lenox, Carl"
    "Svensson, Max"
    "Hamlberg, Ulf"
    etc...
    1. Previously I have index created like this:
    CREATE INDEX IX_CUST_TMP_CTXSORTNAME ON CUSTOMER (SORTNAME) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ('SYNC(ON COMMIT)');
    If I run:
    select * from CUSTOMER where contains(sortname,'Hamlberg') > 0; -- "Hamlberg, Ulf" is returned - OK
    select * from CUSTOMER where contains(sortname,'Ulf') > 0; -- "Hamlberg, Ulf" is returned - OK
    2. I drop the index and create new one for fuzzy matching and stemming
    --NOTE: something is commented out, but I try to run pretty much all the possible varations 
    exec ctx_ddl.create_preference('MYYY_SWEDISH_LEXER', 'BASIC_LEXER');
    --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'printjoins', '_-');
    --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'skipjoins', ',');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_themes', 'NO');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_text', 'YES');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_stems', 'SWEDISH');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'alternate_spelling', 'SWEDISH');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'base_letter', 'YES');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'base_letter_type', 'GENERIC');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'override_base_letter', 'TRUE');
    --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'whitespace', ',');
    exec ctx_ddl.create_preference('MYYY_SWEDISH_FUZZY_PREF', 'BASIC_WORDLIST');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_MATCH','AUTO');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_SCORE','60');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_NUMRESULTS','100');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','SUBSTRING_INDEX','TRUE');
    exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','STEMMER','AUTO');
    create index IX_CUST_TMP_CTXSORTNAME on CUSTOMER (sortname) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ('LEXER MYYY_SWEDISH_LEXER Wordlist MYYY_SWEDISH_FUZZY_PREF SYNC(ON COMMIT)');
    If I run:
    select * from CUSTOMER where contains(sortname,'Hamlberg') > 0; -- "Hamlberg, Ulf" is returned - OK
    select * from CUSTOMER where contains(sortname,'Ulf') > 0; -- "Hamlberg, Ulf" is returned - NOT OK - Why it is not returned ??
    3. Then I want to use fuzzy for searching names:
    a. SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg}, 50, 10, weight)',1) > 0; - it should return "Hamlberg, Ulf"
    b. SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Ulf}, 50, 10, weight)',1) > 0; - it should return "Hamlberg, Ulf"
    c. SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg Ulf}, 50, 10, weight)',1) > 0; - it should return "Hamlberg, Ulf"
    d. SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg, Ulf}, 50, 10, weight)',1) > 0; - it should return "Hamlberg, Ulf"
    Is it possible to do that somehow ?
    Thx for answers.
    Edited by: 906314 on 7.3.2012 4:01

    It works fine for me:
    SQL> create table customer (sortname varchar2(40));
    Table created.
    SQL> insert into customer values ('Lenox, Carl');
    1 row created.
    SQL> insert into customer values ('Svensson, Max');
    1 row created.
    SQL> insert into customer values ('Hamlberg, Ulf');
    1 row created.
    SQL> exec ctx_ddl.create_preference('MYYY_SWEDISH_LEXER', 'BASIC_LEXER');
    PL/SQL procedure successfully completed.
    SQL> --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'printjoins', '_-');
    SQL> --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'skipjoins', ',');
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_themes', 'NO');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_text', 'YES');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'index_stems', 'SWEDISH');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'alternate_spelling', 'SWEDISH');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'base_letter', 'YES');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'base_letter_type', 'GENERIC');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'override_base_letter', 'TRUE');
    PL/SQL procedure successfully completed.
    SQL> --exec ctx_ddl.set_attribute('MYYY_SWEDISH_LEXER', 'whitespace', ',');
    SQL>
    SQL> exec ctx_ddl.create_preference('MYYY_SWEDISH_FUZZY_PREF', 'BASIC_WORDLIST');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_MATCH','AUTO');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_SCORE','60');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','FUZZY_NUMRESULTS','100');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','SUBSTRING_INDEX','TRUE');
    PL/SQL procedure successfully completed.
    SQL> exec ctx_ddl.set_attribute('MYYY_SWEDISH_FUZZY_PREF','STEMMER','AUTO');
    PL/SQL procedure successfully completed.
    SQL>
    SQL> create index IX_CUST_TMP_CTXSORTNAME on CUSTOMER (sortname) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ('LEXER MYYY_SWEDISH_LEXER Wordlist
    MYYY_SWEDISH_FUZZY_PREF SYNC(ON COMMIT)');
    Index created.
    SQL> select * from CUSTOMER where contains(sortname,'Hamlberg') > 0;
    SORTNAME
    Hamlberg, Ulf
    SQL> select * from CUSTOMER where contains(sortname,'Ulf') > 0;
    SORTNAME
    Hamlberg, Ulf
    SQL> SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg}, 50, 10, weight)',1) > 0;
      SCORE(1) SORTNAME
            44 Hamlberg, Ulf
    SQL> SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Ulf}, 50, 10, weight)',1) > 0;
      SCORE(1) SORTNAME
            44 Hamlberg, Ulf
    SQL> SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg Ulf}, 50, 10, weight)',1) > 0;
      SCORE(1) SORTNAME
            44 Hamlberg, Ulf
    SQL> SELECT score(1), sortname FROM CUSTOMER where CONTAINS(sortname, 'fuzzy({Hamlberg, Ulf}, 50, 10, weight)',1) > 0;
      SCORE(1) SORTNAME
            44 Hamlberg, UlfIs this different from what you see? If so, please show a complete session (as I have) so we can check you're not doing anything wrong.
    I don't understand your:
    select * from CUSTOMER where contains(sortname,'Ulf') > 0; -- "Hamlberg, Ulf" is returned - NOT OK - Why it is not returned ??
    Do you mean "why is it returned?" It's because the "contains" operator matches any word in the original text. That's the whole point of it.

  • Procedure and Bind Variable

    I'm trying to write a procedure for an exercise I'm working on. I got an error that I needed to use a "Bind Variable," so now I'm trying to pass a bind variable to the procedure. I am supposed to get user input.
    CREATE OR REPLACE PROCEDURE insert_glaccount
    account_num_pram general_ledger_accounts.account_number%TYPE,
    account_desc_pram general_ledger_accounts.account_description%TYPE
    AS
    BEGIN
    INSERT INTO general_ledger_accounts
    VALUES (account_num_pram, account_desc_pram);
    /*Error handling to coming soon*/
    END;
    VARIABLE account_num_var general_ledger_accounts.account_number%TYPE;
    VARIABLE account_desc_var general_ledger_accounts.account_description%TYPE;
    BEGIN
    :account_num_var := &account_num;
    :account_desc_var := &account_desc;
    CALL insert_glaccount(:account_num_var, :account_desc_var);
    END;
    Now I'm getting an error: "Bind Variable "account_num_var" is NOT DECLARED"
    Can someone please explain how I'm messing this up?

    I don't know if that helps. Now I have this, but it still doesn't work. It looks like the procedure it's self is working, but not the script where I call the procedure:
    CREATE OR REPLACE PROCEDURE insert_glaccount
    account_num_pram general_ledger_accounts.account_number%TYPE,
    account_desc_pram general_ledger_accounts.account_description%TYPE
    AS
    BEGIN
    INSERT INTO general_ledger_accounts
    VALUES (account_num_pram, account_desc_pram);
    COMMIT;
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX THEN
    DBMS_OUTPUT.PUT_LINE('A dup val on index error occurred.');
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('An unknown exception has occurred.');
    END;
    DECLARE
    account_num_var general_ledger_accounts.account_number%TYPE;
    account_desc_var general_ledger_accounts.account_description%TYPE;
    BEGIN
    account_num_var := &account_num; -- Get user input for account number
    account_desc_var := &account_desc; -- Get user input for account description
    CALL insert_glaccount(account_num_var, account_desc_var);
    END;
    /

  • Bind and Define Variable

    Hi,
    Can anyone explain the difference between these two variables and their usage?
    Thanks in advance.
    Regards,
    Vipin

    Hi,
    993280 wrote:
    Hi,
    Can anyone explain the difference between these two variables and their usage?
    Thanks in advance.
    Regards,
    VipinThe short answer is: Bind variables exist in Oracle. Define variables don't.
    Perhaps you're thinking of SQL*Plus Substitution Variables , such as column_root in the example below:
    DEFINE  column_root  = age
    SELECT  pk
    ,       &column_root
    ,       &column_root._old
    FROM    table_x
    ;Substitution variables are strings that SQL*Plus (or some other front ends, but I'll just say SQL*Plus) looks for in your code before sending it to the database. They act like editing macros: you can use a sstitution variable for almost any text in your statements. When SQL*Plus fins the variable name, it replaces it with the variable value, so, in the example above, it changes the text that you wrote to:
    SELECT  pk
    ,       age
    ,       age_old
    FROM    table_x
    ;and then passes that transformed statement to th database to be executed.
    Bind variables can only represent a single value in one of the recognized datatypes, such as NUMBER or VARCHAR2.
    See the SQL*Plus mnual for more about substitution variables.
    Bind variables are documented in the manuals for the different places where you might use them; for examle, ithe PL/SQL manual.
    Edited by: Frank Kulash on Apr 2, 2013 8:08 AM

  • What is the difference between creating index on cube and infopkg in PC

    Hi All
    I have process chain in which after executing infopkg(load data infopkg),creating index on cube i.e Object type is Cube ,for which execution time is 1 hour,then after (subsequent step ) again create index  at this time object type is "infopkg"
    execute infopkg for which time is 2 minnutes,what is the diffrence between these two,if i reome create index from cube i can save 1 hour time,I have to reveiew this
    chain for performance,plese post me your thoughts,it's argent,your help will be heighly appreciatable.Thanks in advance.
    regards
    EA

    By default once u use create index process type Object type has Infopackage - change it to Cube tech name.
    If its Cube - Indexes will be deleted or created for all the date in the cube.
    Message was edited by:
            Jr Roberto

  • Why do we create indexes for DSOs and Cubes.What is the use of it?

    Hi All,
    Can you please tell me why are indexes created for DSOs and Cubes.
    What is the use with the creation of indexes.
    Thanks,
    Sravani

    HI ,
    An index is a copy of a database table that is reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example, when using a binary search. A table has a primary index and a secondary index. The primary index consists of the key fields of the table and is automatically created in the database along with the table. You can also create further indexes on a table in the Java Dictionary. These are called secondary indexes. This is necessary if the table is frequently accessed in a way that does not take advantage of the primary index. Different indexes for the same table are distinguished from one another by a separate index name. The index name must be unique. Whether or not an index is used to access a particular table, is decided by the database system optimizer. This means that an index might improve performance only with certain database systems. You specify if the index should be used on certain database systems in the index definition. Indexes for a table are created when the table is created (provided that the table is not excluded for the database system in the index definition). If the index fields represent the primary keys of the table, that is, if they already uniquely identify each record of the table, the index is referred to as an unique index.
    they are created on DSO and cube for the performance purpose ..and reports created on them wil be also more efficent ..
    Regards,
    shikha

  • How to create stored procedures and use those in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    Hello,
    There is a document explainining how to use Oracle stored proc with Crystal reports.
    Check at:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
    It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports.

  • Pl/sql : bind, host & define variables

    what is difference between bind variable, host variable and define variable (i.e. variable created using DEFINE command) ? In what situation each of these variables are used?

    http://asktom.oracle.com
    for bind variable see the following link
    http://asktom.oracle.com/pls/ask/f?p=4950:8:4466155959264239264::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:668624442763,

  • WHEN TO USE LOGGER IN CREATE INDEX?

    HI ALL,
    WHEN TO USE LOGGER IN CREATE INDEX STATEMENT? AND WHEN TO USE NOLOGGING?
    HOW IS INDEX PHYSICALLY STORED IN DATABASE?
    THANKS IN ADVANCE.
    SANDESH

    NOLOGGING means that information is not written into the redo logs (relatively faster than LOGGING). However, this also means that if you need to recover your database, the index cannot be recovered (since the info cannot be found in the redo logs).
    Use NOLOGGING if you need the speed (big indexes) and/or you don't care about being able to recover the index (i.e. if it is acceptable if you recreate it manually after possible database recovery). Alternatively, create the index with NOLOGGING, alter the index to LOGGING and backup the database. Only after the successfull backup will the index be recoverable (with that backup, not an older one).
    Typically you should use LOGGING rather than NOLOGGING because the overhead of creating the backup/recovery and insecurity on being able to recover (and pressure that goes along with it) is to great. This option will be handy only in rare cases (e.g. when creating staging area tables/indexes in a datawarehouse. They don't need recovery and will therefore speed up when using NOLOGGING).
    Hope this helps,
    Lennert

  • Java Stored Procedures and Triggers

    I want to to use Java stored procedures and triggers within the Oracle 11g XE
    So please , someone can help me because i tried but it didn't work
    I don't know where is the problem
    Thanks !!

    WRONG FORUM!
    Welcome to the forum but this forum is for Java JDBC questions and issues. Your question should be posted in the SQL and PL/SQL forum
    PL/SQL
    >
    I want to to use Java stored procedures and triggers within the Oracle 11g XE
    So please , someone can help me because i tried but it didn't work
    I don't know where is the problem
    >
    Mark this question ANSWERED and repost the question in the other forum
    Before you post review the Oracle Database Java Developer's Guide - it shows how to create Java stored procedures and has example code
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    And in the new post don't just say "I tried but it didn't work". You need to post the code that you tried and what you mean by "didn't work".
    If you got any exceptions or errors you need to post a copy of the exact message or error that you are getting.

  • What is the difference between variable and Define

    WHAT IS THE DIFFERENCE BETWEEN
    these different declarations when it is done using the keyword "variable" and "define"
    and both of these are done OUTSIDE "DECLARE"
    VARIABLE g_monthly_sal NUMBER
    DEFINE p_annual_sal =5000
    -- I understand that p_annual_sal will be taken as a CHAR.
    -- ALSO IF DEFINE variable acts as macro variable, SO is it necessary to give it some value whenever we define it.
    if not what value would be substituted for it?
    OR does that mean whenever we want to specify data type for a bind varible we should use VARIABLE and
    when we do not want to specify type we use DEFINE?
    THANK YOU
    Edited by: user6287828 on Feb 24, 2009 11:03 AM
    Edited by: user6287828 on Feb 24, 2009 11:04 AM

    Both are SQL*plus commands. In a real programming environment you will not use such constructs (except a few rare scripting cases).
    The difference is how the construct is later used. DEFINE is more like a copy&paste string. Whereever the name of this substitution variable is found it will be pasted into the sql*plus session.
    VARIABLE creates a real variable. You can change the value and if follwos the usual principles of variables (including binding).
    Example can be found the docs:
    from the docs
    Where and How to Use Substitution Variables
    You can use substitution variables anywhere in SQL and SQL*Plus commands, except as the first word entered. When SQL*Plus encounters an undefined substitution variable in a command, SQL*Plus prompts you for the value.
    You can enter any string at the prompt, even one containing blanks and punctuation. If the SQL command containing the reference should have quote marks around the variable and you do not include them there, the user must include the quotes when prompted.
    SQL*Plus reads your response from the keyboard, even if you have redirected terminal input or output to a file. If a terminal is not available (if, for example, you run the script in batch mode), SQL*Plus uses the redirected file.
    After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
    Using Bind Variables
    Bind variables are variables you create in SQL*Plus and then reference in PL/SQL or SQL. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus. You can use bind variables for such things as storing return codes or debugging your PL/SQL subprograms.
    Because bind variables are recognized by SQL*Plus, you can display their values in SQL*Plus or reference them in PL/SQL subprograms that you run in SQL*Plus.
    Creating Bind Variables
    You create bind variables in SQL*Plus with the VARIABLE command. For example
    VARIABLE ret_val NUMBER
    This command creates a bind variable named ret_val with a datatype of NUMBER. See the VARIABLE command for more information. (To list all bind variables created in a session, type VARIABLE without any arguments.)
    Referencing Bind Variables
    You reference bind variables in PL/SQL by typing a colon (:) followed immediately by the name of the variable. For example
    :ret_val := 1;
    To change this bind variable in SQL*Plus, you must enter a PL/SQL block. For example:
    BEGIN
    :ret_val:=4;
    END;
    /

  • H2 devide implicit and explicit created indexes by dictionary views?

    For migrating amounts of data it is useful to drop and recreate indexes and referencing constaints. A implicit created index by defining a primary/unique key constraint will be dropped implicitly by dropping the before mentioned constraint. Creating such a constraint after creating an equivalent index with the constraint name will result in an other behaviour. The explicit created index will not be dropped by dropping the referencing primary/unique key constraint.
    So far so good and well known. The question is: Which dictionary view columns will show me the difference between implicit and explict created indexes if I try to dynamically drop and recreate indexes and unique / primary key constraints?

    Oracle Version is always helpful in answering questions, but for 9i you can find the system generated by:
    dba_indexes.generated = 'Y'
    or
    'SYS_' naming convention for system generated indexes
    or
    dba_constraints.constraint_name = dba_constraints.index_name
    Hope this helps - JTommaney

  • Why CBO don't use function-base index when I use like and bind variable

    Hello
    I have litle problem with function-base index and like with bind variable.
    When I use like with bind variable, the CBO don't use my function-base index.
    For example when I create table and index:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    alter session set nls_language='ENGLISH';
    -- DROP TABLE TEST1;
    CREATE TABLE TEST1 (K1 VARCHAR2(32));
    create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI'));
    INSERT INTO TEST1
    SELECT OBJECT_NAME FROM ALL_OBJECTS;
    COMMIT;
    When I run:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    SELECT * FROM TEST1 WHERE K1 = 'abcd';
    or
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%';
    CBO use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 4vrmp7cshbvqy, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%'
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 2 | 98 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 2 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$">=HEXTORAW('6162636400') AND
    "TEST1"."SYS_NC00002$"<HEXTORAW('6162636500') )
    but when I run
    SELECT * FROM TEST1 WHERE K1 LIKE :1;
    CBO don't use index
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 2 | 48 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    What should I change to force CBO to use index.
    I don't wont use index hint in query.
    My oracle version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    OK. But why if I create normal index (create index test1_idx on test1(K1)) and return to default nls settings this same query use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 598212486
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    |* 1 | INDEX RANGE SCAN| TEST1_IDX | 1 | 18 | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - access("K1" LIKE :1)
    filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when index is function-base (create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI')))
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 3 | 54 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when I create index with upper function "index test1_idx on test1(upper(K1))" the query use index
    SELECT * FROM TEST1 WHERE upper(K1) LIKE :1
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 4481 | 157K| 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 806 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$" LIKE :1)
    filter("TEST1"."SYS_NC00002$" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)

Maybe you are looking for

  • Using "Save for Web & Devices" for a Organization Chart with Text

    I created a document in CS3 Illustrator that is an Organization Chart. It contains rectangles, lines, and text. It looks great in Illustrator. I have tried to save it using "Save for Web & Devices" to create a JPEG and a GIF so that I can pop it into

  • Printing Photo Book with 101+ Pages

    Sorry if this has been previously posted, but I could not find anything on this topic. Does anyone know of an online service that will print a photo book with more than 100 pages? I have a photo book I have created in PS6 to commemorate my parents tr

  • Problem performing "cleansweep" t

    I am one of the people having the whole "Cannot initialize audio driver..." problems with a Li've! 5. card with XP an SP2 and all that. Checking in numerous places and then finally the sticky at the top of this board I decide a cleansweep is just the

  • OCA 10g 1Z0-042 exam; Topics in the book 'OCP All In One Exam Guide'

    Hello All The book is divided into Part I (for 1Z0-042), and Part II (1Z0-043), however the Exam Topics doc on the website seems to cover more than is in Part I. E.g. Flashback is discussed in Chapter 29, a full seven Chapetrs into Part II!! Can anyo

  • Tired of Events. How revert to previous display of all photos in library?

    I spent an hour yesterday looking for a specific photo in iPhoto '08 and could not find it. I went to my PowerBook running iPhoto 6 under 10.4.10 and found it within one minute. The new scheme (organized by Events) saves screen space. So what else is