Aan
Aan

Reputation: 12890

SQL statement error in Oracle SQL Developer

When I try to execute the SQL statment below in Oracle SQL Developer:

CREATE TABLE Nrom1Tab ( Sig TEXT NOT NULL PRIMARY KEY, 
   DocSubject TEXT,  
   DocClassification TEXT,  
   DepName VARCHAR, 
   OrgName TEXT,  
   FromInf  TEXT,   
   ToInf TEXT,    
   DateInf TEXT, 
   NoteInf TEXT );

It shows this error:

enter image description here

Upvotes: 0

Views: 661

Answers (4)

Dan
Dan

Reputation: 5231

I believe the error complaining about missing a left parenthesis, is angry that VARCHAR doesn't have a length defined. The error references column 113, which would be where the left parenthesis should be, the 114th character on that line.

Justin also correctly points out TEXT is not a valid datatype. While I don't think that is causing the error you're seeing, it'll be an error very soon :)

Upvotes: 2

Justin Cave
Justin Cave

Reputation: 231651

I'm not sure what the error message is, however

  1. TEXT is not a valid data type in Oracle.
  2. VARCHAR is a valid data type but you would need to specify the length (i.e. VARCHAR(10)) would allow up to 10 bytes of storage (assuming a default NLS_LENGTH_SEMANTICS of BYTE). It would generally be preferred to use the VARCHAR2 data type rather than VARCHAR as well.

Upvotes: 5

Mithrandir
Mithrandir

Reputation: 25337

CREATE TABLE Nrom1Tab 
( 
    Sig TEXT PRIMARY KEY, DocSubject TEXT,  DocClassification TEXT,  
    DepName VARCHAR(100), -- Missing LENGTH
    OrgName TEXT,  FromInf  TEXT,   ToInf TEXT,   DateInf TEXT, NoteInf TEXT );

Upvotes: 1

Joseph
Joseph

Reputation: 5160

I believe you have to give VARCHAR an amount like VARCHAR(50).

Upvotes: 1

Related Questions