Re: "oracle to postgresql" conversion - Mailing list pgsql-general

From Kevin Hunter
Subject Re: "oracle to postgresql" conversion
Date
Msg-id 45F03C75.60006@earlham.edu
Whole thread Raw
In response to "oracle to postgresql" conversion  (altudela@gmail.com)
Responses Re: "oracle to postgresql" conversion  (Jan de Visser <jdevisser@digitalfairway.com>)
Re: "oracle to postgresql" conversion  (Shane Ambler <pgsql@Sheeky.Biz>)
List 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


pgsql-general by date:

Previous
From: Omar Eljumaily
Date:
Subject: Re: Tabulate data incrementally
Next
From: Rikard Pavelic
Date:
Subject: security permissions for functions