Results 1 to 5 of 5

Thread: Table Creation?

  1. #1
    Join Date
    May 2004
    Posts
    12

    Question Unanswered: 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.

  2. #2
    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.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    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

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    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.

  5. #5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •