From: | Kevin Hunter <hunteke(at)earlham(dot)edu> |
---|---|
To: | altudela(at)gmail(dot)com |
Cc: | PostgreSQL General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: "oracle to postgresql" conversion |
Date: | 2007-03-08 16:40:21 |
Message-ID: | 45F03C75.60006@earlham.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 06 Mar 2007 at 9:01a -0800, g.c[ altudela ] wrote:
> I'm a newbie in Oracle and postgreSQL,
> i'm need to translate the following script (in Oracle) to postgreSQL :
>
> rem Autorisation des lignes vides :
> set sqlbl on
>
> rem Initialisation du timer :
> set timing on
>
> rem Creation de la table :
>
> CREATE TABLE "LEPAPE"."EXPERIENCE"(
> "EXP_ID" VARCHAR2(16) NOT NULL,
> "MEASURE" VARCHAR2(10) NOT NULL,
> "THRESHOLD" NUMBER NOT NULL,
> "NB_NODES" NUMBER(3) NOT NULL,
> "TOTAL_TIME" VARCHAR2(10) NOT NULL,
> "SC_ID" NUMBER(6) NOT NULL,
> "GRANULARITY" VARCHAR2(10) NOT NULL,
>
> CONSTRAINT "SYS_C009967" CHECK(measure in ('age', 'num','order')))
I believe rem translates to '-- ' (the extra space is important)
set translates to '\set'
I do not know what the setting 'sqlbl' does in Oracle.
I'm not entirely sure about the owner bit, specified by "LEPAPE"."..."
The various data types translate to (likely) more standards compliant
names, which you can peruse at
http://www.postgresql.org/docs/8.2/static/datatype.html
(Replace 8.2 with your major version of PostgreSQL.)
Someone may correct me, but I believe that Postgres is not case
sensitive in (terms of column and constraint names) unless you create
them with quotes. Thus, you could just as easily write
"EXP_ID" VARCHAR2(16) NOT NULL,
as
exp_id VARCHAR(16) NOT NULL
which would be my personal preference as I like to capitalize SQL
keywords and leave everything as lower case. (Makes for easier reading
later.)
Kevin
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2007-03-08 17:16:00 | Re: Tabulate data incrementally |
Previous Message | Omar Eljumaily | 2007-03-08 16:40:06 | Re: Tabulate data incrementally |