Hashtable keys and enumeration

Enumeration enumObj=hashAllDetails.keys();
String strarray[]=null;
while(enumObj.hasMoreElements())
strarray[]=(String)enumObj.nextElement();
for(int i=0;i<strarray.length();i++)
System.out.println(strarray);
hashAllDetails is hashtable.
how can i get the keys of the hashtable into a string array. actually i have to compare each of the keys in the hashtable and check for single occurence.
plz help me out.

hi
thanks a lot.
i have to this too.
Enumeration objEnumKeys = hashAllDetails.keys();
while(objEnumKeys.hasMoreElements())
String strHashKey = (String)objEnumKeys.nextElement();
UserDetails objUserDetails = (UserDetails) hashAllDetails.get(strHashKey);
System.out.println(objUserDetails.userid);
i have the following code.
in the hashtable hashAllDetails i have done this earlier
hashAllDetails.put(keys,objUserDetails)
UserDetails is a class with various fields. like userid, balance etc.
now i need to get these userid values from the hashtable with are stored in the objects of UserDetails and need to compare values of userid field for single occurence.
hope u can help me out. thanks..

Similar Messages

  • Hashtable with persistent object as key and collection as value

    I am trying to use a Hastable with a persistent object as the key and a
    collection as the value. A long time ago, Abe White said:
    "Kodo currently does not support a map in which the keys are persistent
    objects and the values are collections. I think your best bet would be
    to create an intermediate class that has a 1-1 relation to the "key" and
    a collection of persistent objects for the "value". Then keep a
    collection of these intermediate objects. You could use jdoPostLoad and
    jdoPreStore to hash/unhash the collection of intermediate objects to/from
    a Map if you need to."
    So I made an intermediate class, which gave me a Hashtable with a persistent
    object as the key and another for the value. Then the one for the value
    contains the collection. This works but I'm wondering about the
    performance, would this method be slower?
    Also it was said that version 3.0 would support this. I'm curious if this
    is available in 2.5 or if it's still planned for 3.0.
    Thanks
    Michael

    I'm observing massive performance problems but I didn't think it could be
    caused by this intermediary object but maybe that is the problem. For
    example if I start a transaction to delete everything (with 3,000 records
    which in turn has 3,000 records which in turn has 2 lists each) theprogram
    crashes before it can finish the transaction. I then put in some loops to
    delete 100 records at a time and this runs but it took over an hour to
    delete the 3,000 records.
    Do you have any other ideas of how to improve the performance? Are there
    any alternatives?I solved the performance problem. I was storing web page content (all the
    HTML) in a String which by default is in the default-fetch-group. I had
    been thinking this was using lazy-loading but it wasn't. So I put
    default-fetch-group=false for this property and now the performance is
    great. It makes sense because it was retrieving approximately 5k of text
    for each record! When deleting 3,000 records this comes out to be 14 megs.
    Moral of the story: Use the default-fetch-group wisely!!

  • Writing the hashtable content (both keys and values) into a text file

    Hello,
    I have a hashtable which have some keys and respective values in it. Now I want to write all thoses content into a text or log file. Can anyone please tell me how to write it.
    thanks,
    chaitanya

    Properties is a subclass of Hashtable. It'll probably work just fine as a drop-in replacement.
    Otherwise...if all keys and values are text, then loop through the Entry objects in the Map in question (Hashtable is a Map, and you probably shouldn't be using Hashtable anyway), or loop through the keys and grab the corresponding value for the keys. Read the API docs for java.util.Map. It's pretty straightforward.

  • HashTable keys() strange behaviour in JDK 1.3

    Hi,
    Has the behaviour of the keys()-method in HashTable changed from JDK 1.2.2 to JDK 1.3? I get this strange results:
    I have a hashtable, and asks it for an enumration of the keys using the keys()-method. In JDK 1.2.2 (in the debugger of the Visual Age IDE) this works fine and I'm able to go through the enumeration and use all the keys.
    However, when I run the same code in JDK 1.3, the enumeration returned does not contain all keys, and some keys are duplicated in the enumeration.
    I was able to circumvent this by getting a key Set (with the keySet()-method), ask the set for its Iterator, go through the Iterator and putting the keys in a Vector and finally asking the Vector for its elements as an enumeration.
    This way I got all the keys once, and it worked both in JDK 1.2.2 and in JDK 1.3.
    I think only one thread is accessing the HashTable at the same time.
    Have anyone experienced a similiar behaviour and/or knows the cause of it?
    Regards,
    Magnus Erkstam

    I've run into several cases where what passes for Java 1.2 in Visual Age for Java does not behave in accordance with the JLS, or does not behave the same as other versions of Java 1.2. In my case the differences came up with regard to method invocation. VA4J resolved what should've been ambiguous method invocations entirely based on the signature of the method.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=322726
    That thread talks about those problems, but also mentions an article I found which details diffences some researchers found between VA4J and several other compilers.
    http://www.cis.nctu.edu.tw/~wuuyang/papers/CTHPC2002ambiguities.pdf
    Wouldn't surprise me to hear there are ambiguities in the VA4J version of .equals() either.

  • How to search for a pattern string in entire registry and delete all the keys and subkeys that contain the pattern (C# or VB)?

    I want to search for a pattern string in the entire registry and need to delete all the keys and sub-keys that contain the pattern. How can I implement this in VB Script or C#? Appreciate if you can give some sample examples. Now every time, I am manually
    searching for the pattern in registry and deleting one by one.
    Thanks Prasad

    There is no built in way to do this. You'll end up having to enumerate all keys and values in the entire registry and comparing each one for a pattern using Regex or similar.  This is going to be really slow but there isn't much else you can do about
    it (other than parallelize the enumeration).  Also note that you won't have permissions to all keys for read and/or write access so you'll need to skip over those using exception handling.
    Michael Taylor
    http://blogs.msmvps.com/p3net

  • PKCS#11 Provider unable to fetch asymmetric keys and certificates

    Hi,
    I'm facing a problem while getting keys and certificate from Eracom HSM (ProtectServer Orange:38039 Model: PSO:PL50) using Sun PKCS#11 Provider. It gets only the symmetric keys but NEVER gets the asymmetric keys.
    My code snippet and configuration file are:
         Java Code:
         java.io.InputStream is = new java.io.FileInputStream("pkcs11.cfg");
    sun.security.pkcs11.SunPKCS11 pkcs11_provider = new sun.security.pkcs11.SunPKCS11(is);
    System.out.println("Provider Name : " + pkcs11_provider.getName());
    java.security.Security.addProvider(pkcs11_provider);
    KeyStore ks = KeyStore.getInstance("PKCS11", pkcs11_provider);
    ks.load(null, "password".toCharArray());
    java.util.Enumeration obj_enumeration = ks.aliases();
    while (obj_enumeration.hasMoreElements()) {
    String str_certAlias = (String) obj_enumeration.nextElement();
    System.out.println("Alias : " + str_certAlias);
         pkcs11.cfg:
         name = Eracom
         library = G:\Eracom\cryptoki.dll
         slot = 0
         attributes(*, CKO_PRIVATE_KEY, *) = {
         CKA_TOKEN = false
         CKA_SENSITIVE = false
         CKA_EXTRACTABLE = true
         CKA_DECRYPT = true
         CKA_SIGN = true
         CKA_SIGN_RECOVER = true
         CKA_UNWRAP = true
         attributes(*, CKO_PUBLIC_KEY, *) = {
         CKA_ENCRYPT = true
         CKA_VERIFY = true
         CKA_VERIFY_RECOVER = true
         CKA_WRAP = true
    I also ran my program without specifying any attributes in configuration file, also tried many other combination, but in all cases (with or without attributes) only symmetric keys are loaded from HSM. I am able to get all keys (symmteric and asymmteric) and certificates from the same HSM using IAIK PKCS#11 Provider. Though, the Sun PKCS#11 Provider is working fine with SmartCard tokens (Rainbow, Alladin etc.)
    Any help to resolve my problem would be highly appreciated.
    Thanks in advance.

    I recently had a problem with ECDSA and the PKCS#11 library of nCipher. Here's info from one of their engineers about the PKCS11 library:
    "There are two separate issues - one is that our current pkcs11
    release doesn't support ECDSA signature with SHA-2 hashes
    (the v11.00 firmware adds support for it, but the main release version of
    the pkcs11 library hasn't been updated to take advantage of it yet).
    There is a hotfix version that does support SHA-2 hashes with some
    restrictions, talk to [email protected] for details, and V11.10
    should be out soon and have that merged in.
    But the issue with setting CKA_SIGN is that our underlying HSM API
    allows elliptic curve keys to be either key exchange (ECDH) or
    signature (ECDSA) keys, but not both at one.
    At the PKCS #11 level, if you specify CKA_DERIVE=true and let
    CKA_SIGN default, it will default to false, and vice versa.
    If you specify both CKA_DERIVE=true and CKA_SIGN=true, then we
    return CKR_TEMPLATE_INCONSISTENT because we can't do both with
    the same key. (However, the tests using C_GetMechanismInfo will
    show that we can do both mechanisms, because we can - so long
    as you use different keys, even though they have the same PKCS#11
    type.)
    I can't comment on when or how that will be changed."
    I was using the PKCS#11 library through NSS when I ran into the problem, but I imagine Java would run into similar problems also using the PKCS#11 library. I was able to generate keypairs but not create a CSR (which required making a signature, which required SHA-2).
    Can you just use the java classes to speak to the netHSM? I've never directly written code to do so myself, but I have used Corestreet's OCSP product that uses the java classes to speak to the nCipher HSMs (though not using EC). It might work better than going through the PKCS#11 layer. There should be a java directory under NFAST_HOME that contains some jars.
    Please post back if you figure anything out as I'll probably be playing with this stuff myself soon.
    Dave

  • KEY and KEYREFs support on XML DB

    First of all, sorry for my english but I am a spanish researcher who have not been abroad too much :-).
    I�m trying to use XML DB to store XML documents that represents UML models and the way I've choosed to map relationships in my schema is using KEY and KEYREFs. The fact is that It seems to me that XML DB does not use them whem it creates the different objects that results on the schema's load. Does XMLDB support the definitons of KEYs and KEYREFs in the schema?? If so, how does it do?? Defining constraints oon the objects created?? I suppose no, because the KEYs and KEYREFs are defined on 'complexTypes' and the Oracle's constraints goes to tables (not to object types).
    I'm worling with the next schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns="Kybele/MetaModel_Schema_All" targetNamespace="Kybele/MetaModel_Schema_All" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <!-- En esta version, representaremos las relaciones usando atributos KEYs y KEYREFs
    Ademas, en esta version mapeamos el metamodelo de UML por completo-->
    <!-- En las anotaciones para XML DB usaremos el prefijo MMALL(MetaModelo Completo) -->
    <!--******************** DECLARACION DE LOS ELEMENTOS DEL METAMODELO *********************-->
    <xsd:element name="MetaModel" xdb:defaultTable="MMALL_METAMODELS_TABLE">
    <xsd:complexType xdb:SQLType="MMALL_METAMODELS_TYPE">
    <xsd:sequence>
    <xsd:element name="ModelElements" type="ModelElement" maxOccurs="unbounded"/>
    <xsd:element name="Dependencies" type="Dependency" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <!-- Es en este punto donde definiremos las "PRIMARYKEYS"(KEYs) Y "FOREIGNKEYS"(KEYREFs) para simular relaciones -->
    <!-- ************************************************************************************************* *-->
    <!-- RELACIONES ModelElement - Dependency -->
    <xsd:key name="Dependency_PK">
    <xsd:selector xpath="Dependencies"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:key name="ModelElement_PK">
    <xsd:selector xpath="ModelElements"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:keyref name="Requirement_FK" refer="Dependency_PK">
    <xsd:selector xpath="ModelElements"/>
    <xsd:field xpath="requirement"/>
    </xsd:keyref>
    <xsd:keyref name="Provision_FK" refer="Dependency_PK">
    <xsd:selector xpath="ModelElements"/>
    <xsd:field xpath="provision"/>
    </xsd:keyref>
    <xsd:keyref name="Client_FK" refer="ModelElement_PK">
    <xsd:selector xpath="Dependencies"/>
    <xsd:field xpath="client"/>
    </xsd:keyref>
    <xsd:keyref name="Supplier_FK" refer="ModelElement_PK">
    <xsd:selector xpath="Dependencies"/>
    <xsd:field xpath="supplier"/>
    </xsd:keyref>
    <!-- RELACIONES Generalization - GeneralizableElement -->
    <xsd:key name="Generalization_PK">
    <xsd:selector xpath="Generalization"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:key name="GeneralizableElement_PK">
    <xsd:selector xpath="GeneralizableElement"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:keyref name="Subtype_FK" refer="GeneralizableElement_PK">
    <xsd:selector xpath="Generalization"/>
    <xsd:field xpath="subtype"/>
    </xsd:keyref>
    <xsd:keyref name="Type_FK" refer="GeneralizableElement_PK">
    <xsd:selector xpath="Generalization"/>
    <xsd:field xpath="type"/>
    </xsd:keyref>
    <xsd:keyref name="Generalization_FK" refer="GeneralizableElement_PK">
    <xsd:selector xpath="GeneralizableElement"/>
    <xsd:field xpath="generalization"/>
    </xsd:keyref>
    <xsd:keyref name="Specilization_FK" refer="GeneralizableElement_PK">
    <xsd:selector xpath="GeneralizableElement"/>
    <xsd:field xpath="specialization"/>
    </xsd:keyref>
    <!-- RELACIONES Classifier - AssociationEnd -->
    <xsd:key name="Classifier_PK">
    <xsd:selector xpath="Classifier"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:key name="AssociationEnd_PK">
    <xsd:selector xpath="AssociationEnd"/>
    <xsd:field xpath="Nombre"/>
    </xsd:key>
    <xsd:keyref name="AssociationEnd_FK" refer="AssociationEnd_PK">
    <xsd:selector xpath="Classifier"/>
    <xsd:field xpath="associationEnd"/>
    </xsd:keyref>
    <xsd:keyref name="Participant_FK" refer="AssociationEnd_PK">
    <xsd:selector xpath="Classifier"/>
    <xsd:field xpath="participant"/>
    </xsd:keyref>
    <xsd:keyref name="AssociationEnd_Type_FK" refer="Classifier_PK">
    <xsd:selector xpath="AssociationEnd"/>
    <xsd:field xpath="type"/>
    </xsd:keyref>
    <xsd:keyref name="AssociationEnd_Specification_FK" refer="Classifier_PK">
    <xsd:selector xpath="AssociationEnd"/>
    <xsd:field xpath="specification"/>
    </xsd:keyref>
    <!-- RELACIONES AssociatioEnd - Attribute -->
    <xsd:keyref name="AttributeCompose_FK" refer="AssociationEnd_PK">
    <xsd:selector xpath="Attribute"/>
    <xsd:field xpath="associationEnd_member"/>
    </xsd:keyref>
    <!-- RELACIONES AssociatioEnd - Association -->
    <xsd:keyref name="AssociationEndCompose_FK" refer="Association_PK">
    <xsd:selector xpath="Association"/>
    <xsd:field xpath="Association_member"/>
    </xsd:keyref>
    </xsd:element>
    <!--***************************** DEFINICION DE TIPOS SIMPLES *****************************-->
    <!-- TIPO ENUMERADO AGGREGATIONTYPE -->
    <xsd:simpleType name="AggregationType">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="none"/>
    <xsd:enumeration value="aggregate"/>
    <xsd:enumeration value="composite"/>
    </xsd:restriction>
    </xsd:simpleType>
    <!-- TIPO ENUMERADO SCOPETYPE -->
    <xsd:simpleType name="ScopeType">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="instance"/>
    <xsd:enumeration value="classifier"/>
    </xsd:restriction>
    </xsd:simpleType>
    <!-- TIPO ENUMERADO MULTIPLICITYTYPE -->
    <xsd:simpleType name="MultiplicityType">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="0..1"/>
    <xsd:enumeration value="1..1"/>
    <xsd:enumeration value="0..N"/>
    <xsd:enumeration value="1..N"/>
    </xsd:restriction>
    </xsd:simpleType>
    <!-- TIPO ENUMERADO CHANGEABLETYPE -->
    <xsd:simpleType name="ChangeableType">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="none"/>
    <xsd:enumeration value="frozen"/>
    <xsd:enumeration value="add_only"/>
    </xsd:restriction>
    </xsd:simpleType>
    <!--**************************** DEFINICION DE TIPOS COMPLEJOS **********************************************-->
    <!-- TIPO COMPLEJO MODELELEMENT -->
    <xsd:complexType name="ModelElement" xdb:SQLType="MMALL_ModelElement_Type">
    <xsd:sequence>
    <xsd:element name="nombre" type="xsd:string"/>
    <!-- Subelementos para representar sus relaciones -->
    <xsd:element name="requirement" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="provision" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <!-- TIPO COMPLEJO DEPENDENCY -->
    <xsd:complexType name="Dependency" xdb:SQLType="MMALL_Dependency_Type">
    <xsd:complexContent>
    <xsd:extension base="ModelElement">
    <xsd:sequence>
    <xsd:element name="description" type="xsd:string"/>
    <!-- Subelementos para representar sus relaciones -->
    <xsd:element name="client" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="supplier" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO GENERALIZATION -->
    <xsd:complexType name="Generalization" xdb:SQLType="MMALL_Generalization_Type">
    <xsd:complexContent>
    <xsd:extension base="ModelElement">
    <xsd:sequence>
    <xsd:element name="discriminator" type="xsd:string"/>
    <!-- Subelementos para representar sus relaciones -->
    <xsd:element name="subtype" type="xsd:string"/>
    <xsd:element name="supertype" type="xsd:string"/>
    <!-- Al quitar minOccurs y maxOccurs obligamos a que siempre haya un (Y SOLO UNO)
    subelemento 'subtype' y 'supertype' -->
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO NAMESPACE -->
    <xsd:complexType name="NameSpace" xdb:SQLType="MMALL_NameSpace_Type">
    <xsd:complexContent>
    <xsd:extension base="ModelElement"/>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO GENERALIZABLEELEMENT -->
    <xsd:complexType name="GeneralizableElement" xdb:SQLType="MMALL_GeneralizableElement_Type">
    <xsd:complexContent>
    <xsd:extension base="NameSpace">
    <xsd:sequence>
    <xsd:element name="isRoot" type="xsd:boolean"/>
    <xsd:element name="isLeaf" type="xsd:boolean"/>
    <xsd:element name="isAbstract" type="xsd:boolean"/>
    <!-- Subelementos para representar sus relaciones -->
    <xsd:element name="generalization" type="xsd:string"/>
    <xsd:element name="specification" type="xsd:string"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO: ASSOCIATIONEND -->
    <xsd:complexType name="AssociationEnd" xdb:SQLType="MMALL_ASSOCIATIONEND_TYPE">
    <xsd:complexContent>
    <xsd:extension base="ModelElement">
    <xsd:sequence>
    <xsd:element name="IsNavigable" type="xsd:boolean"/>
    <xsd:element name="IsOrdered" type="xsd:boolean"/>
    <xsd:element name="Aggregation" type="AggregationType"/>
    <xsd:element name="Multiplicity" type="MultiplicityType" minOccurs="0"/>
    <xsd:element name="Changeable" type="ChangeableType"/>
    <xsd:element name="TargetScope" type="ScopeType"/>
    <!-- Subelementos para representar las relaciones -->
    <xsd:element name="Qualifier" type="Attribute" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="Association_member" type="xsd:string"/>
    <xsd:element name="Type" type="xsd:string"/>
    <xsd:element name="Specification" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO CLASSIFIER -->
    <xsd:complexType name="Classifier" xdb:SQLType="MMALL_CLASSIFIER_TYPE">
    <xsd:complexContent>
    <xsd:restriction base="GeneralizableElement">
    <xsd:sequence>
    <!-- Subelementos para representar las relaciones -->
    <xsd:element name="AssociationEnd" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="Participant" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO CLASS -->
    <xsd:complexType name="Class" xdb:SQLType="MMALL_CLASS_TYPE">
    <xsd:complexContent>
    <xsd:extension base="Classifier"/>
    </xsd:complexContent>
    </xsd:complexType>
    <!-- TIPO COMPLEJO ATTRIBUTE -->
    <xsd:complexType name="Attribute" xdb:SQLType="MMALL_ATTRIBUTE_TYPE">
    <xsd:sequence>
    <xsd:element name="associationEnd_member" type="xsd:string" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    </xsd:complexType>
    <!-- TIPO COMPLEJO ASSOCIATION -->
    <xsd:complexType name="Association" xdb:SQLType="MMALL_ASSOCIATION_TYPE">
    <xsd:complexContent>
    <xsd:restriction base="GeneralizableElement">
    <xsd:sequence>
    <xsd:element name="connection" type="AssociationEnd" minOccurs="2" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    and when I try to load it into XMLDB it fails:
    SQL> @registerSchema oe oe /home/OE/Metamodel_Schema_All.xsd "http://kybele.escet.urjc.es/ejemplos/x
    ml_schema/Metamodel_Schema_All.xsd"
    SQL> set echo on
    SQL> connect &1/&[email protected]
    Conectado.
    SQL> alter session set events='31098 trace name context forever';
    Sesi�n modificada.
    SQL> begin
    2 dbms_xmlschema.registeruri(
    3 '&4',
    4 '&3',
    5 TRUE,TRUE,FALSE,TRUE);
    6 end;
    7 /
    antiguo 3: '&4',
    nuevo 3: 'http://kybele.escet.urjc.es/ejemplos/xml_schema/Metamodel_Schema_All.xsd',
    antiguo 4: '&3',
    nuevo 4: '/home/OE/Metamodel_Schema_All.xsd',
    begin
    ERROR en l�nea 1:
    ORA-31154: invalid XML document
    ORA-19202: Se ha producido un error en el procesamiento
    LPX-00217: invalid character 0 (\u0000) de XML
    ORA-06512: en "XDB.DBMS_XMLSCHEMA_INT", l�nea 0
    ORA-06512: en "XDB.DBMS_XMLSCHEMA", l�nea 166
    ORA-06512: en l�nea 2
    it says.
    I have done several attempts, deleting and including just some of the KEYs/KEYREFs in the schema and it seems to me that the problem is that it let me include so much keys as I want but it fails when the number of KEYREFs that I include increase.
    Help!!!
    Thanks on advance for spare your time helping us.

    Looks like known bug 2831302 fixed in (forthcoming) 10g release. In the mean time I would simply comment the key/keyref out of the schema

  • KEY and KEYREF support in Oracle XML DB

    First of all, sorry for my english but I am a spanish researcher who have not been abroad too much :-).
    I�m trying to use XML DB to store XML documents that represents UML models and the way I've choosed to map relationships in my schema is using KEY and KEYREFs. The fact is that It seems to me that XML DB does not use them whem it creates the different objects that results on the schema's load. Does XMLDB support the definitons of KEYs and KEYREFs in the schema?? If so, how does it do?? Defining constraints oon the objects created?? I suppose no, because the KEYs and KEYREFs are defined on 'complexTypes' and the Oracle's constraints goes to tables (not to object types).
    I'm worling with the next schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns="Kybele/MetaModel_Schema_All" targetNamespace="Kybele/MetaModel_Schema_All" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <!-- En esta version, representaremos las relaciones usando atributos KEYs y KEYREFs
         Ademas, en esta version mapeamos el metamodelo de UML por completo-->
         <!-- En las anotaciones para XML DB usaremos el prefijo MMALL(MetaModelo Completo) -->
         <!--******************** DECLARACION DE LOS ELEMENTOS DEL METAMODELO *********************-->
         <xsd:element name="MetaModel" xdb:defaultTable="MMALL_METAMODELS_TABLE">
              <xsd:complexType xdb:SQLType="MMALL_METAMODELS_TYPE">
                   <xsd:sequence>
                        <xsd:element name="ModelElements" type="ModelElement" maxOccurs="unbounded"/>
                        <xsd:element name="Dependencies" type="Dependency" maxOccurs="unbounded"/>
                   </xsd:sequence>
              </xsd:complexType>
         <!-- Es en este punto donde definiremos las "PRIMARYKEYS"(KEYs) Y "FOREIGNKEYS"(KEYREFs) para simular relaciones -->
         <!-- ************************************************************************************************* *-->
              <!-- RELACIONES ModelElement - Dependency -->
              <xsd:key name="Dependency_PK">
                   <xsd:selector xpath="Dependencies"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:key name="ModelElement_PK">
                   <xsd:selector xpath="ModelElements"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:keyref name="Requirement_FK" refer="Dependency_PK">
                   <xsd:selector xpath="ModelElements"/>
                   <xsd:field xpath="requirement"/>
              </xsd:keyref>
              <xsd:keyref name="Provision_FK" refer="Dependency_PK">
                   <xsd:selector xpath="ModelElements"/>
                   <xsd:field xpath="provision"/>
              </xsd:keyref>
              <xsd:keyref name="Client_FK" refer="ModelElement_PK">
                   <xsd:selector xpath="Dependencies"/>
                   <xsd:field xpath="client"/>
              </xsd:keyref>
              <xsd:keyref name="Supplier_FK" refer="ModelElement_PK">
                   <xsd:selector xpath="Dependencies"/>
                   <xsd:field xpath="supplier"/>
              </xsd:keyref>
              <!-- RELACIONES Generalization - GeneralizableElement -->
              <xsd:key name="Generalization_PK">
                   <xsd:selector xpath="Generalization"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:key name="GeneralizableElement_PK">
                   <xsd:selector xpath="GeneralizableElement"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:keyref name="Subtype_FK" refer="GeneralizableElement_PK">
                   <xsd:selector xpath="Generalization"/>
                   <xsd:field xpath="subtype"/>
              </xsd:keyref>
              <xsd:keyref name="Type_FK" refer="GeneralizableElement_PK">
                   <xsd:selector xpath="Generalization"/>
                   <xsd:field xpath="type"/>
              </xsd:keyref>
              <xsd:keyref name="Generalization_FK" refer="GeneralizableElement_PK">
                   <xsd:selector xpath="GeneralizableElement"/>
                   <xsd:field xpath="generalization"/>
              </xsd:keyref>
              <xsd:keyref name="Specilization_FK" refer="GeneralizableElement_PK">
                   <xsd:selector xpath="GeneralizableElement"/>
                   <xsd:field xpath="specialization"/>
              </xsd:keyref>
              <!-- RELACIONES Classifier - AssociationEnd -->
              <xsd:key name="Classifier_PK">
                   <xsd:selector xpath="Classifier"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:key name="AssociationEnd_PK">
                   <xsd:selector xpath="AssociationEnd"/>
                   <xsd:field xpath="Nombre"/>
              </xsd:key>
              <xsd:keyref name="AssociationEnd_FK" refer="AssociationEnd_PK">
                   <xsd:selector xpath="Classifier"/>
                   <xsd:field xpath="associationEnd"/>
              </xsd:keyref>
              <xsd:keyref name="Participant_FK" refer="AssociationEnd_PK">
                   <xsd:selector xpath="Classifier"/>
                   <xsd:field xpath="participant"/>
              </xsd:keyref>
              <xsd:keyref name="AssociationEnd_Type_FK" refer="Classifier_PK">
                   <xsd:selector xpath="AssociationEnd"/>
                   <xsd:field xpath="type"/>
              </xsd:keyref>
              <xsd:keyref name="AssociationEnd_Specification_FK" refer="Classifier_PK">
                   <xsd:selector xpath="AssociationEnd"/>
                   <xsd:field xpath="specification"/>
              </xsd:keyref>
              <!-- RELACIONES AssociatioEnd - Attribute -->
              <xsd:keyref name="AttributeCompose_FK" refer="AssociationEnd_PK">
                   <xsd:selector xpath="Attribute"/>
                   <xsd:field xpath="associationEnd_member"/>
              </xsd:keyref>
              <!-- RELACIONES AssociatioEnd - Association -->
              <xsd:keyref name="AssociationEndCompose_FK" refer="Association_PK">
                   <xsd:selector xpath="Association"/>
                   <xsd:field xpath="Association_member"/>
              </xsd:keyref>
         </xsd:element>
         <!--***************************** DEFINICION DE TIPOS SIMPLES *****************************-->
         <!-- TIPO ENUMERADO AGGREGATIONTYPE -->
         <xsd:simpleType name="AggregationType">
              <xsd:restriction base="xsd:string">
                   <xsd:enumeration value="none"/>
                   <xsd:enumeration value="aggregate"/>
                   <xsd:enumeration value="composite"/>
              </xsd:restriction>
         </xsd:simpleType>
         <!-- TIPO ENUMERADO SCOPETYPE -->
         <xsd:simpleType name="ScopeType">
              <xsd:restriction base="xsd:string">
                   <xsd:enumeration value="instance"/>
                   <xsd:enumeration value="classifier"/>
              </xsd:restriction>
         </xsd:simpleType>
         <!-- TIPO ENUMERADO MULTIPLICITYTYPE -->
         <xsd:simpleType name="MultiplicityType">
              <xsd:restriction base="xsd:string">
                   <xsd:enumeration value="0..1"/>
                   <xsd:enumeration value="1..1"/>
                   <xsd:enumeration value="0..N"/>
                   <xsd:enumeration value="1..N"/>
              </xsd:restriction>
         </xsd:simpleType>
         <!-- TIPO ENUMERADO CHANGEABLETYPE -->
         <xsd:simpleType name="ChangeableType">
              <xsd:restriction base="xsd:string">
                   <xsd:enumeration value="none"/>
                   <xsd:enumeration value="frozen"/>
                   <xsd:enumeration value="add_only"/>
              </xsd:restriction>
         </xsd:simpleType>
         <!--**************************** DEFINICION DE TIPOS COMPLEJOS **********************************************-->
         <!-- TIPO COMPLEJO MODELELEMENT -->
         <xsd:complexType name="ModelElement" xdb:SQLType="MMALL_ModelElement_Type">
              <xsd:sequence>
                   <xsd:element name="nombre" type="xsd:string"/>
                   <!-- Subelementos para representar sus relaciones -->
                   <xsd:element name="requirement" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                   <xsd:element name="provision" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <!-- TIPO COMPLEJO DEPENDENCY -->
         <xsd:complexType name="Dependency" xdb:SQLType="MMALL_Dependency_Type">
              <xsd:complexContent>
                   <xsd:extension base="ModelElement">
                        <xsd:sequence>
                             <xsd:element name="description" type="xsd:string"/>
                             <!-- Subelementos para representar sus relaciones -->
                             <xsd:element name="client" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                             <xsd:element name="supplier" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                        </xsd:sequence>
                   </xsd:extension>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO GENERALIZATION -->
         <xsd:complexType name="Generalization" xdb:SQLType="MMALL_Generalization_Type">
              <xsd:complexContent>
                   <xsd:extension base="ModelElement">
                        <xsd:sequence>
                             <xsd:element name="discriminator" type="xsd:string"/>
                             <!-- Subelementos para representar sus relaciones -->
                             <xsd:element name="subtype" type="xsd:string"/>
                             <xsd:element name="supertype" type="xsd:string"/>
                             <!-- Al quitar minOccurs y maxOccurs obligamos a que siempre haya un (Y SOLO UNO)
                                  subelemento 'subtype' y 'supertype' -->
                        </xsd:sequence>
                   </xsd:extension>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO NAMESPACE -->
         <xsd:complexType name="NameSpace" xdb:SQLType="MMALL_NameSpace_Type">
              <xsd:complexContent>
                   <xsd:extension base="ModelElement"/>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO GENERALIZABLEELEMENT -->
         <xsd:complexType name="GeneralizableElement" xdb:SQLType="MMALL_GeneralizableElement_Type">
              <xsd:complexContent>
                   <xsd:extension base="NameSpace">
                        <xsd:sequence>
                             <xsd:element name="isRoot" type="xsd:boolean"/>
                             <xsd:element name="isLeaf" type="xsd:boolean"/>
                             <xsd:element name="isAbstract" type="xsd:boolean"/>
                             <!-- Subelementos para representar sus relaciones -->
                             <xsd:element name="generalization" type="xsd:string"/>
                             <xsd:element name="specification" type="xsd:string"/>          
                        </xsd:sequence>
                   </xsd:extension>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO: ASSOCIATIONEND -->
         <xsd:complexType name="AssociationEnd" xdb:SQLType="MMALL_ASSOCIATIONEND_TYPE">
         <xsd:complexContent>
              <xsd:extension base="ModelElement">
                   <xsd:sequence>
                        <xsd:element name="IsNavigable" type="xsd:boolean"/>
                        <xsd:element name="IsOrdered" type="xsd:boolean"/>
                        <xsd:element name="Aggregation" type="AggregationType"/>
                        <xsd:element name="Multiplicity" type="MultiplicityType" minOccurs="0"/>
                        <xsd:element name="Changeable" type="ChangeableType"/>
                        <xsd:element name="TargetScope" type="ScopeType"/>
                        <!-- Subelementos para representar las relaciones -->
                        <xsd:element name="Qualifier" type="Attribute" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element name="Association_member" type="xsd:string"/>
                        <xsd:element name="Type" type="xsd:string"/>
                        <xsd:element name="Specification" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                   </xsd:sequence>
              </xsd:extension>
         </xsd:complexContent>          
         </xsd:complexType>
         <!-- TIPO COMPLEJO CLASSIFIER -->
         <xsd:complexType name="Classifier" xdb:SQLType="MMALL_CLASSIFIER_TYPE">
              <xsd:complexContent>
                   <xsd:restriction base="GeneralizableElement">
                        <xsd:sequence>
                             <!-- Subelementos para representar las relaciones -->
                             <xsd:element name="AssociationEnd" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                             <xsd:element name="Participant" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                        </xsd:sequence>
                   </xsd:restriction>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO CLASS -->
         <xsd:complexType name="Class" xdb:SQLType="MMALL_CLASS_TYPE">
              <xsd:complexContent>
                   <xsd:extension base="Classifier"/>
              </xsd:complexContent>
         </xsd:complexType>
         <!-- TIPO COMPLEJO ATTRIBUTE -->
         <xsd:complexType name="Attribute" xdb:SQLType="MMALL_ATTRIBUTE_TYPE">
              <xsd:sequence>
                   <xsd:element name="associationEnd_member" type="xsd:string" minOccurs="0" maxOccurs="1"/>
              </xsd:sequence>
         </xsd:complexType>
         <!-- TIPO COMPLEJO ASSOCIATION -->
         <xsd:complexType name="Association" xdb:SQLType="MMALL_ASSOCIATION_TYPE">
              <xsd:complexContent>
                   <xsd:restriction base="GeneralizableElement">
                        <xsd:sequence>
                             <xsd:element name="connection" type="AssociationEnd" minOccurs="2" maxOccurs="unbounded"/>
                        </xsd:sequence>
                   </xsd:restriction>
              </xsd:complexContent>
         </xsd:complexType>
    </xsd:schema>
    and when I try to load it into XMLDB it fails:
    SQL> @registerSchema oe oe /home/OE/Metamodel_Schema_All.xsd "http://kybele.escet.urjc.es/ejemplos/x
    ml_schema/Metamodel_Schema_All.xsd"
    SQL> set echo on
    SQL> connect &1/&[email protected]
    Conectado.
    SQL> alter session set events='31098 trace name context forever';
    Sesi�n modificada.
    SQL> begin
    2 dbms_xmlschema.registeruri(
    3 '&4',
    4 '&3',
    5 TRUE,TRUE,FALSE,TRUE);
    6 end;
    7 /
    antiguo 3: '&4',
    nuevo 3: 'http://kybele.escet.urjc.es/ejemplos/xml_schema/Metamodel_Schema_All.xsd',
    antiguo 4: '&3',
    nuevo 4: '/home/OE/Metamodel_Schema_All.xsd',
    begin
    ERROR en l�nea 1:
    ORA-31154: invalid XML document
    ORA-19202: Se ha producido un error en el procesamiento
    LPX-00217: invalid character 0 (\u0000) de XML
    ORA-06512: en "XDB.DBMS_XMLSCHEMA_INT", l�nea 0
    ORA-06512: en "XDB.DBMS_XMLSCHEMA", l�nea 166
    ORA-06512: en l�nea 2
    it says.
    I have done several attempts, deleting and including just some of the KEYs/KEYREFs in the schema and it seems to me that the problem is that it let me include so much keys as I want but it fails when the number of KEYREFs that I include increase.
    Help!!!
    Thanks on advance for spare your time helping us.

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

  • Use of primitive datatypes as hashtable key finally OK?

    Are we finally at the point where we can use primitive values as keys in a hashtable? I know that this wouldn't work in the past, and I haven't needed to use a hashtable for years, so I haven't really cared.
    Yesterday I tried it in a program compiled for JVM 1.5, using ints for the keys, and it runs fine. Admittedly, I do get several "unchecked operation" warnings during compilation.

    Yesterday I tried it in a program compiled for JVM
    1.5, using ints for the keys, and it runs fine.
    Admittedly, I do get several "unchecked operation"
    warnings during compilation.It autoboxed the ints as Integers for you. Under the covers it is still using Integer objects.

  • Over riding hashtable get and put method

    Hi all
    Anyone have any idea about over ride HashTable get() and put(). Is it possible to over ride HashTable methods.

    Yes_me wrote:
    I want to change the structure of the java HashTable get and put method. As put method is having two object parameters I want to send one more parameter as String to it. Is it possible to change the structure in this way.What would you want to be returned when calling get()? I would go with the suggestion to create a class to keep that information. If you really want to, you can completely hide that information class inside your extended HashTable. You could create an overloaded put method that takes three parameters and then creates an instance of the information class and put that into the map. If you only want the data for display only, the get method could get the information class mapped to the given key, then simply return a nicely formatted String containing the two values.

  • Need to test for a Hashtable key in JSTL

    What I am trying to accomplish is to test a Hashtable for a specific key and if it is there run some HTML.
    This is my code but it obviously wrong since JSTL yells at me when I try to execute it.
    <c:set var="hash" scope="page" value="${UpdateStatusData}"/>
         <c:if test="${hash.containsKey('success')}">
              success
         </c:if>UpdateStatusData is a Hashtable. How can I modify this "code" in oder to test for a key?
    Thanks

    EL != java
    Luckily EL handles Maps quite well:
    <c:set var="hash" scope="page" value="${UpdateStatusData}"/>
    // one way
    <c:if test="${not empty hash.success}">
         success
    </c:if>
    // an alternative syntax
    <c:if test="${not empty hash['success']}">
         success
    </c:if>Cheers,
    evnafets

  • Search for [Remote Key] and [Remote System] in Data Manager

    Hello all
    I would like to be able to search on the remote key and the remote system in the MDM Data Manager is that not possible? I thought I remembered seeing that possibility under the Free-Form Search but now I can't find it.
    I have, however, found this in the Data Manager reference guide:
    REMOTE SYSTEM AND REMOTE KEY FIELDS
    MDM uses the remote systems defined in the Remote Systems table
    within the MDM Console to store and maintain key mapping information
    for each record or text attribute. It does this using a virtual “key
    mapping” field that you never see in the MDM Client.
    This virtual key mapping field is very much like a qualified lookup field
    into a virtual key mapping qualified lookup table.
    Key Mapping information stored in virtual lookup field
    The Remote System and Remote Key fields are normally not visible;
    however, they do appear in several places in the MDM Client.
    Specifically, both fields: (1) appear in the File > Export dialogs in Record
    mode for exporting value pairs; (2) are recognized by the File > Import
    dialog in Record mode for importing value pairs; and (3) appear in the
    Edit Key Mappings dialogs in both Record mode and Taxonomy mode,
    for viewing and editing value pairs.
    Is there any way to search on the value in the remote key from the Data Manager?

    Not sure search i think not possible.
    But you can see keys as mentioned:
    Enable Key mapping in Console.
    MDM Client maens MDM Data Manager.
    They do appear in several places in the MDM Client or Data Manager. Three different methods to see in DM are given already below:
    Specifically, both fields: (1) appear in the File > Export dialogs in Record mode for exporting value pairs; (2) are recognized by the File > Import dialog in Record mode for importing value pairs; and (3) appear in the Edit Key Mappings dialogs in both Record mode and Taxonomy mode, for viewing and editing value pairs.
    BR,
    Alok

  • Diff b/w primary key and unique key?

    what is the diff b/w primary key and unique key?

    Hi,
    With respect to functionality both are same.
    But in ABAP we only have Primary key for the Database tables declared in the Data Dictionary.
    Unique is generally is the term used with declaring key's for internal tables.
    Both primary and Unique keys can identify one record of a table.
    Regards,
    Sesh

  • Access path difference between Primary Key and Unique Index

    Hi All,
    Is there any specific way the oracle optimizer treats Primary key and Unique index differently?
    Oracle Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> Sample test data for Normal Index
    SQL> create table t_test_tab(col1 number, col2 number, col3 varchar2(12));
    Table created.
    SQL> create sequence seq_t_test_tab start with 1 increment by 1 ;
    Sequence created.
    SQL>  insert into t_test_tab select seq_t_test_tab.nextval, round(dbms_random.value(1,999)) , 'B'||round(dbms_random.value(1,50))||'A' from dual connect by level < 100000;
    99999 rows created.
    SQL> commit;
    Commit complete.
    SQL> exec dbms_stats.gather_table_stats(USER_OWNER','T_TEST_TAB',cascade => true);
    PL/SQL procedure successfully completed.
    SQL> select col1 from t_test_tab;
    99999 rows selected.
    Execution Plan
    Plan hash value: 1565504962
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            | 99999 |   488K|    74   (3)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| T_TEST_TAB | 99999 |   488K|    74   (3)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6915  consistent gets
            259  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL> create index idx_t_test_tab on t_test_tab(col1);
    Index created.
    SQL> exec dbms_stats.gather_table_stats('USER_OWNER','T_TEST_TAB',cascade => true);
    PL/SQL procedure successfully completed.
    SQL> select col1 from t_test_tab;
    99999 rows selected.
    Execution Plan
    Plan hash value: 1565504962
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            | 99999 |   488K|    74   (3)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| T_TEST_TAB | 99999 |   488K|    74   (3)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6915  consistent gets
              0  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL> Sample test data when using Primary Key
    SQL> create table t_test_tab1(col1 number, col2 number, col3 varchar2(12));
    Table created.
    SQL> create sequence seq_t_test_tab1 start with 1 increment by 1 ;
    Sequence created.
    SQL> insert into t_test_tab1 select seq_t_test_tab1.nextval, round(dbms_random.value(1,999)) , 'B'||round(dbms_random.value(1,50))||'A' from dual connect by level < 100000;
    99999 rows created.
    SQL> commit;
    Commit complete.
    SQL> exec dbms_stats.gather_table_stats('USER_OWNER','T_TEST_TAB1',cascade => true);
    PL/SQL procedure successfully completed.
    SQL> select col1 from t_test_tab1;
    99999 rows selected.
    Execution Plan
    Plan hash value: 1727568366
    | Id  | Operation         | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |             | 99999 |   488K|    74   (3)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| T_TEST_TAB1 | 99999 |   488K|    74   (3)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6915  consistent gets
              0  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL> alter table t_test_tab1 add constraint pk_t_test_tab1 primary key (col1);
    Table altered.
    SQL> exec dbms_stats.gather_table_stats('USER_OWNER','T_TEST_TAB1',cascade => true);
    PL/SQL procedure successfully completed.
    SQL> select col1 from t_test_tab1;
    99999 rows selected.
    Execution Plan
    Plan hash value: 2995826579
    | Id  | Operation            | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |                | 99999 |   488K|    59   (2)| 00:00:01 |
    |   1 |  INDEX FAST FULL SCAN| PK_T_TEST_TAB1 | 99999 |   488K|    59   (2)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6867  consistent gets
              0  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL> If you see here the even though statistics were gathered,
         * In the 1st table T_TEST_TAB, the table is still using FULL table access after creation of index.
         * And in the 2nd table T_TEST_TAB1, table is using PRIMARY KEY as expected.
    Any comments ??
    Regards,
    BPat

    Thanks.
    Yes, ignored the NOT NULL part.Did a test and now it is working as expected
    SQL>  create table t_test_tab(col1 number not null, col2 number, col3 varchar2(12));
    Table created.
    SQL>
    create sequence seq_t_test_tab start with 1 increment by 1 ;SQL>
    Sequence created.
    SQL> insert into t_test_tab select seq_t_test_tab.nextval, round(dbms_random.value(1,999)) , 'B'||round(dbms_random.value(1,50))||'A' from dual connect by level < 100000;
    99999 rows created.
    SQL> commit;
    Commit complete.
    SQL>  exec dbms_stats.gather_table_stats('GREP_OWNER','T_TEST_TAB',cascade => true);
    PL/SQL procedure successfully completed.
    SQL>  set autotrace traceonly
    SQL>  select col1 from t_test_tab;
    99999 rows selected.
    Execution Plan
    Plan hash value: 1565504962
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            | 99999 |   488K|    74   (3)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| T_TEST_TAB | 99999 |   488K|    74   (3)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6912  consistent gets
              0  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL>  create index idx_t_test_tab on t_test_tab(col1);
    Index created.
    SQL>  exec dbms_stats.gather_table_stats('GREP_OWNER','T_TEST_TAB',cascade => true);
    PL/SQL procedure successfully completed.
    SQL>  select col1 from t_test_tab;
    99999 rows selected.
    Execution Plan
    Plan hash value: 4115006285
    | Id  | Operation            | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |                | 99999 |   488K|    63   (2)| 00:00:01 |
    |   1 |  INDEX FAST FULL SCAN| IDX_T_TEST_TAB | 99999 |   488K|    63   (2)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
           6881  consistent gets
              0  physical reads
              0  redo size
        1829388  bytes sent via SQL*Net to client
          73850  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          99999  rows processed
    SQL>

  • Difference between Unique key and Unique index

    Hi All,
    I've got confused in the difference between unique index & unique key in a table.
    While we create a unique index on a table, its created as a unique index.
    On the other hand, if we create a unique key/constraint on the table, Oracle also creates an index entry for that. So I can find the same name object in all_constraints as well as in all_indexes.
    My question here is that if during creation of unique key/constraint, an index is automatically created than why is the need to create unique key and then two objects , while we can create only one object i.e. unique index.
    Thanks
    Deepak

    This is only my understanding and is not according to any documentation, that is as follows.
    The unique key (constraint) needs an unique index for achieving constraint of itself.
    Developers and users can make any constraint (unique-key, primary-key, foreign-key, not-null ...) to enable,disable and be deferable. Unique key is able to be enabled, disabled, deferable.
    On the other hand, the index is used for performance-up originally, unique index itself doesn't have the concept like constraints. The index (including non-unique, unique) can be rebuilded,enabled,disabled etc. But I think that index cannot be set "deferable-builded" automatic.

Maybe you are looking for

  • Change HTML page title in Oracle Waveset 8.1.1

    Hi, Does anyone know which file/page to override if I want to change the HTML page title for Oracle Waveset? After the upgrade the title on every page is: "Waveset". This is what I would like to do: - Set the title to "Identity Manager Administration

  • How do I allow a Microsoft Desktop Active-X plugin to install?

    When I try to connect to my work computer via microsoft remote web it says I can't connect because my computer won't allow the microsoft remote desktop active-x control to install. I can't find any security setting preventing me from installing it.

  • ABAP  Upgrade  Documents

    Hi All, Plz let  me know where can  we get  the ABAP  delta documents,  as i  have to  prepare the list of all ABAP (Eg: keywords) changes made to  SAP  from  3.1H to  ECC 6.0. Thanks.

  • How to Undeploy JDI

    I incorrectly installed (deployed) JDI SP13 on WAS SP9.  I am not trying to undeploy (uninstall) JDI SP13 so I can install a JDI SP9.  How do I undeploy the JDI?  (How do I identify the services that are the JDI that I need to undeploy in the SDM?) B

  • PC Video screen capture for AE importing?

    Does anybody know of a good screen capturing utility for the PC that I can import the files of into AE? Currently Im using Camstudio but the results Im getting are very poor and when I import them into AE it doesnt handle them very well at all (very