How to create  index for a column of a view

Hi,
I have created view for a table and then i am trying to create index for a column of that view. i am using the query "CREATE INDEX index_name ON view_name (col)". but Mysql is showing error like "view_name is not a base table".
How can i do that......

As mentioned this is a java forum not a mysql forum, but as I know the answer - you can't create an index directly on a view in mysql.

Similar Messages

  • How to create index on xmltype column

    I have a table having only one column xmlcontent (xmltype). This table stores xml data of about 10GB size. I'm using extract value to move the data to staging tables.
    How can I create index on xmltype column?
    Create index indexname on table (column) doesn't seem to work.
    Sample xmlstructure is given below
    <Root>
    <Type>Insert</Type>
    <Date>2006-12-29</Date>
    <Source>8</Source>
    <id>data</id>
    <key_flds>
    <fld><id>Key1</id><val>C</val></fld>
    <fld><id>Key2</id><val>429672</val></fld>
    <fld><id>Key3</id><val>8</val></fld>
    </key_flds>
    </Root>
    I need to do extract value on all tags and move them to corresponding relational tables.

    Hi, you need to create them using something like this (what I have used and work rather well - if I did not load the xml into an xml table, the processing took about 10 minutes, while the indexed xml table took just a few seconds). statute_xml is the table name and sxmldoc is the xml column/field.
    create index desc_idx on statute_xml
    (sxmldoc.existsNode('/SimpleTypeCompanion/EnumerationValue/@description'))
    create index sid_idx on statute_xml
    (sxmldoc.existsNode
    ('/SimpleTypeCompanion/EnumerationValue/Text')
    create index effdate_idx on statute_xml
    (sxmldoc.existsNode
    ('/SimpleTypeCompanion/EnumerationValue/@effectiveDate')
    Hope this helps.
    Ben

  • How to create index for particular table in R3

    Hi
    My load is taking too much time and it leads to process over due error. Does creating indexes on table in r3 side will solve this issue? If so how can we find out on which table does this particular data source depend. I went to maintain extract structure and findout only one table is supplying data for this data source.
    Is there any other factors depend to solve this.
    Thanks
    kk

    Hi,
    it will depend on the table.... Having an index created will speed up the loading but slow down the insert therefore slowing some process perhaps...
    May I ask which table it is? And which fields would you need to index?
    Are you sure that bottleneck is located in R/3? Analyze your loading time in the monitor and see if this is really the case.
    Otherwise you can create index for a table in Tx SE11; first check if an index is not already created...
    hope this helps,
    Olivier.

  • How to create index on xmtype column

    Hi,
    I have a table as follows
    CREATE TABLE T_TEST_XML (PROCESS_ID NUMBER, TXT_XML XMLTYPE);
    I query the above table very frequently with the query
    SELECT * FROM T_TEST_XML TXS WHERE EXISTSNODE(TXS.TXT_XML, '/order[status="PEN"]') = 1
    How to create function based index on the TXT_XML column for the xpath expression /order[status="PEN"]' to improve the query performance?
    Thank you

    Actually if you are limited to using older software
    1. Consider defining an XML Schema and storing the XML using object relational storage.
    or
    2. If you must store the XML as CLOB create the index on extractValue(), rather than existsNode() and supply the predicate value at the SQL level rather than the XPATH level.
    SQL> DROP TABLE T_TEST_XML
      2  /
    Table dropped.
    SQL> CREATE TABLE T_TEST_XML (PROCESS_ID NUMBER, TXT_XML XMLTYPE)
      2  /
    Table created.
    SQL> create INDEX T_TEXT_XML_IDX on T_TEST_XML( extractValue(TXT_XML,'/order/status'))
      2  /
    Index created.
    SQL> set autotrace on explain
    SQL> --
    SQL> SELECT *
      2    FROM T_TEST_XML TXS
      3   WHERE ExistsNode(TXT_XML,'/order[status="PEN"]') = 1
      4  /
    no rows selected
    Execution Plan
    Plan hash value: 3001212210
    | Id  | Operation          | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |            |     1 |  2017 |    31   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS SEMI |            |     1 |  2017 |    31   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T_TEST_XML |     1 |  2015 |     2   (0)| 00:00:01 |
    |*  3 |   XPATH EVALUATION |            |       |       |            |          |
    Predicate Information (identified by operation id):
       3 - filter("P"."C_01$"='PEN')
    Note
       - dynamic sampling used for this statement (level=2)
    SQL> SELECT *
      2    FROM T_TEST_XML TXS
      3   WHERE extractValue(TXT_XML,'/order/status') = 'PEN'
      4  /
    no rows selected
    Execution Plan
    Plan hash value: 1430727070
    | Id  | Operation                   | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                |     1 |  2015 |     1   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_TEST_XML     |     1 |  2015 |     1   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | T_TEXT_XML_IDX |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access(EXTRACTVALUE(SYS_MAKEXML(0,"SYS_NC00003$"),'/order/status',null,0,0,5242
                  93,133120)='PEN')
    Note
       - dynamic sampling used for this statement (level=2)
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>This allows the index to support querying on any value of status, rather than just PEN

  • How to create index for articles&products in ATG+Endeca application?

    Hi.
    I'm novice in Endeca.
    How to create ATG+Endeca application in which exists search by articles (created in Experience Manager) and by products (from BCC ATG).
    And how to index together products and articles?
    Where can I read about it?
    Thanks.

    Are you planning to create articles in ExpManager OR the content will come from some other system and you just want to manage the pages to display the content in Exp Manager?
    On a high level:
    If it is case #1 you have to integrate ATG & Endeca and write some cartridges for managing the content.
    If it is case #2 you have to integrate ATG & Endeca and modify the auto generated pipeline to pull in your content from the other system.
    Pankaj.

  • How to create index for knowledge article IN CRM 7.0

    Hi,
    I want to delete the index for Knowledge Article, create again and do the complete compilation.
    In webui, Iam able to delete the Index and do complete compilation  and Iam not sure how to create the index.
    can anyone pl guide
    Regards
    BABU

    Hi,
       Once u created a data source. go to respective application component which u have assigned ducring creatinon of DS in RSO2 and right click on it and use replicate metadata.
    a popup with options 1. as data source
                                   2. as 3.x data source will come u select 2 one here and go on.

  • How to create index on XMLType column extension?

    I have an XMLType column named "info" whose corresponding global element has a complexType "InfoType" in namespace "http://example.org/ord". The "InfoType" complexType is extended in two namespaces, "http://example.org/info/zipcode" and "http://example.org/info/street". How do I create a unique index using an "InfoType" element contributed from one of the extension namespaces?
    I have included below a SQL script that completely describes the problem.
    Thanks in advance for your assistance?
    - Ron
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'chapter04prod.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://example.org/prod"
    targetNamespace="http://example.org/prod"
    elementFormDefault="unqualified">
    <xsd:complexType name="ItemsType">
    <xsd:sequence>
    <xsd:element name="product" type="ProductType"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ProductType">
    <xsd:sequence>
    <xsd:element name="number" type="xsd:integer"/>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="size" type="SizeType"/>
    <xsd:element name="color" type="ColorType"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="SizeType">
    <xsd:simpleContent>
    <xsd:extension base="xsd:integer">
    <xsd:attribute name="system" type="xsd:string"/>
    </xsd:extension>
    </xsd:simpleContent>
    </xsd:complexType>
    <xsd:complexType name="ColorType">
    <xsd:attribute name="value" type="xsd:string"/>
    </xsd:complexType>
    </xsd:schema>',
    TRUE,
    TRUE,
    FALSE,
    FALSE);
    END;
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'chapter04ord1.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://example.org/ord"
    xmlns="http://example.org/ord"
    xmlns:prod="http://example.org/prod"
    elementFormDefault="qualified">
    <xsd:import namespace="http://example.org/prod"
    schemaLocation="chapter04prod.xsd"/>
    <xsd:simpleType name="OrderNumType">
    <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:complexType name="InfoType"/>
    <xsd:complexType name="CustomerType">
    <xsd:all>
    <xsd:element name="name" type="CustNameType"/>
    <xsd:element name="number" type="xsd:integer"/>
    <xsd:element name="info" type="InfoType" form="unqualified"/>
    </xsd:all>
    </xsd:complexType>
    <xsd:simpleType name="CustNameType">
    <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:element name="order" type="OrderType"/>
    <xsd:element name="customer" type="CustomerType"/>
    <xsd:complexType name="OrderType">
    <xsd:sequence>
    <xsd:element name="number" type="OrderNumType"/>
    <xsd:element name="customer" type="CustomerType"
    maxOccurs="unbounded"/>
    <xsd:element name="items" type="prod:ItemsType"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>',
    TRUE,
    TRUE,
    FALSE,
    FALSE);
    END;
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'chapter04infozipcode.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ord="http://example.org/ord"
    xmlns="http://example.org/info/zipcode"
    targetNamespace="http://example.org/info/zipcode"
    elementFormDefault="unqualified">
    <xsd:import namespace="http://example.org/ord"
    schemaLocation="chapter04ord1.xsd"/>
    <xsd:complexType name="InfoType">
    <xsd:complexContent>
    <xsd:extension base="ord:InfoType">
    <xsd:sequence>
    <xsd:element name="zipcode" type="xsd:string"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>',
    TRUE,
    TRUE,
    FALSE,
    FALSE);
    END;
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'chapter04infostreet.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ord="http://example.org/ord"
    xmlns="http://example.org/info/street"
    targetNamespace="http://example.org/info/street"
    elementFormDefault="unqualified">
    <xsd:import namespace="http://example.org/ord"
    schemaLocation="chapter04ord1.xsd"/>
    <xsd:complexType name="InfoType">
    <xsd:complexContent>
    <xsd:extension base="ord:InfoType">
    <xsd:sequence>
    <xsd:element name="street" type="xsd:string"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>',
    TRUE,
    TRUE,
    FALSE,
    FALSE);
    END;
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'chapter04nonamespace.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ord="http://example.org/ord">
    <xsd:import namespace="http://example.org/ord"
    schemaLocation="chapter04ord1.xsd"/>
    <xsd:element name="info" type="ord:InfoType">
    </xsd:schema>',
    TRUE,
    TRUE,
    FALSE,
    FALSE);
    END;
    CREATE TABLE customer (
    name VARCHAR(64),
    number INTEGER,
    info XMLTYPE)
    XMLType info STORE AS OBJECT RELATIONAL
    XMLSCHEMA "chapter04nonamespace.xsd"
    ELEMENT "info";
    INSERT INTO customer (name, number, info)
    VALUES ('George Jones', 1,
    XMLType(
    '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:street="http://example.org/info/zipcode"
    xsi:type="zipcode:InfoType">
    <zipcode>28877</zipcode>
    </info>');
    INSERT INTO customer (name, number, info)
    VALUES ('Jim Jones', 2,
    XMLType(
    '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:street="http://example.org/info/street"
    xsi:type="street:InfoType">
    <street>3456 Autumn Lane</street>
    </info>');
    SELECT name,
    extractValue(info, '/info/street')
    FROM customer
    WHERE extractValue(info, '/info/street/text()') LIKE '3456%';
    -- How does one create a unique index as follows?
    CREATE UNIQUE INDEX customer_infostreet ON customer (??????);
    -- The following insert should fail with unique index violation!
    INSERT INTO customer (name, number, info)
    VALUES ('Jerry Jones', 3,
    XMLType(
    '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:street="http://example.org/info/street"
    xsi:type="street:InfoType">
    <street>3456 Autumn Lane</street>
    </info>');

    Ron
    Glad you found a solution.. However a more efficient solution is show below
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> --
    SQL> define USERNAME = OTNTEST
    SQL> --
    SQL> def PASSWORD = OTNTEST
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user OTNTEST cascade
    User dropped.
    SQL> grant connect, resource to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant connect, resource to &USERNAME identified by &PASSWORD
    new   1: grant connect, resource to OTNTEST identified by OTNTEST
    Grant succeeded.
    SQL> grant create any directory, drop any directory to &USERNAME
      2  /
    old   1: grant create any directory, drop any directory to &USERNAME
    new   1: grant create any directory, drop any directory to OTNTEST
    Grant succeeded.
    SQL> grant alter session, create view to &USERNAME
      2  /
    old   1: grant alter session, create view to &USERNAME
    new   1: grant alter session, create view to OTNTEST
    Grant succeeded.
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user OTNTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    SQL> BEGIN
      2  DBMS_XMLSCHEMA.registerSchema(
      3  'chapter04prod.xsd',
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://example.org/prod" targetNamespa
    fault="unqualified">
      5     <xsd:complexType name="ItemsType">
      6             <xsd:sequence>
      7                     <xsd:element name="product" type="ProductType"/>
      8             </xsd:sequence>
      9     </xsd:complexType>
    10     <xsd:complexType name="ProductType">
    11             <xsd:sequence>
    12                     <xsd:element name="num" type="xsd:integer"/>
    13                     <xsd:element name="name" type="xsd:string"/>
    14                     <xsd:element name="size" type="SizeType"/>
    15                     <xsd:element name="color" type="ColorType"/>
    16             </xsd:sequence>
    17     </xsd:complexType>
    18     <xsd:complexType name="SizeType">
    19             <xsd:simpleContent>
    20                     <xsd:extension base="xsd:integer">
    21                             <xsd:attribute name="system" type="xsd:string"/>
    22                     </xsd:extension>
    23             </xsd:simpleContent>
    24     </xsd:complexType>
    25     <xsd:complexType name="ColorType">
    26             <xsd:attribute name="value" type="xsd:string"/>
    27     </xsd:complexType>
    28  </xsd:schema>',
    29  TRUE, TRUE, FALSE, FALSE);
    30  END;
    31  /
    PL/SQL procedure successfully completed.
    SQL> BEGIN
      2  DBMS_XMLSCHEMA.registerSchema(
      3  'chapter04ord1.xsd',
      4  '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
    ://example.org/prod" targetNamespace="http://example.org/ord" elementFormDefault="qualified">
      5     <xsd:import namespace="http://example.org/prod" schemaLocation="chapter04prod.xsd"/>
      6     <xsd:simpleType name="OrderNumType">
      7             <xsd:restriction base="xsd:string"/>
      8     </xsd:simpleType>
      9     <xsd:complexType name="InfoType" xdb:SQLType="INFO_TYPE_T"/>
    10     <xsd:complexType name="CustomerType">
    11             <xsd:all>
    12                     <xsd:element name="name" type="CustNameType"/>
    13                     <xsd:element name="num" type="xsd:integer"/>
    14                     <xsd:element name="info" type="InfoType" minOccurs="1" form="unqualified"/>
    15             </xsd:all>
    16     </xsd:complexType>
    17     <xsd:simpleType name="CustNameType">
    18             <xsd:restriction base="xsd:string"/>
    19     </xsd:simpleType>
    20     <xsd:element name="customers" type="CustomersType"/>
    21     <xsd:complexType name="CustomersType">
    22             <xsd:sequence>
    23                     <xsd:element name="customer" type="CustomerType" minOccurs="0" maxOccurs="unbounded"
    24             </xsd:sequence>
    25     </xsd:complexType>
    26     <xsd:element name="order" type="OrderType"/>
    27     <xsd:element name="customer" type="CustomerType"/>
    28     <xsd:complexType name="OrderType">
    29             <xsd:sequence>
    30                     <xsd:element name="num" type="OrderNumType"/>
    31                     <xsd:element name="customer" type="CustomerType" maxOccurs="unbounded"/>
    32                     <xsd:element name="items" type="prod:ItemsType"/>
    33             </xsd:sequence>
    34     </xsd:complexType>
    35  </xsd:schema>',
    36  TRUE, TRUE, FALSE, FALSE);
    37  END;
    38  /
    PL/SQL procedure successfully completed.
    SQL> BEGIN
      2  DBMS_XMLSCHEMA.registerSchema(
      3  'chapter04infozipcode.xsd',
      4  '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
    //example.org/info/zipcode" targetNamespace="http://example.org/info/zipcode" elementFormDefault="unqualifie
      5     <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
      6     <xsd:complexType name="InfoType" xdb:SQLType="ZIPCODE_INFO_TYPE_T">
      7             <xsd:complexContent>
      8                     <xsd:extension base="ord:InfoType">
      9                             <xsd:sequence>
    10                                     <xsd:element name="zipcode" type="xsd:string"/>
    11                                     <xsd:element name="suffix" type="xsd:string"/>
    12                             </xsd:sequence>
    13                     </xsd:extension>
    14             </xsd:complexContent>
    15     </xsd:complexType>
    16  </xsd:schema>',
    17  TRUE, TRUE, FALSE, FALSE);
    18  END;
    19  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> BEGIN
      2  DBMS_XMLSCHEMA.registerSchema(
      3  'chapter04infostreet.xsd',
      4  '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
    //example.org/info/street" targetNamespace="http://example.org/info/street" elementFormDefault="unqualified"
      5     <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
      6     <xsd:complexType name="InfoType" xdb:SQLType="STREET_INFO_TYPE_T">
      7             <xsd:complexContent>
      8                     <xsd:extension base="ord:InfoType">
      9                             <xsd:sequence>
    10                                     <xsd:element name="street" type="xsd:string"/>
    11                                     <xsd:element name="suffix" type="xsd:string"/>
    12                             </xsd:sequence>
    13                     </xsd:extension>
    14             </xsd:complexContent>
    15     </xsd:complexType>
    16  </xsd:schema>',
    17  TRUE, TRUE, FALSE, FALSE);
    18  END;
    19  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> BEGIN
      2  DBMS_XMLSCHEMA.registerSchema(
      3  'chapter04nonamespace.xsd',
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ord="http://example.org/ord">
      5     <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
      6     <xsd:element name="info" type="ord:InfoType"/>
      7  </xsd:schema>',
      8  TRUE, TRUE, FALSE, FALSE);
      9  END;
    10  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> CREATE TABLE customer (
      2  name VARCHAR(64),
      3  num INTEGER,
      4  info XMLTYPE)
      5  XMLType info STORE AS OBJECT RELATIONAL
      6  XMLSCHEMA "chapter04nonamespace.xsd"
      7  ELEMENT "info";
    Table created.
    SQL>
    SQL> INSERT INTO customer (name, num, info)
      2  VALUES ('George Jones', 1,
      3  XMLType(
      4  '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zipcode="http://example.org/info/zip
      5     <zipcode>28877</zipcode>
      6     <suffix>s1</suffix>
      7  </info>'));
    1 row created.
    SQL>
    SQL> INSERT INTO customer (name, num, info)
      2  VALUES ('Jim Jones', 2,
      3  XMLType(
      4  '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:street="http://example.org/info/stre
      5     <street>3456 Autumn Lane</street>
      6     <suffix>s2</suffix>
      7  </info>'));
    1 row created.
    SQL> /
    1 row created.
    SQL> SELECT name,
      2         extractValue(info, '/info/zipcode'),
      3         extractValue(info, '/info/street')
      4    FROM customer
      5  WHERE extractValue(info, '/info/zipcode/text()') LIKE '2%'
      6     OR extractValue(info, '/info/street/text()') LIKE '3456%';
    NAME
    EXTRACTVALUE(INFO,'/INFO/ZIPCODE')
    EXTRACTVALUE(INFO,'/INFO/STREET')
    George Jones
    28877
    Jim Jones
    3456 Autumn Lane
    NAME
    EXTRACTVALUE(INFO,'/INFO/ZIPCODE')
    EXTRACTVALUE(INFO,'/INFO/STREET')
    Jim Jones
    3456 Autumn Lane
    SQL>
    SQL> CREATE UNIQUE INDEX customer_infozipcode ON customer(
      2  extractValue
      3  (
      4    info,
      5    '/info[@xsi:type="zipcode:InfoType"]/zipcode',
      6    'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      7    xmlns:zipcode="http://example.org/info/zipcode"'
      8  ))
      9  /
    Index created.
    SQL> select column_name
      2    from user_ind_columns
      3   where INDEX_NAME = 'CUSTOMER_INFOZIPCODE'
      4  /
    COLUMN_NAME
    SYS_NC00014$
    SQL> select INDEX_NAME,COLUMN_EXPRESSION
      2    from user_ind_expressions
      3  /
    INDEX_NAME
    COLUMN_EXPRESSION
    CUSTOMER_INFOZIPCODE
    EXTRACTVALUE(SYS_MAKEXML('0341F05603124922B4F6F94DC5E30C2F',4870,"SYS_NC00004$",
    SQL> DROP INDEX CUSTOMER_INFOZIPCODE
      2  /
    Index dropped.
    SQL> desc INFO_TYPE_T
    INFO_TYPE_T is NOT FINAL
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    SQL> --
    SQL> desc ZIPCODE_INFO_TYPE_T
    ZIPCODE_INFO_TYPE_T extends OTNTEST.INFO_TYPE_T
    ZIPCODE_INFO_TYPE_T is NOT FINAL
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    zipcode                                            VARCHAR2(4000 CHAR)
    suffix                                             VARCHAR2(4000 CHAR)
    SQL> --
    SQL> desc STREET_INFO_TYPE_T
    STREET_INFO_TYPE_T extends OTNTEST.INFO_TYPE_T
    STREET_INFO_TYPE_T is NOT FINAL
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    street                                             VARCHAR2(4000 CHAR)
    suffix                                             VARCHAR2(4000 CHAR)
    SQL> --
    SQL> CREATE UNIQUE INDEX customer_infozipcode ON customer(TREAT(INFO.XMLDATA AS ZIPCODE_INFO_TYPE_T)."zipcod
      2  /
    Index created.
    SQL> select column_name
      2    from user_ind_columns
      3   where INDEX_NAME = 'CUSTOMER_INFOZIPCODE'
      4  /
    COLUMN_NAME
    TREAT("SYS_NC00007$" AS "ZIPCODE_INFO_TYPE_T")."zipcode"
    SQL> select INDEX_NAME,COLUMN_EXPRESSION
      2    from user_ind_expressions
      3  /
    no rows selected
    SQL> INSERT INTO customer (name, num, info)
      2  VALUES ('Jerry Jones', 3,
      3  XMLType(
      4  '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zipcode="http://example.org/info/zip
      5     <zipcode>28877</zipcode>
      6     <suffix>s1</suffix>
      7  </info>'))
      8  /
    INSERT INTO customer (name, num, info)
    ERROR at line 1:
    ORA-00001: unique constraint (OTNTEST.CUSTOMER_INFOZIPCODE) violated
    SQL> INSERT INTO customer (name, num, info)
      2  VALUES ('Jerry Jones', 3,
      3  XMLType(
      4  '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:street="http://example.org/info/stre
      5     <street>3456 Autumn Lane</street>
      6     <suffix>s3</suffix>
      7  </info>'))
      8  /
    1 row created.
    SQL>In you solution a functional index was created. In my case, by breaking the XML abstraction, and using object-relational SQL to create the index (DDL statements are the one case where I feel this is acceptable) I was able to create a pure B-TREE index which has the same effect..

  • How to create index for Telecom large table

    Hi ,
    I'm working on DB 10G on REHL 5 for telecom company with more than 1 million recorded per day , we need to speed the query result ,
    we know there are many types of the INDEX and I'm need a professional advice to create a suitable one ,
    many of our queries depend on the MSID ( the MAC address of the Modem ) column ,
    Name           Null Type        
    STREAMNUMBER        NUMBER(9)   
    MSID                VARCHAR2(20)
    USERNAME            VARCHAR2(20)
    DOMAIN              VARCHAR2(20)
    USERIP              VARCHAR2(16)
    CORRELATION_ID      VARCHAR2(64)
    ACCOUNTREASON       NUMBER(3)   
    STARTTIME           VARCHAR2(14)
    PRIORTIME           VARCHAR2(14)
    CURTIME             VARCHAR2(14)
    SESSIONTIME         NUMBER(9)   
    SESSIONVOLUME       NUMBER(9)   
    .please any help ,

    really i have 3 queries for the subscriber activity like (usage details , the date of bundle start the the total of the download , he's working out of bundle or not )
    and any of the subscribers can check those queries at any time thorw web ,
    select nvl(min(substr(a.starttime,1,8)),0) Service_Start_Time, nvl(sum(a.sessionvolume),0) Total_Traffic_KB
    FROM aaa_bill a
    where msid='84A8E46E929D'
    and starttime >=(select  max(fee) FROM aaa_bill
    where msid='84A8E46E929D' and accountreason=5);and the expected result is
    service_start_date  totoal_traffic_KB
    20120225                   440554the MSIDs examples
    (84A8E46E7F43,
    84A8E46E7A82,
    84A8E46E7C84,
    84A8E46E7CBF,
    also i have this query ,
    select
    substr(nvl(
    (select nvl(starttime,'0') as starttime
    from (
    select nvl(starttime,0) starttime,sum(sessionvolume) over(partition by msid order by starttime) sum1
    from aaa_bill
    where msid='84A8E46E90BC' and starttime >=(select  max(fee) FROM aaa_bill
    where msid='84A8E46E90BC' and accountreason=5))
    where sum1>=44987000
    and rownum<2)
    ,0),1,8) Reached_45GB
    from dual;and this one ,
    select min(to_char(to_date(starttime,'yyyymmddhh24miss'),'yyyy-mm-dd hh24:mi:ss')) "Accounting Start Time",
    max(to_char(to_date(curtime,'yyyymmddhh24miss'),'yyyy-mm-dd hh24:mi:ss')) "Accounting Stop Time",sum(sessiontime) Duration1,
    TO_CHAR (TRUNC (SYSDATE) + NUMTODSINTERVAL (sum(sessiontime), 'second'),'hh24:mi:ss') hr,
    sum(sessionvolume) Traffic
    from aaa_bill
    where msid='84A8E46E78EF'
    and starttime >=(select  max(fee) FROM aaa_bill
    where msid='84A8E46E78EF' and accountreason=5)
    group by correlation_id
    order by min(starttime);

  • When do I really need to create indexes for a table?

    Once I was talking to a dba in a conference.
    He told me that not always I have to create indexes for a single table, it depends of its size.
    He said that Oracle read registers in blocks, and for a small table Oracle can read it fully, in a single operation, so in those cases I don't need indexes and statistcs.
    So I would like to know how to calculate it.
    When do I really need to create indexes for a table?
    If someone know any documment that explain that, or have some tips, I'd aprecciate.
    Thanks.
    P.S.: The version that I'm using is Oracle 9.2.0.4.0.

    Hi Vin
    You mentioned so many mistakes here, I don't know where to begin ...
    vprabhu_2000 wrote:
    There are different kinds of Index. B-tree Index is by default. Bit map index, function based index,index organized table.
    B-tree index if the table is large This is incorrect. Small tables, even those consisting of rows within just one block, can benefit from an index. There is no table size too small in which an index might not be benefical. William Robertson in his post references links to my blog where I discuss this.
    and if you want to retrieve 10 % or less of data then B-tree index is good. This is all wrong as well. A FTS on a (say) million row table could very well be more efficient when retrieving (say) just 1% of data. An index could very well be more efficient when retrieving 100% of data. There's nothing special about 10% and there is no such magic number ...
    >
    Bit Map Index - On low cardinality columns like Sex for eg which could have values Male,Female create a bit map index. Completely and utterly wrong. A bitmap index might be the perfect type of index, better than a B-Tree, even if there are (say) 100,000 distinct values in the table. That a bitmap index is only suitable for low cardinality columns is just not true. And what if it's an OLTP application, with lot's of concurrent DML on the underlining table, do you really think a bitmap index would be a good idea ?
    >
    You can also create an Index organized table if there are less rows to be stored so data is stored only once in index and not in table. Not sure what you mean here but an IOT can potentially be useful if you have very large numbers of rows in the table. The number of rows has nothing to do with whether an IOT is suitable or not.
    >
    Hope this info helps. Considering most of it is wrong, I'm not sure it really helps at all :(
    Cheers
    Richard Foote
    http://richardfoote.wordpress.com/

  • Multi-column Index vs One index for each column

    Hello everyone,
    i have one table about 20 000 000 rows, some developers have to generate reports on it and i want to create indexes on this table.
    The table has 34 columns, no primary key, no unique keys.
    The "where..." clause of the reports usually use 8 columns but some reports uses 8 + some other columns.
    can any one help me on what kind of indexes do i have to create?
    1. one index for each column used in "where clause"
    2. one index for 8 columns and some other indexes for other used columns
    3. one index for all columns
    or something else etc...
    br flag

    i have one table about 20 000 000 rows, some developers have to generate reports on it and i want to create indexes on this table.
    The table has 34 columns, no primary key, no unique keys.
    The "where..." clause of the reports usually use 8 columns but some reports uses 8 + some other columns.
    can any one help me on what kind of indexes do i have to create?
    1. one index for each column used in "where clause"
    2. one index for 8 columns and some other indexes for other used columns
    3. one index for all columns
    or something else etc...What's the version of your data base? what kind of database you have, DWH or OTLP? The answer might depend on the type of database as far as bitmap indexes might suit or might not depending if you are runing DWH or OLTP kind of database
    Let me suppose that you are runing OLTP database and you have a where clause with 8 columns.
    1) are all those where clause equalities (where col1 = and col2 =) or there are inequalities?
    2) could you evaluate the most repetitive columns?
    3) could you know the column that could have the best clustering factor (the column which most follow a certain order in the table)
    Based on that I would suggest to create one b-tree index having 8 columns (even though that it seems for me to high) this index should follow the following points:
    1) put the most repetitive column at the leading edge (and compress the index if necessary)
    2) put the columns that are used in equalitity predicate first
    3) put the column having the best clustering factor first
    The most precise index you have the best access you could gain.
    Of course that you have to know that an index access is not always good and a FULL table scan is not always bad.
    Best regards
    Mohamed Houri
    www.hourim.wordpress.com

  • How to create a fixed-width column within an APEX 4 interactive report?

    This thread is a follow-up to {message:id=9191195}. Thanks fac586.
    Partial success: The following code provided by fac586 limits the column width of the Apex 4 interactive report column as long as the column data contains whitespace within a Firefox 3.6 browser:
    <pre class="jive-pre">
    <style type="text/css">
    th#T_DESCRIPTION {
    width: 300px;
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    word-wrap: break-word;
    </style>
    </pre>
    Notes:
    1. The code above is put into the HTML header section for the page.
    2. T_DESCRIPTION is defined as VARCHAR2(2000).
    3. The code above works within the Firefox 3.6.12 browser but does not work within the Internet Explorer 7.0.5730.13 browser.
    I tried adding "float: left;":
    <pre class="jive-pre">
    <style type="text/css">
    th#T_DESCRIPTION {
    width: 300px;
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    word-wrap: break-word;
    <font color="red"> float: left;</font>
    </style>
    </pre>
    Notes:
    1. "float: left;" does not require whitespace and successfully splits the column between characters in lieu of whitespace.
    2. "float: left;" shrinks the cell height and allows the page background to show through... couldn't determine how to fix this.
    3. The code above works within the Firefox 3.6.12 browser but does not work within the Internet Explorer 7.0.5730.13 browser.
    I've done some more research, but I still haven't discovered how to create a fixed-width column within an APEX 4 interactive report that displays properly within an Internet Explorer 7 browser.
    Any ideas and help will be appreciated.

    Thanks for your help with this!
    <pre class="jive-pre">
    what theme are you using?
    </pre>
    A customized version of theme 15.
    <pre class="jive-pre">
    Floating a table cell makes no sense (to me anyway).
    </pre>
    You are correct. I was just trying a different approach ... trying to think out of the box.
    <pre class="jive-pre">
    Think you'll need to create an example on apex.oracle.com with sample data
    if there are any further problems.
    </pre>
    Great suggestion! The code your provided works in the Firefox 3.6.12 browser, but still doesn't work within my Internet Explorer 7.0.5730.13 browser.
    UPDATE:
    I have recreated the problem at apex.oracle.com, you can use the following information to check it out:
    URL: http://apex.oracle.com/pls/apex/f?p=43543:100::::::
    Workspace: IR_FIXED_WIDTH_COLS
    Username: GUEST
    Password: Thx4help
    Application: 43543 - CM_RANDY_SD
    Note: Table name is TEST_DATA
    The following code provided by fac586 works in both Firefox 3.6 and IE7 using default theme "21. Scarlet" at apex.oracle.com; however, it doesn't work when I use a copy of our customized theme "101. Light Blue":
    <pre class="jive-pre">
    <style type="text/css">
    .apexir_WORKSHEET_DATA {
    th#T_DESCRIPTION {
    width: 300px;
    max-width: 300px;
    td[headers="T_DESCRIPTION"] {
    max-width: 300px;
    word-wrap: break-word;
    </style>
    <!--[if lt IE 8]>
    <style type="text/css">
    /* IE is broken */
    th#T_DESCRIPTION,
    td[headers="T_DESCRIPTION"] {
    width: 300px;
    </style>
    <![endif]-->
    </pre>
    Any idea what in the theme could be causing the fixed width column to be ignored in IE 7?
    Edited by: CM Randy SD on Dec 7, 2010 11:22 AM

  • More than one index for a column.

    Hi,
    I am trying to create more than one index for a particular column of the table.But oracle does not allow more than one index for a column.
    I just want to make sure whether we can add more than one index for a column
    and if yes what are the scenarios.
    Because as far as i know some database allows more than one index for a single column.

    You cannot create more than one index for the same column(s).This is not so true Nicolas. Look at following example:
    SQL> create index idx_mytest_id on mytest(id);
    Index created.
    SQL> create index idx_mytest_id_desc on mytest(id desc);
    Index created.
    SQL> create index idx_fbi_mytest_id_upper on mytest(upper(id));
    Index created.
    SQL> create index idx_fbi_mytest_id_upper_desc on mytest(upper(id) desc);
    Index created.
    SQL> create index idx_fbi_mytest_id_lower_id on mytest(lower(id));
    Index created.
    SQL> create index idx_fbi_mytest_id_lower_id_dsc on mytest(lower(id) desc);
    Index created.
    SQL> create index idx_fbi_mytest_id_tr_up on mytest(trunc(upper(id)));
    Index created.
    -- I can still continue but for this example this will be enough
    SQL> select index_name from dba_indexes where table_name = 'MYTEST';
    INDEX_NAME                                                                                                    
    IDX_MYTEST_ID                                                                                                 
    IDX_FBI_MYTEST_ID_UPPER                                                                                       
    IDX_MYTEST_ID_DESC                                                                                            
    IDX_FBI_MYTEST_ID_UPPER_DESC                                                                                  
    IDX_FBI_MYTEST_ID_LOWER_ID                                                                                    
    IDX_FBI_MYTEST_ID_LOWER_ID_DSC                                                                                
    IDX_FBI_MYTEST_ID_TR_UP                                                                                       
    7 rows selected.You can see 7 indexes for one column (ID) and I could still continue...
    So according this test we can say you can't create more than one index for one column (or the same group of columns in case of composite index) with same condition(s).
    Message was edited by:
    Ivan Kartik
    Or simplified: you can't create the same index for same column(s) twice :-)

  • CREATE INDEX WITH DUPLICATE COLUMN NAME

    Hi,
    i need to interface our application with an Orale Bridge to CREATE INDEX with duplcate column Name.
    For Example
    CREATE index NLOT_FOURNLOT_idx ON NLOT(FOURNISSEUR ,NOLOT ,FOURNISSEUR ,NOBLFOUNISSEUR,NOLIGNEBL ,NOLOT ,QTECOLISRECUES ,CODENONQUALITE ,QTECOLISACCEPTE);
    CREATE table NLOT(
    FOURNISSEUR VARCHAR2(09)
    ,NOBLFOURNISSEUR VARCHAR2(13)
    ,NOLIGNEBL VARCHAR2(03)
    ,NOLOT VARCHAR2(20)
    ,QTECOLISRECUES VARCHAR2(10)
    ,CODENONQUALITE VARCHAR2(02)
    ,QTECOLISACCEPTE VARCHAR2(10)
    ,NOMBREDECOLISRE VARCHAR2(10)
    ,NOMBREDECOLISAC VARCHAR2(10)
    ,FILLER VARCHAR2(1)
    ,FILLE1 VARCHAR2(1)
    ,TYPEREFERENCE VARCHAR2(01)
    ,REFERENC1 VARCHAR2(15)
    ,CONTROLERECEPTI VARCHAR2(01)
    ,DATEDEPEREMPTIO VARCHAR2(8)
    ,CONTROLEPROCHAI VARCHAR2(1)
    Thanks
    Philippe

    Well, you can't do it. ORA-957 is one of those irrevocable errors for which the solution is to remove the duplicate name from the SQL statement.
    But, anyway, why do you want to do this? I would guess there's no performance benefit from having the same column indexed twice (of course it's impossible to test this, so it's just my opinion).
    Cheers, APC

  • How to create indexes on ODS ?

    Hello friends ,
    Need some help .
    Could any one please let me know how to create indexes on ODS ?
    How Indexes are useful on ODS ?
    Thanks in advance
    Regards

    Dear Akshay,
    Below is the information about indexes and there creation for ODS.
    You can search a table for data records that satisfy certain search criteria faster using an index.
    An index can be considered a copy of a database table that has been reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example using a binary search. The index also contains a pointer to the corresponding record of the actual table so that the fields not contained in the index can also be read.
    The primary index is distinguished from the secondary indexes of a table. The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.
    You can also create further indexes on a table in the ABAP Dictionary. These are called secondary indexes.Under Indexes, you can create secondary indexes by using the context menu in order to improve the load and query performance of the ODS object This is necessary if the table is frequently accessed in a way that does not take advantage of the sorting of the primary index for the access.
    The database system sometimes does not use a suitable index for a selection, even if there is one. The index used depends on the optimizer used for the database system. You should therefore check if the index you created is also used for the selection (see How to Check if an Index is Used).).
    Creating an additional index could also have side effects on the performance. This is because an index that was used successfully for selection might not be used any longer by the optimizer if the optimizer estimates (sometimes incorrectly) that the newly created index is more selective.
    The indexes on a table should therefore be as disjunct as possible, that is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.
    Leaving content frame.
    With Regards,
    Prafulla Singh

  • How to create indexes using CREATE TABLE statement

    Hi,
    Can anyone please tell me how to create indexes using CREATE TABLE staement? This point is part SQL Expert exam (1Z0-047) and please guide me to use which books for this particular exam.
    Thanks in advance.

    Can anyone please tell me how to create indexes using CREATE TABLE staement?e.g. creating a primary key or a unique constraint will generate indexes along with the create table syntax:
    SQL> create table t (a integer primary key, b integer unique)
    Table created.
    SQL> select   index_name, index_type, uniqueness
      from   user_indexes
    where   table_name = 'T'
    INDEX_NAME                     INDEX_TYPE                  UNIQUENES
    SYS_C0016575                   NORMAL                      UNIQUE  
    SYS_C0016574                   NORMAL                      UNIQUE  
    2 rows selected.

Maybe you are looking for

  • Solving an Outlook sync time mismatch problem on iPhone calendar

    I was recently in spain and my time automatically updated. I was using automatic time zone correction in Settings/General/Date & Time with "set automatically" and under calendar "time zone support" was "ON". However, upon returning home, apparently,

  • Workflow task in "In Process"

    Hi all, I have a workflow task that stayed in the "In Process" state.  The task's method calls a function.  I don't know if the function had an error or what actually happened.  The function makes a call to a third party software(PRISM).  I have the

  • Amber Blinking Light....

    I just got an airport extreme today and it does not work. I have tried everything and am 95 % sure its hooked up correctly. I have a dsl modem with sbc as my provider. Everytime i plug in the airport, it flashes amber. I have read that section in tro

  • Problem in BI configuration Wizard in Visual composer.

    Hi All, I am trying to create iview in VC, when i am trying to connect to system via BI integration wizard , that wizard is not showing XMLA commections folder in available systems list. Kindly tell me what to do as soon as possible. Cheers

  • Control key stopped working in my tigervnc sessions [SOLVED]

    Recently, the ctrl key (for example ctrl+F) stopped working when I connect to a vncserver running tigervnc... anyone else?  Must be something recent package-wise because it has always worked in the past. On the server, I run simply: % cat ~/.vnc/xsta