Re: newbie "table create" question..

From: Adam Hapworth <hap_at_mikomi.org>
Date: 10 Oct 2001 10:25:42 -0700
Message-ID: <a6cb04db.0110100925.205b2a06_at_posting.google.com>


I know what you mean I just moved over form MySql as well. I will try to translate as best as I can. I will put optional values in "" and not nessecary items in []

create table calllog(

      id number("n") not null constraint "calllog_id_pk" primary key,
      comp_id number(5),
      when date,
      who varchar2(30),
      log_entry varchar2(255)
      );

There is no auto increment in oracle but you can build a sequence which will do the same thing.
syntax:
create sequence "sequence_name"

       incement by "1"
       start with "0"
       [maxvalue "100"]
       nocache
       no cycle;

when you do an insert you would use "sequence_name".nextval for the id. This would give you the nex number in the sequence.

hope that helps

Adam Hapworth

"Michael L. Hostbaek" <michDEL_THIS_at_bsd.fr.eu.org> wrote in message news:<slrn9s8mt8.309u.michDEL_THIS_at_freebsdcluster.dk>...
> Hello,
>
> I have been using postgres / mysql for quite a while. And I am fairly
> comfortable working with sql. However when wanting to create a new table
> in a Oracle 8i db, I was quite surpirised.
>
> Basically, I would like to add a table, which should store a customer
> call log. In mysql compatible sql my create table query would look
> something like this:
>
> create table calllog("id int not null auto_increment primary key,
> comp_id int(5), when date, who varchar(30), log-entry text")
>
> Could someone, please be so kind as to explain how to translate that
> into something Oracle will understand.
>
> Thanks in advance,
Received on Wed Oct 10 2001 - 19:25:42 CEST

Original text of this message