<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/styles/XMLStylesDoc_xhtml11_en.xsl"?><!DOCTYPE document SYSTEM "/schemas/XMLStyles10.dtd">
<document xmlns="http://XMLStyles.com/namespaces/styles" xmlns:xst="http://XMLStyles.com/namespaces/styles" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:date="http://exslt.org/dates-and-times">
   <noxml>
      <p xmlns="http://www.w3.org/1999/xhtml"/>
      <!-- You are viewing the source.  The following message should be ignored if you did "View Source" in your browser. -->
      <p xmlns="http://www.w3.org/1999/xhtml">
ATTENTION: XML WEB PAGES NOT SUPPORTED
   If you see this message, your current browser does not support the
   1999 XSLT 1.0 (or later) standard for XML web pages such as this one.
   Please upgrade your browser to a newer version
   that supports 1999 or later standards such as:
      Mozilla Firefox version 1.0.2 or later (GetFirefox -&gt; http://www.GetFirefox.com/)
      Netscape version 8 or later
      Safari version 1.3 or later
      Opera version 9 or later
      Microsoft Internet Explorer (MSIE) version 5 or later
   For further assistance, contact the software vendor for your browser.
   To go to the X<!-- extended HTML -->HTML version of this page click the following link:
<a href="index.html">index.html</a>
      </p>
      <p xmlns="http://www.w3.org/1999/xhtml">&#160;</p>
   </noxml>
   <path>/computers/databases/oracle/</path>
   <site>How To Guides</site>
   <logo xlink:type="simple" xlink:href="/images/howtohome.jpg" media="screen" width="240" height="34">How To Guides</logo>
   <logo xlink:type="simple" xlink:href="/images/howtoguides.jpg" media="print" width="240" height="34">How To Guides</logo>
   <logo xlink:type="simple" xlink:href="/images/howtoguidesmobile.jpg" media="handheld" width="150" height="17">How To Guides</logo>
   <navigation where="sections">
      <label>How To Guides</label>
      <link xlink:type="simple" xlink:href="/business/index.xml">Business</link>
      <link xlink:type="simple" xlink:href="/computers/index.xml">Computers</link>
      <link xlink:type="simple" xlink:href="/computers/databases/index.xml">Databases</link>
      <link xlink:type="simple" xlink:href="/internet/index.xml">Internet</link>
      <link xlink:type="simple" xlink:href="/mobile/index.xml">Mobile</link>
      <link xlink:type="simple" xlink:href="/money/index.xml">Money</link>
      <link xlink:type="simple" xlink:href="/movies/index.xml">Movies</link>
      <link xlink:type="simple" xlink:href="/computers/os/index.xml">Operating Systems</link>
   </navigation>
   <navigation where="up">
      <link xlink:type="simple" xlink:href="../../">Computers</link>
      <link xlink:type="simple" xlink:href="../">Databases</link>
   </navigation>
   <navigation where="subsections">
      <link xlink:type="simple" xlink:href="/computers/databases/design.xml">Design</link>
      <link xlink:type="simple" xlink:href="/computers/databases/tuning.xml">Tuning</link>
      <link xlink:type="simple" xlink:href="/computers/databases/derby/">Apache Derby</link>
      <link xlink:type="simple" xlink:href="/computers/databases/ibmdb2/">IBM DB2</link>
      <link xlink:type="simple" xlink:href="/computers/databases/mysql/">MySQL</link>
      <link xlink:type="simple" xlink:href="index.xml">Oracle</link>
      <link xlink:type="simple" xlink:href="/computers/databases/sqlserver/">SQL Server</link>
   </navigation>
   <section id="body" type="body">
      <pages id="oracleddl" name="oracleddl">
         <title>Oracle DDL</title>
         <label>DDL</label>
         <description>Examples of how to use Oracle SQL Data Description Language.</description>
         <navigation where="pages">
            <label>DDL</label>
            <link xlink:type="simple" xlink:href="oracleddl.xml">SQL</link>
            <link xlink:type="simple" xlink:href="crttsp.xml">Create Tablespace</link>
            <link xlink:type="simple" xlink:href="dropdf.xml">Drop DataFile</link>
            <link xlink:type="simple" xlink:href="crtschema.xml">Create Schema</link>
            <link xlink:type="simple" xlink:href="crtuser.xml">Create User</link>
            <link xlink:type="simple" xlink:href="crtrole.xml">Create Role</link>
            <link xlink:type="simple" xlink:href="crtseq.xml">Create Sequence</link>
            <link xlink:type="simple" xlink:href="crttbl.xml">Create Table</link>
         </navigation>
         <navigation where="up">
            <link xlink:type="simple" xlink:href="index.xml">Oracle</link>
         </navigation>
         <h1>Oracle DDL</h1>
         <page id="N1020E" name="crttbl">
            <title>Create Table</title>
            <label>Create Table</label>
            <subpage id="N10214" name="crttbl">
               <blockcode>
                  <l>define schema='<i>schema_name</i>'</l>
                  <l>create table &amp;schema..<i>tblname</i> (</l>
                  <l>   <i>col1name</i> number constraint <i>tblname</i>_1_nn not null,</l>
                  <l>   <i>col2name</i> char(<i>n</i>) constraint <i>tblname</i>_2_nn not null,</l>
                  <l>   <i>col3name</i> varchar2(<i>n</i>) constraint <i>tblname</i>_3_nn not null,</l>
                  <l>   constraint <i>tblname</i>_0_pk</l>
                  <l>      primary key (<i>col1name</i>)</l>
                  <l>      using index tablespace <i>index_tspname</i>​</l>
                  <l>         pctfree    5</l>
                  <l>         initrans   1</l>
                  <l>         maxtrans 255</l>
                  <l>         storage (</l>
                  <l>            initial 1k</l>
                  <l>            minextents 1</l>
                  <l>            maxextents unlimited</l>
                  <l>         )</l>
                  <l>)</l>
                  <l>tablespace <i>data_tspname</i>​</l>
                  <l>   pctfree    5</l>
                  <l>   initrans   1</l>
                  <l>   maxtrans 255</l>
                  <l>   storage (</l>
                  <l>      initial 4k</l>
                  <l>      minextents 1</l>
                  <l>      maxextents unlimited</l>
                  <l>   );</l>
                  <l>grant select, insert, update, delete</l>
                  <l>   on &amp;schema..<i>tblname</i>​</l>
                  <l>   to <i>rolename1</i>,</l>
                  <l>      <i>rolename2</i>;</l>
               </blockcode>
            </subpage>
            <p>Oracle stores columns of CHAR type with a length field, the same as for variable length columns,
               so unlike other <acronym term="Database Management Systems">DBMSes</acronym>,
               there is no advantage in space usage to using fixed-length CHAR rather than variable length.
               However, since comparison of fixed-length CHAR columns will provide for
               <link xlink:type="simple" xlink:href="/computers/databases/charvarchar1.xml">automatic padding</link>
               the data type of Oracle columns should be either
               <link xlink:type="simple" xlink:href="/computers/databases/charvarchar1.xml">CHAR or VARCHAR2</link>,
               as deemed appropriate for the data being stored in the column.
            </p>
            <updated local="2007-03-07">Wednesday March 7, 2007</updated>
         </page>
      </pages>
   </section>
   <copyright>Copyright © 2006 How To Guides .com. Alteration of content, including addition of any function such as hypertext links or pop-up advertising, or interference with the hypertext links or other functions of this site is expressly prohibited.</copyright>
   <disclaimer>All information, links, forms, applications and other items on this site or obtained from it are provided <b>AS IS</b>, WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</disclaimer>
   <ids urchin="UA-779578-2"/>
</document>

