Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Not creating table, just displays code

Posted on 2009-07-08
5
Medium Priority
?
174 Views
Last Modified: 2012-05-07
When I enter this is doesn't create the table, it just displays all lines of the code.
I am running @create_table_ship_address
which is the .txt .sql file

I have created tables this way before, can anyone tell what's wrong!?
Thanks!
CREATE TABLE SHIPPING                           
  ( CUSTOMER_SHIP_ID (8,0) NOT NULL  
  , CUSTOMER_NO NUMBER(8,0) NOT NULL
  , CUSTOMER_SHIP_TYPE CHAR(1)
  , DATE_ADDED DATE
  , DATE MODIFIED DATE
  , ADDRESS_1_SHIP VARCHAR2(50)
  , ADDRESS_2_SHIP VARCHAR2(50)
  , CITY_SHIP VARCHAR2(30)
  , STATE_SHIP VARCHAR2(20)
  , ZIPCODE_SHIP NUMBER(5,0)
  , COUNTRY_SHIP VARCHAR2(30)
  , CONSTRAINT SHIPPING_PK PRIMARY KEY(CUSTOMER_SHIP_ID)           
  , CONSTRAINT CUST_SH_TYPE CHECK (CUSTOMER_SHIP_TYPE IN ('W', 'M', 'D', 'O'))
  , CONSTRAINT SHIPPING_FK     FOREIGN KEY (CUSTOMER_NO)  
  , REFERENCES CUSTOMER(CUSTOMER_NO)) 
  , ON DELETE CASCADE
  , ON UPDATE CASCADE)
                                        
;

Open in new window

0
Comment
Question by:ba_trainer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 32

Expert Comment

by:awking00
ID: 24805871
Are you running this from sqlplus? What is the exact filename? If it has more than one extension or an extension other than ".sql" you need to use the entire filename and path. For example,
SQL> @c:\create_table_shipp_address.txt.sql
0
 
LVL 3

Expert Comment

by:rjbook
ID: 24805872
I think maybe you need to remove the comas in front of the constraints.
0
 
LVL 32

Expert Comment

by:awking00
ID: 24805898
By the way, you still need to change "CUSTOMER_SHIP_ID (8,0) NOT NULL" to "CUSTOMER_SHIP_ID NUMBER(8,0) NOT NULL"
0
 

Author Comment

by:ba_trainer
ID: 24805988


This is what I'm getting back from SQL PLUS
does this make sense?
Usually it just creates the table...
SQL> @create_table_ship_address.sql
  1  CREATE TABLE SHIPPING
  2    ( CUSTOMER_SHIP_ID NUMBER(8,0) NOT NULL
  3    , CUSTOMER_NO NUMBER(8,0) NOT NULL
  4    , CUSTOMER_SHIP_TYPE CHAR(1)
  5    , DATE_ADDED DATE
  6    , DATE MODIFIED DATE
  7    , ADDRESS_1_SHIP VARCHAR2(50)
  8    , ADDRESS_2_SHIP VARCHAR2(50)
  9    , CITY_SHIP VARCHAR2(30)
 10    , STATE_SHIP VARCHAR2(20)
 11    , ZIPCODE_SHIP NUMBER(5,0)
 12    , COUNTRY_SHIP VARCHAR2(30)
 13    , CONSTRAINT SHIPPING_PK PRIMARY KEY(CUSTOMER_SHIP_ID)
 14    , CONSTRAINT CUST_SH_TYPE CHECK (CUSTOMER_SHIP_TYPE IN ('W', 'M', 'D', 'O'))
 15    , CONSTRAINT SHIPPING_FK     FOREIGN KEY (CUSTOMER_NO)
 16    , REFERENCES CUSTOMER(CUSTOMER_NO))
 17      ON DELETE CASCADE
 18*     ON UPDATE CASCADE)

Open in new window

0
 
LVL 32

Accepted Solution

by:
awking00 earned 2000 total points
ID: 24806325
Where does the file reside? Is it on your local machine or a unix directory or where? How are you accessing sqlplus? Again, does the filename really end in ".sql" or is there a hidden ".txt" that follows? I have experienced this problem before when writing the code in notepad and saving it without select All Files in the save as type: box and it defaults to a .txt file.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question