If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Table Creation?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-13-04, 23:09
omega omega is offline
Registered User
 
Join Date: May 2004
Posts: 12
Question Table Creation?

Hi there I need to create a Table that will allow me to input

using

insert into booking values(bookings.NEXTVAL,'Chung Gon','(08) 8983 1840','S',
'27-MAY-04',5,'Baby bassinet');

I've created the table below

Create Table booking
(Name CHAR(20),
Phone VARCHAR(20),
RoomType VARCHAR(2),
BookingDate Date,
NightsStaying VARCHAR(20),
REQUIREMENTS CHAR(20));

And when I use the Insert command I get to many values any suggestions on how to fix this? (Fairly new to SQL and Oracle)

Thx.
Reply With Quote
  #2 (permalink)  
Old 05-14-04, 00:40
derrickleggett derrickleggett is offline
Registered User
 
Join Date: Apr 2004
Location: Kansas City, MO
Posts: 734
what's the bookings.NEXTVAL for??? You shouldn't need that.

Maybe you need to create the table like this:

Whatever it is, you need to create a column for it. There is no such function in SQL Server though.
__________________
MeanOldDBA
derrickleggett@hotmail.com
When life gives you a lemon, fire the DBA.
Reply With Quote
  #3 (permalink)  
Old 05-14-04, 08:54
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Quote:
Originally Posted by derrickleggett
what's the bookings.NEXTVAL for??? You shouldn't need that.
NEXTVAL is an Oracle thing, which is the database engine that Omega is using. It roughly corresponds to an IDENTITY function (not column) in MS-SQL.

The problem appears to be that there are six columns listed in the table, but there are seven values in the SELECT list. Oracle has a tough time figuring out what omega really wants to do!

-PatP
Reply With Quote
  #4 (permalink)  
Old 05-17-04, 03:24
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
bookings.NEXTVAL comes from a sequence. So, your code should be something like:
Code:
> CREATE SEQUENCE bookings;
> CREATE TABLE booking
   (ID NUMBER,		  -- you'll put seq. value into it
	Name CHAR(20),
	Phone VARCHAR(20), 
	RoomType VARCHAR(2),
	BookingDate Date,
	NightsStaying VARCHAR(20),
	requirements CHAR(20)
   );
Your INSERT statement should now work properly.
Reply With Quote
  #5 (permalink)  
Old 05-17-04, 10:33
wharish wharish is offline
Registered User
 
Join Date: May 2004
Posts: 2
Try......


insert into booking values('Chung Gon','(08) 8983 1840','S',
'27-MAY-04',5,'Baby bassinet');

as your create table descrptions has 6 cols only.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On