3 Replies - 5672 Views - Last Post: 09 February 2013 - 05:22 PM

#1 debeth  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 07-July 08

Simple create table keeps saying invalid

Posted 09 February 2013 - 04:21 PM

I couldn't run this sql script from my techer so i thought i load it able by table however the error keeps geeting thrown back. I am using SSH via putty to connect with sqlplus:
 CREATE TABLE Day_dim
(
  Day_key		NUMBER 
, Date_str		VARchar2(11)
, Day_num		NUMBER(2) CHECK (Day_num BETWEEN 1 AND 31) 
, Month   		VARCHAR2(10)  
, Year			NUMBER(4) NOT NULL  
, Is_holiday	CHAR(1) CHECK (Is_holiday IN ('Y', 'N'))
, Is_Weekday	CHAR(1) CHECK (Is_weekday IN ('Y', 'N'))
, CONSTRAINT DayPK PRIMARY KEY (Day_key)
);



I keep getting
ERROR at line 4:
ORA-00902: invalid datatype
Date_str VARchar2(11)
i don't under stand why won't take this value. I have tried several ways

Is This A Good Question/Topic? 0
  • +

Replies To: Simple create table keeps saying invalid

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3224
  • View blog
  • Posts: 10,827
  • Joined: 12-December 12

Re: Simple create table keeps saying invalid

Posted 09 February 2013 - 04:35 PM

I've read that Oracle is not case-sensitive but try capitalizing: VARCHAR2
Was This Post Helpful? 0
  • +
  • -

#3 debeth  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 07-July 08

Re: Simple create table keeps saying invalid

Posted 09 February 2013 - 05:08 PM

SQL> CREATE TABLE Day_dim
2 (
3 Day_keyNUMBER
4 , Date_strVARchar2(11)
5 , Day_numNUMBER(2) CHECK (Day_num BETWEEN 1 AND 31)
6 , Month VARCHAR2(10)
7 , YearNUMBER(4) NOT NULL
8 , Is_holidayCHAR(1) CHECK (Is_holiday IN ('Y', 'N'))
9 , Is_WeekdayCHAR(1) CHECK (Is_weekday IN ('Y', 'N'))
10 , CONSTRAINT DayPK PRIMARY KEY (Day_key)
11 );
, Date_strVARchar2(11)
*
ERROR at line 4:
ORA-00902: invalid datatype

It was spacing. I don't understand copy and paste directly from the script. this was how it was apperaing in the interface so i put spaces in between the name and types it ran.. isn't that werid
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3224
  • View blog
  • Posts: 10,827
  • Joined: 12-December 12

Re: Simple create table keeps saying invalid

Posted 09 February 2013 - 05:22 PM

Perhaps you were using TABs instead of spaces and they were removed by your editor.

Personally, I don't bother trying to tabulate the display of a SQL statement, being able to split it over a number of lines is good enough for me :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1