3 Replies Latest reply: Jan 31, 2013 10:48 AM by EdStevens RSS

    error in datatype

    987899
      hello,

      i have an error in the type number, the syntax is correct, but i got an error !

      the table creation code:

      create table PRODUIT
      *( NumProd number(7),*
      Designation  VARCHAR2(30) not null,
      Description  VARCHAR2(200),
      Prix  number(11,2),
      QteStock  number(9),
      constraint pk_NumProd primary key(NumProd)
      *);*

      and this is the error code:

      *( NumProd number (7),*
      ***
      ERROR at line 2:
      ORA-00902: invalid datatype

      thank's.
        • 1. Re: error in datatype
          AlbertoFaenza
          Hi,

          just copied pasted your text. I could not find anything wrong:
          SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 31 17:32:14 2013
          
          Copyright (c) 1982, 2010, Oracle.  All rights reserved.
          
          
          Connected to:
          Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
          With the Partitioning, OLAP, Data Mining and Real Application Testing options
          
          SQL> set serveroutput on
          SQL>
          SQL> create table PRODUIT
            2  ( NumProd number(7),
            3  Designation  VARCHAR2(30) not null,
            4  Description  VARCHAR2(200),
            5  Prix  number(11,2),
            6  QteStock  number(9),
            7  constraint pk_NumProd primary key(NumProd)
            8  );
          
          Table created.
          
          SQL>
          When you put some code or output please enclose it between two lines starting with {noformat}
          {noformat}
          
          i.e.:
          {noformat}
          {noformat}
          SELECT ...
          {noformat}
          {noformat}
          
          Regards.
          Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
          • 2. Re: error in datatype
            987899
            thank you, setserveroutput solved the problem
            • 3. Re: error in datatype
              EdStevens
              984896 wrote:
              hello,

              i have an error in the type number, the syntax is correct, but i got an error !

              the table creation code:

              create table PRODUIT
              *( NumProd number(7),*
              Designation  VARCHAR2(30) not null,
              Description  VARCHAR2(200),
              Prix  number(11,2),
              QteStock  number(9),
              constraint pk_NumProd primary key(NumProd)
              *);*

              and this is the error code:

              *( NumProd number (7),*
              ***
              ERROR at line 2:
              ORA-00902: invalid datatype

              thank's.
              Aside from your question, let me strongly suggest you lose that mixed case notation of your table and column names. If you don't enclose them in double quotes, oracle is going to store them as upper-case anyway. And if you DO enclose them in double-quotes, thus forcing oracle to store them in mixed case, you will always have to enclose the references to them in double-quotes. Oracle defaults to upper case. Life will be easier if you learn to embrace it. It doesn't mean you have to key them in upper case. That is exactly the point. If you don't enclose them, oracle will internally convert to upper case, both in the definition and in future references. And since that is the behavior you are going to get, coding them in mixed-case is just silly and mis-leading.