Based on an xsd schema create a table

Hi all,
i need a way that allow me to create a table having an xsd file, in others word i load the xsd schema and create a table accordingly to the element that the xsd schema has respecting also the datatype of every element.
Is the some functionality that allow me to do a thing like that?
thanks to every one
Francesco
Italy

I should now give the following output
Connected.
SQL> set termout on
SQL> set feed on
SQL>
SQL> drop user test cascade;
User dropped.
SQL>
SQL> purge dba_recyclebin;
DBA Recyclebin purged.
SQL>
SQL> create user test identified by test;
User created.
SQL>
SQL> grant xdbadmin, dba to test;
Grant succeeded.
SQL>
SQL>
SQL> connect test/test
Connected.
SQL>
SQL> set echo on
SQL> set termout on
SQL> set feed on
SQL> set long 100000
SQL> set pages 5000
SQL>
SQL> var schemaPath varchar2(256)
SQL> var schemaURL  varchar2(256)
SQL>
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Create an XML Schema root.xsd in directory /public/
SQL>
SQL> ----------------------------------------------------------
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<?xml version="1.0" encoding="UTF-8"?>
  5   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  6              xmlns:xdb="http://xmlns.oracle.com/xdb"
  7              elementFormDefault="qualified"
  8              attributeFormDefault="unqualified"
  9              xdb:storeVarrayAsTable="true">
10   <xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
11    <xs:annotation>
12     <xs:documentation>Example XML Schema</xs:documentation>
13    </xs:annotation>
14    <xs:complexType xdb:maintainDOM="false">
15     <xs:sequence>
16      <xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
17      <xs:element ref="INFO" xdb:SQLInline="false" />
18     </xs:sequence>
19    </xs:complexType>
20   </xs:element>
21   <xs:element name="INFO" xdb:SQLName="INFO_TYPE">
22    <xs:complexType xdb:maintainDOM="false">
23     <xs:sequence>
24      <xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
25      <xs:element name="INFO_CONTENT"
26                  xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
27     </xs:sequence>
28    </xs:complexType>
29   </xs:element>
30  </xs:schema>');
31  begin
32  if (dbms_xdb.existsResource(:schemaPath)) then
33      dbms_xdb.deleteResource(:schemaPath);
34  end if;
35   res := dbms_xdb.createResource(:schemaPath,xmlSchema);
36  end;
37  /
PL/SQL procedure successfully completed.
SQL>
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Selecting repository files and folders via XDBUriType
SQL>
SQL> ----------------------------------------------------------
SQL> select xdbURIType ('/public/root.xsd').getClob()
  2  from   dual;
XDBURITYPE('/PUBLIC/ROOT.XSD').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.o
racle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
  <xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
    <xs:annotation>
      <xs:documentation>Example XML Schema</xs:documentation>
    </xs:annotation>
    <xs:complexType xdb:maintainDOM="false">
      <xs:sequence>
        <xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
        <xs:element ref="INFO" xdb:SQLInline="false"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="INFO" xdb:SQLName="INFO_TYPE">
    <xs:complexType xdb:maintainDOM="false">
      <xs:sequence>
        <xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/
>
        <xs:element name="INFO_CONTENT" xdb:SQLName="TYPE_INFO_CONTENT" type="xs
:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
1 row selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Create an XML Document root.xml in directory /public/
SQL>
SQL> ----------------------------------------------------------
SQL> begin
  2    :schemaURL := 'http://www.myserver.com/root.xml';
  3    :schemaPath := '/public/root.xml';
  4  end;
  5  /
PL/SQL procedure successfully completed.
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<?xml version="1.0" encoding="UTF-8"?>
  5  <ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="root.xsd">
  6   <ID>0</ID>
  7   <INFO>
  8     <INFO_ID>0</INFO_ID>
  9     <INFO_CONTENT>Text</INFO_CONTENT>
10   </INFO>
11  </ROOT>');
12  begin
13  if (dbms_xdb.existsResource(:schemaPath)) then
14      dbms_xdb.deleteResource(:schemaPath);
15  end if;
16   res := dbms_xdb.createResource(:schemaPath,xmlSchema);
17  end;
18  /
PL/SQL procedure successfully completed.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Selecting repository files and folders via XDBUriType
SQL>
SQL> ----------------------------------------------------------
SQL> select xdbURIType ('/public/root.xml').getClob()
  2  from   dual;
XDBURITYPE('/PUBLIC/ROOT.XML').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchem
aLocation="root.xsd">
  <ID>0</ID>
  <INFO>
    <INFO_ID>0</INFO_ID>
    <INFO_CONTENT>Text</INFO_CONTENT>
  </INFO>
</ROOT>
1 row selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Register the XML Schema and create the OR objects
SQL>
SQL> ----------------------------------------------------------
SQL> select * from tab;
no rows selected
SQL> --
SQL> alter session set events='31098 trace name context forever';
Session altered.
SQL> --
SQL> BEGIN
  2   DBMS_XMLSCHEMA.registerSchema
  3   (SCHEMAURL => 'root.xsd',
  4    SCHEMADOC => xdbURIType('/public/root.xsd').getClob(),
  5    LOCAL     => FALSE, -- local
  6    GENTYPES  => TRUE,  -- generate object types
  7    GENBEAN   => FALSE, -- no java beans
  8    GENTABLES => TRUE,  -- generate object tables
  9    OWNER     => USER
10   );
11  END;
12  /
PL/SQL procedure successfully completed.
SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID
INFO1902_TAB                   TABLE
INFO1904_TAB                   TABLE
ROOT_TABLE                     TABLE
3 rows selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Insert some data with XDBURIType
SQL>
SQL> ----------------------------------------------------------
SQL> DECLARE
  2     XMLData xmlType := xmlType(xdbURIType ('/public/root.xml').getClob());
  3  BEGIN
  4    for i in 1..10
  5    loop
  6        insert into ROOT_TABLE
  7        VALUES
  8        (XMLData);
  9    end loop;
10  END;
11  /
PL/SQL procedure successfully completed.
SQL> -- randomize the data a little
SQL> update ROOT_TABLE
  2  set object_value = updateXML(object_value,
  3                              '/ROOT/ID/text()',
  4                              substr(round(dbms_random.value*100),0,2)
  5                              );
10 rows updated.
SQL> update ROOT_TABLE
  2  set object_value = updateXML(object_value,
  3                              '/ROOT/INFO/INFO_ID/text()',
  4                              substr(round(dbms_random.value*100),0,2)
  5                              );
10 rows updated.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- End Result
SQL>
SQL> ----------------------------------------------------------
SQL> select count(*) from root_table;
  COUNT(*)
        10
1 row selected.
SQL> select * from root_table where rownum <= 2;
SYS_NC_ROWINFO$
<?xml version="1.0" encoding="US-ASCII"?>
<ROOT>
  <ID>54</ID>
  <INFO>
    <INFO_ID>28</INFO_ID>
    <INFO_CONTENT>Text</INFO_CONTENT>
  </INFO>
</ROOT>
<?xml version="1.0" encoding="US-ASCII"?>
<ROOT>
  <ID>33</ID>
  <INFO>
    <INFO_ID>35</INFO_ID>
    <INFO_CONTENT>Text</INFO_CONTENT>
  </INFO>
</ROOT>
2 rows selected.
SQL>

Similar Messages

  • DBMS_XMLSCHEMA.CopyEvolve produces ORA-30945: Could not create mapping tabl

    Hi,
    I am trying to update a XML Schema concerning the documents relaties.xsd (the old one) and relaties_v2.xsd (the new one containing only a minor change).
    The document relaties.xsd looks like this:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    elementFormDefault="unqualified"
    attributeFormDefault="unqualified"
    version="1.0">
         <xsd:element name="Relatie" xdb:defaultTable="">
              <xsd:complexType>
                   <xsd:sequence>
                        <xsd:element name="Voornaam" type="xsd:string"/>
                        <xsd:element name="Achternaam" type="xsd:string"/>
                        <xsd:element name="Tussenvoegsel" type="xsd:string"/>
                        <xsd:element name="Geboortedatum" type="xsd:date"/>
                        <xsd:element name="Geslacht">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="M"/>
    <xsd:enumeration value="V"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
                        <xsd:element name="Sofinummer">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="\d{9}"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
                        <xsd:element name="Straatnaam" type="xsd:string"/>
                        <xsd:element name="Huisnummer" type="xsd:string"/>
                        <xsd:element name="Woonplaats" type="xsd:string"/>
                        <!--xsd:element name="Postcode" type="xsd:string"/-->
                        <xsd:element name="Postcode">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="\d{4} [A-Z]{2}"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
                        <xsd:element name="Zrn">
    <xsd:simpleType>
    <xsd:restriction base="xsd:integer">
    <xsd:minInclusive value="1000000"/>
    <xsd:maxInclusive value="99999999999999"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
                   </xsd:sequence>
              </xsd:complexType>
         </xsd:element>
    </xsd:schema>
    Here are the steps I took.
    DECLARE
    res BOOLEAN;
    BEGIN
    res := DBMS_XDB.createResource('/xsd/relaties.xsd',
    bfilename('XSDDIR', 'relaties.xsd')
    END;
    DECLARE
    res BOOLEAN;
    BEGIN
    res := DBMS_XDB.createResource('/xsd/relaties_v2.xsd',
    bfilename('XSDDIR', 'relaties_v2.xsd')
    END;
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'http://localhost:8080/xsd/relaties.xsd',
    XDBURIType('/xsd/relaties.xsd').getClob(),
    TRUE,
    FALSE,
    FALSE,
    TRUE);
    END;
    CREATE
    TABLE relatie_documenten OF XMLTYPE
    XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
    ELEMENT "Relatie"
    CREATE OR REPLACE
    TRIGGER upo_rdt_ai
    AFTER INSERT ON relatie_documenten
    FOR EACH ROW
    DECLARE
    doc XMLType;
    BEGIN
    doc := :new.SYS_NC_ROWINFO$;
    XMLType.schemaValidate(doc);
    END;
    Then I inserted some xml documents into the table relatie_documenten. The XSD worked fine.
    Then I executed the following statement:
    BEGIN
    DBMS_XMLSCHEMA.copyEvolve
    ( schemaURLs => xdb$string_list_t('http://localhost:8080/xsd/relaties.xsd')
    , newSchemas => XMLSequenceType(XDBURIType('/xsd/relaties_v2.xsd').getXML())
    , preserveOldDocs => TRUE
    , mapTabName => 'RELATIE_DOCUMENTEN_TEMP'
    , generateTables => FALSE
    END;
    This resulted in:
    ERROR at line 1:
    ORA-30945: Could not create mapping table 'RELATIE_DOCUMENTEN_TEMP'
    ORA-00600: internal error code, arguments: [kqludp2], [0x66AB407C], [0], [],
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 113
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 210
    ORA-06512: at line 2
    I checked system priviliges as documented in XML DB Developers Guide, Chapter 8 XML Schema Evolution. No other users were connected. The mapping table RELATIE_DOCUMENTEN_TEMP nor any other object named RELATIE_DOCUMENTEN_TEMP did not exist.
    Anyone an idea why I cannot create my mapping table ?
    Gregor

    Which release / platform are you working with
    With 10.2.0.2.1 on Widows I get
    SQL> var schemaURL varchar2(256)
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://localhost:8080/xsd/relaties.xsd';
      3    :schemaPath := '/public/relaties.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      5              xmlns:xdb="http://xmlns.oracle.com/xdb"
      6                 elementFormDefault="unqualified"
      7                 attributeFormDefault="unqualified"
      8                 version="1.0">
      9     <xsd:element name="Relatie" xdb:defaultTable="">
    10             <xsd:complexType>
    11                     <xsd:sequence>
    12                             <xsd:element name="Voornaam" type="xsd:string"/>
    13                             <xsd:element name="Achternaam" type="xsd:string"/>
    14                             <xsd:element name="Tussenvoegsel" type="xsd:string"/>
    15                             <xsd:element name="Geboortedatum" type="xsd:date"/>
    16                             <xsd:element name="Geslacht">
    17                 <xsd:simpleType>
    18                    <xsd:restriction base="xsd:string">
    19                       <xsd:enumeration value="M"/>
    20                       <xsd:enumeration value="V"/>
    21                    </xsd:restriction>
    22                 </xsd:simpleType>
    23              </xsd:element>
    24                     <xsd:element name="Sofinummer">
    25                 <xsd:simpleType>
    26                    <xsd:restriction base="xsd:string">
    27                       <xsd:pattern value="\d{9}"/>
    28                    </xsd:restriction>
    29                 </xsd:simpleType>
    30              </xsd:element>
    31                             <xsd:element name="Straatnaam" type="xsd:string"/>
    32                             <xsd:element name="Huisnummer" type="xsd:string"/>
    33                             <xsd:element name="Woonplaats" type="xsd:string"/>
    34                             <!--xsd:element name="Postcode" type="xsd:string"/-->
    35                             <xsd:element name="Postcode">
    36                 <xsd:simpleType>
    37                    <xsd:restriction base="xsd:string">
    38                       <xsd:pattern value="\d{4} [A-Z]{2}"/>
    39                    </xsd:restriction>
    40                 </xsd:simpleType>
    41              </xsd:element>
    42                             <xsd:element name="Zrn">
    43                 <xsd:simpleType>
    44                    <xsd:restriction base="xsd:integer">
    45                       <xsd:minInclusive value="1000000"/>
    46                       <xsd:maxInclusive value="99999999999999"/>
    47                    </xsd:restriction>
    48                 </xsd:simpleType>
    49              </xsd:element>
    50                     </xsd:sequence>
    51             </xsd:complexType>
    52     </xsd:element>
    53  </xsd:schema>');
    54  begin
    55    if (dbms_xdb.existsResource(:schemaPath)) then
    56      dbms_xdb.deleteResource(:schemaPath);
    57    end if;
    58    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    59  end;
    60  /
    PL/SQL procedure successfully completed.
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.registerSchema(
      3      :schemaURL,
      4      XDBURIType(:schemaPath).getClob(),
      5      TRUE,
      6      FALSE,
      7      FALSE,
      8      TRUE);
      9  END;
    10  /
    PL/SQL procedure successfully completed.
    SQL> DROP TABLE relatie_documenten FORCE
      2  /
    Table dropped.
    SQL> CREATE TABLE relatie_documenten OF XMLTYPE
      2         XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
      3         ELEMENT "Relatie"
      4  /
    Table created.
    SQL> CREATE OR REPLACE TRIGGER upo_rdt_ai
      2  AFTER INSERT ON relatie_documenten
      3  FOR EACH ROW
      4  DECLARE
      5     doc XMLType;
      6  BEGIN
      7     doc := :new.SYS_NC_ROWINFO$;
      8     XMLType.schemaValidate(doc);
      9  END;
    10  /
    Trigger created.
    SQL> INSERT
      2  INTO   relatie_documenten
      3  VALUES (XMLType
      4           ('<Relatie>
      5                <Voornaam>Johan</Voornaam>
      6                <Achternaam>Hermans</Achternaam>
      7                <Tussenvoegsel/>
      8                <Geboortedatum>1978-01-02</Geboortedatum>
      9                <Geslacht>M</Geslacht>
    10                <Sofinummer>233300417</Sofinummer>
    11                <Straatnaam>Stationstraat</Straatnaam>
    12                <Huisnummer>10</Huisnummer>
    13                <Woonplaats>Weesp</Woonplaats>
    14                <Postcode>1383 AK</Postcode>
    15                <Zrn>1234567</Zrn>
    16             </Relatie>'
    17          ).CreateSchemaBasedXML(:schemaURL))
    18  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> INSERT
      2  INTO   relatie_documenten
      3  VALUES (XMLType
      4           ('<Relatie>
      5                <Voornaam>Johanna</Voornaam>
      6                <Achternaam>Gurts</Achternaam>
      7                <Tussenvoegsel/>
      8                <Geboortedatum>1975-11-12</Geboortedatum>
      9                <Geslacht>V</Geslacht>
    10                <Sofinummer>234109807</Sofinummer>
    11                <Straatnaam>Stationstraat</Straatnaam>
    12                <Huisnummer>10</Huisnummer>
    13                <Woonplaats>Weesp</Woonplaats>
    14                <Postcode>1383 AK</Postcode>
    15                <Zrn>7654321</Zrn>
    16             </Relatie>').CreateSchemaBasedXML(:schemaURL))
    17  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> INSERT
      2  INTO   relatie_documenten
      3  VALUES (XMLType
      4           ('<Relatie>
      5                <Voornaam>Johanna</Voornaam>
      6                <Achternaam>Gurts</Achternaam>
      7                <Tussenvoegsel/>
      8                <Geboortedatum>1975-11-12</Geboortedatum>
      9                <Geslacht>O</Geslacht>
    10                <Sofinummer>234109807</Sofinummer>
    11                <Straatnaam>Stationstraat</Straatnaam>
    12                <Huisnummer>10</Huisnummer>
    13                <Woonplaats>Weesp</Woonplaats>
    14                <Postcode>1383 AK</Postcode>
    15                <Zrn>7654321</Zrn>
    16             </Relatie>').CreateSchemaBasedXML(:schemaURL))
    17  /
    VALUES (XMLType
    ERROR at line 3:
    ORA-31038: Invalid enumeration value: "O"
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "SCOTT.UPO_RDT_AI", line 5
    ORA-04088: error during execution of trigger 'SCOTT.UPO_RDT_AI'
    SQL> commit
      2  /
    Commit complete.
    SQL> declare
      2    xmlschema xmltype;
      3    res       boolean;
      4  begin
      5    select xdburitype(:schemaPath).getXML()
      6      into xmlSchema
      7      from dual;
      8    dbms_xdb.deleteResource(:schemaPath);
      9    select insertChildXML
    10           (
    11             xmlschema,
    12             '/xsd:schema//xsd:element[@name="Geslacht"]/xsd:simpleType/xsd:restriction',
    13             'xsd:enumeration',
    14             xmltype('<xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>'),
    15             'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
    16           )
    17    into xmlSchema
    18    from dual;
    19    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /
    Commit complete.
    SQL> set long 100000 pages 200 lines 140
    SQL> --
    SQL> select xdburitype(:schemaPath).getXML()
      2    from dual
      3  /
    XDBURITYPE(:SCHEMAPATH).GETXML()
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="unqualified" attributeF
    ormDefault="unqualified" version="1.0">
      <xsd:element name="Relatie" xdb:defaultTable="">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Voornaam" type="xsd:string"/>
            <xsd:element name="Achternaam" type="xsd:string"/>
            <xsd:element name="Tussenvoegsel" type="xsd:string"/>
            <xsd:element name="Geboortedatum" type="xsd:date"/>
            <xsd:element name="Geslacht">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:enumeration value="M"/>
                  <xsd:enumeration value="V"/>
                  <xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
            <xsd:element name="Sofinummer">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:pattern value="\d{9}"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
            <xsd:element name="Straatnaam" type="xsd:string"/>
            <xsd:element name="Huisnummer" type="xsd:string"/>
            <xsd:element name="Woonplaats" type="xsd:string"/>
            <!--xsd:element name="Postcode" type="xsd:string"/-->
            <xsd:element name="Postcode">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:pattern value="\d{4} [A-Z]{2}"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
            <xsd:element name="Zrn">
              <xsd:simpleType>
                <xsd:restriction base="xsd:integer">
                  <xsd:minInclusive value="1000000"/>
                  <xsd:maxInclusive value="99999999999999"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    SQL> DROP TABLE RELATIE_DOCUMENTEN_TEMP
      2  /
    Table dropped.
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.copyEvolve
      3      ( schemaURLs      => xdb$string_list_t(:schemaURL)
      4      , newSchemas      => XMLSequenceType(XDBURIType(:schemaPath).getXML())
      5      , preserveOldDocs => TRUE
      6      , mapTabName      => 'RELATIE_DOCUMENTEN_TEMP'
      7      , generateTables  => FALSE
      8      );
      9  END;
    10  /
    PL/SQL procedure successfully completed.
    SQL> CREATE TABLE relatie_documenten OF XMLTYPE
      2         XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
      3         ELEMENT "Relatie"
      4  /
    Table created.
    SQL> CREATE OR REPLACE TRIGGER upo_rdt_ai
      2  AFTER INSERT ON relatie_documenten
      3  FOR EACH ROW
      4  DECLARE
      5     doc XMLType;
      6  BEGIN
      7     doc := :new.SYS_NC_ROWINFO$;
      8     XMLType.schemaValidate(doc);
      9  END;
    10  /
    Trigger created.
    SQL> declare
      2    tablename varchar2(2000);
      3  begin
      4    select temp_tabname
      5      into tablename
      6      from RELATIE_DOCUMENTEN_TEMP
      7     where table_name = USER || '.' || upper('relatie_documenten');
      8    execute immediate 'insert into relatie_documenten select xmltype(data) from ' || tablename;
      9    commit;
    10  end;
    11  /
    PL/SQL procedure successfully completed.
    SQL> select *
      2    from relatie_documenten
      3  /
    SYS_NC_ROWINFO$
    <Relatie>
      <Voornaam>Johan</Voornaam>
      <Achternaam>Hermans</Achternaam>
      <Tussenvoegsel/>
      <Geboortedatum>1978-01-02</Geboortedatum>
      <Geslacht>M</Geslacht>
      <Sofinummer>233300417</Sofinummer>
      <Straatnaam>Stationstraat</Straatnaam>
      <Huisnummer>10</Huisnummer>
      <Woonplaats>Weesp</Woonplaats>
      <Postcode>1383 AK</Postcode>
      <Zrn>1234567</Zrn>
    </Relatie>
    <Relatie>
      <Voornaam>Johanna</Voornaam>
      <Achternaam>Gurts</Achternaam>
      <Tussenvoegsel/>
      <Geboortedatum>1975-11-12</Geboortedatum>
      <Geslacht>V</Geslacht>
      <Sofinummer>234109807</Sofinummer>
      <Straatnaam>Stationstraat</Straatnaam>
      <Huisnummer>10</Huisnummer>
      <Woonplaats>Weesp</Woonplaats>
      <Postcode>1383 AK</Postcode>
      <Zrn>7654321</Zrn>
    </Relatie>
    SQL> INSERT
      2  INTO   relatie_documenten
      3  VALUES (XMLType
      4           ('<Relatie>
      5                <Voornaam>Johanna</Voornaam>
      6                <Achternaam>Gurts</Achternaam>
      7                <Tussenvoegsel/>
      8                <Geboortedatum>1975-11-12</Geboortedatum>
      9                <Geslacht>O</Geslacht>
    10                <Sofinummer>234109807</Sofinummer>
    11                <Straatnaam>Stationstraat</Straatnaam>
    12                <Huisnummer>10</Huisnummer>
    13                <Woonplaats>Weesp</Woonplaats>
    14                <Postcode>1383 AK</Postcode>
    15                <Zrn>7654321</Zrn>
    16             </Relatie>').CreateSchemaBasedXML(:schemaURL))
    17  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> select *
      2    from relatie_documenten
      3  /
    SYS_NC_ROWINFO$
    <Relatie>
      <Voornaam>Johan</Voornaam>
      <Achternaam>Hermans</Achternaam>
      <Tussenvoegsel/>
      <Geboortedatum>1978-01-02</Geboortedatum>
      <Geslacht>M</Geslacht>
      <Sofinummer>233300417</Sofinummer>
      <Straatnaam>Stationstraat</Straatnaam>
      <Huisnummer>10</Huisnummer>
      <Woonplaats>Weesp</Woonplaats>
      <Postcode>1383 AK</Postcode>
      <Zrn>1234567</Zrn>
    </Relatie>
    <Relatie>
      <Voornaam>Johanna</Voornaam>
      <Achternaam>Gurts</Achternaam>
      <Tussenvoegsel/>
      <Geboortedatum>1975-11-12</Geboortedatum>
      <Geslacht>V</Geslacht>
      <Sofinummer>234109807</Sofinummer>
      <Straatnaam>Stationstraat</Straatnaam>
      <Huisnummer>10</Huisnummer>
      <Woonplaats>Weesp</Woonplaats>
      <Postcode>1383 AK</Postcode>
      <Zrn>7654321</Zrn>
    </Relatie>
    <Relatie>
      <Voornaam>Johanna</Voornaam>
      <Achternaam>Gurts</Achternaam>
      <Tussenvoegsel/>
      <Geboortedatum>1975-11-12</Geboortedatum>
      <Geslacht>O</Geslacht>
      <Sofinummer>234109807</Sofinummer>
      <Straatnaam>Stationstraat</Straatnaam>
      <Huisnummer>10</Huisnummer>
      <Woonplaats>Weesp</Woonplaats>
      <Postcode>1383 AK</Postcode>
      <Zrn>7654321</Zrn>
    </Relatie>
    SQL>Here's the SQL, can you cut'n'paste and run the whole thing as XML_OWNER
    var schemaURL varchar2(256)
    var schemaPath varchar2(256)
    begin
      :schemaURL := 'http://localhost:8080/xsd/relaties.xsd';
      :schemaPath := '/public/relaties.xsd';
    end;
    call dbms_xmlSchema.deleteSchema(:schemaURL,4)
    declare
      res boolean;
      xmlSchema xmlType := xmlType(
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xdb="http://xmlns.oracle.com/xdb"
                   elementFormDefault="unqualified"
                   attributeFormDefault="unqualified"
                   version="1.0">
         <xsd:element name="Relatie" xdb:defaultTable="">
              <xsd:complexType>
                   <xsd:sequence>
                        <xsd:element name="Voornaam" type="xsd:string"/>
                        <xsd:element name="Achternaam" type="xsd:string"/>
                        <xsd:element name="Tussenvoegsel" type="xsd:string"/>
                        <xsd:element name="Geboortedatum" type="xsd:date"/>
                        <xsd:element name="Geslacht">
                   <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                         <xsd:enumeration value="M"/>
                         <xsd:enumeration value="V"/>
                      </xsd:restriction>
                   </xsd:simpleType>
                </xsd:element>
                     <xsd:element name="Sofinummer">
                   <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                         <xsd:pattern value="\d{9}"/>
                      </xsd:restriction>
                   </xsd:simpleType>
                </xsd:element>
                        <xsd:element name="Straatnaam" type="xsd:string"/>
                        <xsd:element name="Huisnummer" type="xsd:string"/>
                        <xsd:element name="Woonplaats" type="xsd:string"/>
                        <!--xsd:element name="Postcode" type="xsd:string"/-->
                        <xsd:element name="Postcode">
                   <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                         <xsd:pattern value="\d{4} [A-Z]{2}"/>
                      </xsd:restriction>
                   </xsd:simpleType>
                </xsd:element>
                        <xsd:element name="Zrn">
                   <xsd:simpleType>
                      <xsd:restriction base="xsd:integer">
                         <xsd:minInclusive value="1000000"/>
                         <xsd:maxInclusive value="99999999999999"/>
                      </xsd:restriction>
                   </xsd:simpleType>
                </xsd:element>
                   </xsd:sequence>
              </xsd:complexType>
         </xsd:element>
    </xsd:schema>');
    begin
      if (dbms_xdb.existsResource(:schemaPath)) then
        dbms_xdb.deleteResource(:schemaPath);
      end if;
      res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    end;
    BEGIN
      DBMS_XMLSCHEMA.registerSchema(
        :schemaURL,
        XDBURIType(:schemaPath).getClob(),
        TRUE,
        FALSE,
        FALSE,
        TRUE);
    END;
    DROP TABLE relatie_documenten FORCE
    CREATE TABLE relatie_documenten OF XMLTYPE
           XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
           ELEMENT "Relatie"
    CREATE OR REPLACE TRIGGER upo_rdt_ai
    AFTER INSERT ON relatie_documenten
    FOR EACH ROW
    DECLARE
       doc XMLType;
    BEGIN
       doc := :new.SYS_NC_ROWINFO$;
       XMLType.schemaValidate(doc);
    END;
    INSERT
    INTO   relatie_documenten
    VALUES (XMLType
             ('<Relatie>
                  <Voornaam>Johan</Voornaam>
                  <Achternaam>Hermans</Achternaam>
                  <Tussenvoegsel/>
                  <Geboortedatum>1978-01-02</Geboortedatum>
                  <Geslacht>M</Geslacht>
                  <Sofinummer>233300417</Sofinummer>
                  <Straatnaam>Stationstraat</Straatnaam>
                  <Huisnummer>10</Huisnummer>
                  <Woonplaats>Weesp</Woonplaats>
                  <Postcode>1383 AK</Postcode>
                  <Zrn>1234567</Zrn>
               </Relatie>'
            ).CreateSchemaBasedXML(:schemaURL))
    commit
    INSERT
    INTO   relatie_documenten
    VALUES (XMLType
             ('<Relatie>
                  <Voornaam>Johanna</Voornaam>
                  <Achternaam>Gurts</Achternaam>
                  <Tussenvoegsel/>
                  <Geboortedatum>1975-11-12</Geboortedatum>
                  <Geslacht>V</Geslacht>
                  <Sofinummer>234109807</Sofinummer>
                  <Straatnaam>Stationstraat</Straatnaam>
                  <Huisnummer>10</Huisnummer>
                  <Woonplaats>Weesp</Woonplaats>
                  <Postcode>1383 AK</Postcode>
                  <Zrn>7654321</Zrn>
               </Relatie>').CreateSchemaBasedXML(:schemaURL))
    commit
    INSERT
    INTO   relatie_documenten
    VALUES (XMLType
             ('<Relatie>
                  <Voornaam>Johanna</Voornaam>
                  <Achternaam>Gurts</Achternaam>
                  <Tussenvoegsel/>
                  <Geboortedatum>1975-11-12</Geboortedatum>
                  <Geslacht>O</Geslacht>
                  <Sofinummer>234109807</Sofinummer>
                  <Straatnaam>Stationstraat</Straatnaam>
                  <Huisnummer>10</Huisnummer>
                  <Woonplaats>Weesp</Woonplaats>
                  <Postcode>1383 AK</Postcode>
                  <Zrn>7654321</Zrn>
               </Relatie>').CreateSchemaBasedXML(:schemaURL))
    commit
    declare
      xmlschema xmltype;
      res       boolean;
    begin
      select xdburitype(:schemaPath).getXML()
        into xmlSchema
        from dual;
      dbms_xdb.deleteResource(:schemaPath);
      select insertChildXML
               xmlschema,
               '/xsd:schema//xsd:element[@name="Geslacht"]/xsd:simpleType/xsd:restriction',
               'xsd:enumeration',
               xmltype('<xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>'),
               'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
      into xmlSchema
      from dual;
      res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    end;
    commit
    set long 100000 pages 200 lines 140
    select xdburitype(:schemaPath).getXML()
      from dual
    DROP TABLE RELATIE_DOCUMENTEN_TEMP
    BEGIN
      DBMS_XMLSCHEMA.copyEvolve
        ( schemaURLs      => xdb$string_list_t(:schemaURL)
        , newSchemas      => XMLSequenceType(XDBURIType(:schemaPath).getXML())
        , preserveOldDocs => TRUE
        , mapTabName      => 'RELATIE_DOCUMENTEN_TEMP'
        , generateTables  => FALSE
    END;
    CREATE TABLE relatie_documenten OF XMLTYPE
           XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
           ELEMENT "Relatie"
    CREATE OR REPLACE TRIGGER upo_rdt_ai
    AFTER INSERT ON relatie_documenten
    FOR EACH ROW
    DECLARE
       doc XMLType;
    BEGIN
       doc := :new.SYS_NC_ROWINFO$;
       XMLType.schemaValidate(doc);
    END;
    declare
      tablename varchar2(2000);
    begin
      select temp_tabname
        into tablename
        from RELATIE_DOCUMENTEN_TEMP
       where table_name = USER || '.' || upper('relatie_documenten');
      execute immediate 'insert into relatie_documenten select xmltype(data) from ' || tablename;
      commit;
    end;
    select *
      from relatie_documenten
    INSERT
    INTO   relatie_documenten
    VALUES (XMLType
             ('<Relatie>
                  <Voornaam>Johanna</Voornaam>
                  <Achternaam>Gurts</Achternaam>
                  <Tussenvoegsel/>
                  <Geboortedatum>1975-11-12</Geboortedatum>
                  <Geslacht>O</Geslacht>
                  <Sofinummer>234109807</Sofinummer>
                  <Straatnaam>Stationstraat</Straatnaam>
                  <Huisnummer>10</Huisnummer>
                  <Woonplaats>Weesp</Woonplaats>
                  <Postcode>1383 AK</Postcode>
                  <Zrn>7654321</Zrn>
               </Relatie>').CreateSchemaBasedXML(:schemaURL))
    commit
    select *
      from relatie_documenten
    /

  • How to create xsd's for each table in repository instead of entire repos

    Hi Gurus,
    Is there any way i could create xsd's for each table in the repository separately instead of creating single xsd file from "Export repository schema" option which creates a single xml file for the entire repository.I need to create xsd for each table in repository...
    Any Help greatly appreciated
    Thanks
    Aravind

    Open the Lookup table you want the XSD for, in Data manger
    Export it to access.( You can select all the fields you want to export to access and then check option "open Access after export")
    Now in Access, again right click the table and export it to XML.
    Provided you have .NET frame work installed on the machine where you are doing this export, you can do the following:
    Use XSD.exe from command prompt and get the XSD.
    Use the following link as a reference for XSD stuff.
    http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.71).aspx
    (OR)
    Get the whole XML of the repository and distill the whole structure for Lookups and create XSD using any standard XML editor.

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to Create a Table Component Dynamically based on the Need

    Hello all,
    I have a problem i need to create dynamically tables based on the no of records in the database. How can i create the table object using java code.
    Please help.

    Winston's blog will probably be helpful:
    How to create a table component dynamically:
    http://blogs.sun.com/roller/page/winston?entry=creating_dynamic_table
    Adding components to a dynamically created table
    http://blogs.sun.com/roller/page/winston?entry=dynamic_button_table
    Lark
    Creator Team

  • How can I create a table in other's schema?

    I have two users say 'user1' and 'sanju' along with other users in the database.Both the users are granted a connect role. I have connected as a 'sanju' user. Now I want to create a table in schema 'user1'.
    Please note that user 'sanju' should not be allowed to create table in any other user's schema.
    I have set the current schema of 'sanju' as 'user1'.
    ALTER SESSION SET CURRENT_SCHEMA=USER1
    I know that 'grant create ANY table to sanju' will allow 'sanju' to create table in all the schema. I dont want that. Is there any way to create a table in any other's schema?
    Please answer ASAP

    This is not directly possible, but you can use following workaround:
    connect user1/passwd
    create or replace procedure testCreateTable as
    begin
    execute immediate 'create table user1.testTable(c char)';
    end test;
    grant execute on testCreateTable to sanju;
    connect sanju/passwd
    execute testCreateTable
    Of course, you can make this procedure more generic by specifying the necessary parameter.
    Please not that this procedure only works, if user1 was granted the create table privilege directly, and not through a role (e.g. dba), because roles are disabled when executing

  • Creating a table based on Category and Sub-Categories

    Hi
    I am building an extensive home budget. I have 3 tables showing, monthly, quarterly and annual costs. These tables contain Categories and Sub-Categories. I have created a table and chart to show the percentage of the total costs for each Category. For the two Categories with the largest percentage of the total cost I would like to create a table (and chart, no problem, based on my first template) showing the breakdown of the Sub-Categories. However this information is to be retrieved from 3 tables, and I was hoping to create the table automatically. If not I must individually go to each different table and find the relevant Sub-Category and manually input the text and link the cell for the value to my new table. This gives room for error in my opinion and is a nuisance as my budget file now contains about 8 sheets so even on 27" iMac requires a considerable amount of scrolling around.
    Am I expecting too much of Numbers or missing something totally? I do not have much experience of spreadsheets, just basic tables and calculations in Excel before coming over from the Dark Side!
    Many thanks for any advice
    Shirley

    Hi Barry
    Many thanks for your reply and apologies for my delay in responding.
    Hope I am doing this photo embedding correctly via Flikr:
    Page 1
    I apologise also for my incorrect terminology - please bear with me on this, unfortunately I never used Excel much so terminology is pretty much my own . I believe that I have one sheet, which then changes into different numbers of pages depending on the page size I set, so with these examples 4 pages. 14 tables and one chart at this time
    The tables on the second screenshot were the only way I could figure out how to retrieve the data for the final table and chart (% Total Monthly Expenses)
    Now what I want to do is for each (or in fact the three largest) budget categories is to give a breakdown of what in that category is, percentage wise, costing the most. Preferably, I want to get this breakdown category information automatically so that human error is ruled out (that I cannot overlook an entry in the any of the tables in my first example). Perhaps I am asking too much, but I thought it was worth asking!
    Again many thanks for responding and for your help with this
    regards
    Shirley

  • ORA-01031: insufficient privileges when creating a table in other schema

    Dear all,
    I appreciate your help please in this issue :
    when i try to issue the below statement to create a table in an another schema than the user i am connected in
    CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
    SELECT *
    FROM HST
    WHERE 1 = 0;
    I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
    What other privileges should i grant also,
    Please if you have any idea.

    user562674 wrote:
    Dear all,
    I appreciate your help please in this issue :
    when i try to issue the below statement to create a table in an another schema than the user i am connected in
    CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
    SELECT *
    FROM HST
    WHERE 1 = 0;
    I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
    What other privileges should i grant also,
    Can you show us a cut/paste from the sql*plus of session of yours which should show that you have given the privilege directly to this user and after that the command fails?
    Aman....

  • How to create internal table dynamically based on a table entry

    hi Experts,
      I have table yprod_cat. It has product categories.
      In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
      For example:
      If the table has 3 entries for product category
      1. Board
      2. Micro
      3. Syst
    Then create three (3) internal tables.
    i_board
    i_micro
    i_syst
    How can we do this? Any sample code will be very usefull
    Thanks & Regards
    Gopal
    Moderator Message: No sample codes can be given. Please search for them or work it!
    Edited by: kishan P on Jan 19, 2011 4:22 PM

    Our APEX version is 4.2We are using below SQL query to display radio groups dynamically..
    SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
    FROM dept
    ORDER BY 1;
    Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
    Below is the output of the query..
    <input type="radio" name="f01" value="10" />ACCOUNTING
    <input type="radio" name="f01" value="20" checked="checked" />RESEARCH
    <input type="radio" name="f01" value="30" />SALES
    <input type="radio" name="f01" value="40" />OPERATIONS
    >
    If Tabular Form:
    Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
    If normal Page Item:
    Edit Page Item > Security > Escape special characters=No.
    Pl read the help on that page item to understand the security risk associated with =NO.
    Cheers,
    Edited by: Prabodh on Dec 3, 2012 5:59 PM

  • Creating multiple tables based on existing tables

    Hi,
    I have to create 60 tables based on existing 60 tables. Instead of creating one by one how can I create all 60 at once.
    The current 60 tables are named FY11_ACC1, FY11_ACC2, FY11_SALES1, FY11_SALES2 ...... , but all 60 tables start with FY11. I need to create the same structured tables but with FY12 names like FY12_ACC1, FY12_ACC2, FY12_SALES1, FY12_SALES2 .....
    Currently I am using "create table FY12_ACC1 as select * from FY11_ACC1 where 1=0". Is there a way I can write all of them in one query?
    Thanks for your time and help.

    ssk1974 wrote:
    Hi,
    I have to create 60 tables based on existing 60 tables. Instead of creating one by one how can I create all 60 at once.
    The current 60 tables are named FY11_ACC1, FY11_ACC2, FY11_SALES1, FY11_SALES2 ...... , but all 60 tables start with FY11. I need to create the same structured tables but with FY12 names like FY12_ACC1, FY12_ACC2, FY12_SALES1, FY12_SALES2 .....
    Currently I am using "create table FY12_ACC1 as select * from FY11_ACC1 where 1=0". Is there a way I can write all of them in one query?
    Thanks for your time and help.Well, i'm assuming FY = Fiscal Year and 11 = 2011 and then ACC1 = Account #1.
    From the sounds of things, your design isn't likely "correct'.
    If you'd care to delve in to the requirements a little bit ... what you have and what you need (business speak wise) there are no shortage of experts here that i'm sure would be happy to help you.
    If you're stuck with what you've got (or don't care to change your 'design') and all you care about is achieving that please disregard this message.

  • How to create dynamic table using POJO based DataControl

    Hi,
    I'm using JDeveloper 11.1.1.5.0. I'm not using ADF BC.
    I've a requirement to display the Dynamic table in my search page.
    In our product we are using POJO based Data controls.
    I created a task-flow and page fragment. I tried to create the dynamic table by drag-drop of searchResults from my Data control, I see the option for Read-Only Dynamic Table, but when I select this option, I don't see anything happening.
    Does the Dynamic Table work with POJO data controls?
    Any inputs would be helpful.
    Thanks
    Ravi

    First U have to crate Extended View Object to your actual View obj.
    Now take Page with Panel  Splitter ,on First facet drag View obj as table and on second Facet Drag Extended View Obj as table.On page loading U have delete all rows from Extended View object.And then u have write bean code on button click to get current select rows from above view objct,and for Filter rows from Second View obj according to selection of rows from first view obj...

  • Script task to read the column names dynamically and create a table in database based on excel column structure

    Hello,
    Can anyone help me out to write a vb.net script.
    I need to read the column names from excel and based on that column names I need to create a table in database(I have more than one sheet in excel).
    For each sheet columns will be changing and should create a table dynamically for each sheet.
    Any help would be appreciated.

    Refer the below script to read columns in each sheet.
    Dim excelfile As String = Dts.Variables("ExcelPath").Value.ToString
    Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + excelfile + ";Extended Properties=Excel 8.0"
    Dim oledbcon As New OleDb.OleDbConnection(connectionstring)
    oledbcon.Open()
    Dim dt As DataTable
    Dim schemaTable As DataTable
    Dim OLEDBCMD As New OleDb.OleDbCommand
    Dim oledbdatareader As OleDb.OleDbDataReader
    Dim columns As String = ""
    dt = oledbcon.GetSchema("Tables")
    Dim TABCOMMAND(20) As String
    Dim TABCOUNT As Integer = 0
    For Each row As DataRow In dt.Rows
    TABCOMMAND(TABCOUNT) = "SELECT * FROM [" & row.Item("TABLE_NAME").ToString & "]"
    OLEDBCMD.CommandText = TABCOMMAND(TABCOUNT)
    OLEDBCMD.Connection = oledbcon
    oledbdatareader = OLEDBCMD.ExecuteReader(CommandBehavior.KeyInfo)
    schemaTable = oledbdatareader.GetSchemaTable()
    For Each myfield As DataRow In schemaTable.Rows
    For Each myproperty As DataColumn In schemaTable.Columns
    If myproperty.ColumnName = "ColumnName" Then
    columns = columns & myfield(myproperty).ToString & ","
    MsgBox(myfield(myproperty).ToString)
    End If
    Next
    Next
    oledbdatareader.Close()
    OLEDBCMD.Dispose()
    Next
    oledbcon.Close()
    Regards, RSingh

  • Best way to create a table based on another table

    Hello,
    I am trying to create a table based on another table with all the data in it. It has large data.
    create table <tablename> as select * from table1.
    Is this the best way of doing it or is there any other way. please advice.
    thanks

    I am suggested to create new table as
    create table <newtable> as
    select * from <oldtable> where rownum < 1;
    then
    alter table <newtable> compress;
    then
    insert /*+ append */ into <newtable> as select * from <oldtable>;
    but i getting an error saying missing values key words ora- 00926.
    please advice

  • Creating a table structure using xsd file or excel?

    Hi,
    How to create a table structure of the xsd file or excel file generated from access 2000?
    Do you have any ideas or do you know any useful tools for this?

    Yes. This possible with ADF Faces RC, which provides an af:tree component. Have a look at the Fusion Order Demo, which uses the tree to implement a similar usecase to the one you describe.
    http://www.oracle.com/technology/products/jdev/samples/fod/index.html
    Regards,
    RiC

  • Create a table which has columns from another table in other schema

    Hi All
    I need to create a table which is table driven i.e., the columns of that table need to be inserted from another table in a different schema...Can any one help me with this??

    create table newtab (--column spec here--) as
    Select --columns here-- from otherschema.tablename;max

Maybe you are looking for