Porting from ORACLE to PostgSQL

Started by gustavo halperinover 19 years ago16 messagesgeneral
Jump to latest
#1gustavo halperin
ggh.develop@gmail.com

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

Thank you, Gustavo

--
||\ // \
| \\ // |
I'm thinking. \ \\ l\\l_ // |
_ _ | \\/ `/ `.| |
/~\\ \ //~\ | Y | | || Y |
| \\ \ // | | \| | |\ / |
[ || || ] \ | o|o | > /
] Y || || Y [ \___\_--_ /_/__/
| \_|l,------.l|_/ | /.-\(____) /--.\
| >' `< | `--(______)----'
\ (/~`--____--'~\) / U// U / \
`-_>-__________-<_-' / \ / /|
/(_#(__)#_)\ ( .) / / ]
\___/__\___/ `.`' / [
/__`--'__\ |`-' |
/\(__,>-~~ __) | |__
/\//\\( `--~~ ) _l |--:.
'\/ <^\ /^> | ` ( < \\
_\ >-__-< /_ ,-\ ,-~~->. \ `:.___,/
(___\ /___) (____/ (____) `---'

#2Joshua D. Drake
jd@commandprompt.com
In reply to: gustavo halperin (#1)
Re: Porting from ORACLE to PostgSQL

gustavo halperin wrote:

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

Look at the orafce project on www.pgfoundry.org. They have ALOT of
Oracle types (over 100).

Sincerely,

Joshua D. Drake

Thank you, Gustavo

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

#3Chris Mair
chrisnospam@1006.org
In reply to: gustavo halperin (#1)
Re: Porting from ORACLE to PostgSQL

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

You might look into the contrib package "ora2pg".

There's also a more ambitious project called "protopg".
That's in pre-alpha state, though. A development snapshots
for the *very* *adventurous* can be obtained here:
http://protopg.projects.postgresql.org/nightlies/

Bye, Chris.

--

Chris Mair
http://www.1006.org

#4gustavo halperin
ggh.develop@gmail.com
In reply to: Chris Mair (#3)
Re: Porting from ORACLE to PostgSQL

Chris Mair wrote:

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

You might look into the contrib package "ora2pg".

There's also a more ambitious project called "protopg".
That's in pre-alpha state, though. A development snapshots
for the *very* *adventurous* can be obtained here:
http://protopg.projects.postgresql.org/nightlies/

Bye, Chris.

Thank you, but nothing work.
1. The orafce from www.pgfoundry.org doesn't pass the make step, is
looking for some files that doesn't exist, see below:
orafce : make
Makefile:16: ../../src/Makefile.global: No such file or directory
Makefile:17: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.

2. ora2pg, looks like something that extract DB schemes from a running
oracle DB, but I have not ORACLE running. I just have old ORACLE/SQL
sources that I need parser to SQL or PostgSQL.

3. About the ambitious project "protopg", I success to compile this
projects but the parser fall. The parse have a problem with a word
"CONSTRAINT", see below:
protopg-20060905 : ./ora_parser < tes.sql
-- syntax error, unexpected "CONSTRAINT", expecting ORA_ID on line 6 --

-- BEGIN OF UNRECOGNIZED STATEMENT
CREATE TABLE v5templates . cmt_items ( item_id NUMBER ( 7 ) ,
template_id NUMBER ( 7 ) , page_title VARCHAR2 ( 100 ) , CONSTRAINT
pk_cmt PRIMARY KEY ( item_id ) ) ;
-- END OF UNRECOGNIZED STATEMENT

I will try debug it, or maybe send a mail to the developer/contacts.

Any way, thank very much, Gustavo

--
||\ // \
| \\ // |
I'm thinking. \ \\ l\\l_ // |
_ _ | \\/ `/ `.| |
/~\\ \ //~\ | Y | | || Y |
| \\ \ // | | \| | |\ / |
[ || || ] \ | o|o | > /
] Y || || Y [ \___\_--_ /_/__/
| \_|l,------.l|_/ | /.-\(____) /--.\
| >' `< | `--(______)----'
\ (/~`--____--'~\) / U// U / \
`-_>-__________-<_-' / \ / /|
/(_#(__)#_)\ ( .) / / ]
\___/__\___/ `.`' / [
/__`--'__\ |`-' |
/\(__,>-~~ __) | |__
/\//\\( `--~~ ) _l |--:.
'\/ <^\ /^> | ` ( < \\
_\ >-__-< /_ ,-\ ,-~~->. \ `:.___,/
(___\ /___) (____/ (____) `---'

#5Merlin Moncure
mmoncure@gmail.com
In reply to: gustavo halperin (#4)
Re: Porting from ORACLE to PostgSQL

On 9/5/06, gustavo halperin <ggh.develop@gmail.com> wrote:

Chris Mair wrote:

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

don't the enterprisedb people specialize in oracle porting?

merlin

#6Joshua D. Drake
jd@commandprompt.com
In reply to: gustavo halperin (#4)
Re: Porting from ORACLE to PostgSQL

Bye, Chris.

Thank you, but nothing work.
1. The orafce from www.pgfoundry.org doesn't pass the make step, is
looking for some files that doesn't exist, see below:
orafce : make
Makefile:16: ../../src/Makefile.global: No such file or directory
Makefile:17: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.

It is designed to be built from the postgresql source tree. If you have
a postgresql source tree put the orafce directory in contrib and try again.

Sincerely,

Joshua D. Drake

2. ora2pg, looks like something that extract DB schemes from a running
oracle DB, but I have not ORACLE running. I just have old ORACLE/SQL
sources that I need parser to SQL or PostgSQL.

3. About the ambitious project "protopg", I success to compile this
projects but the parser fall. The parse have a problem with a word
"CONSTRAINT", see below:
protopg-20060905 : ./ora_parser < tes.sql
-- syntax error, unexpected "CONSTRAINT", expecting ORA_ID on line 6 --

-- BEGIN OF UNRECOGNIZED STATEMENT
CREATE TABLE v5templates . cmt_items ( item_id NUMBER ( 7 ) ,
template_id NUMBER ( 7 ) , page_title VARCHAR2 ( 100 ) , CONSTRAINT
pk_cmt PRIMARY KEY ( item_id ) ) ;
-- END OF UNRECOGNIZED STATEMENT

I will try debug it, or maybe send a mail to the developer/contacts.

Any way, thank very much, Gustavo

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

#7Chris Mair
chrisnospam@1006.org
In reply to: gustavo halperin (#4)
Re: Porting from ORACLE to PostgSQL

3. About the ambitious project "protopg", I success to compile this
projects but the parser fall. The parse have a problem with a word
"CONSTRAINT", see below:
protopg-20060905 : ./ora_parser < tes.sql
-- syntax error, unexpected "CONSTRAINT", expecting ORA_ID on line 6
--

-- BEGIN OF UNRECOGNIZED STATEMENT
CREATE TABLE v5templates . cmt_items ( item_id NUMBER ( 7 ) ,
template_id NUMBER ( 7 ) , page_title VARCHAR2 ( 100 ) , CONSTRAINT
pk_cmt PRIMARY KEY ( item_id ) ) ;
-- END OF UNRECOGNIZED STATEMENT

I will try debug it, or maybe send a mail to the developer/contacts.

That would be me ;)

Protopg knows only a small part of Oracle Syntax. It's origins are
a academic background were we had one sample DB and were looking
how far we got in translating that one. If you throw random Oracle
DBs at it, it will likely stumble over some pieces. Nonetheless it
might be partially helpful.

If you like it, subscribe to
http://pgfoundry.org/mailman/listinfo/protopg-developers

If nothing else, when we put out some prerelease, it would be
cool if you could help us testing it with your test case :)

Bye, Chris.

--

Chris Mair
http://www.1006.org

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: gustavo halperin (#4)
Re: Porting from ORACLE to PostgSQL

gustavo halperin <ggh.develop@gmail.com> writes:

1. The orafce from www.pgfoundry.org doesn't pass the make step, is
looking for some files that doesn't exist, see below:
orafce : make
Makefile:16: ../../src/Makefile.global: No such file or directory
Makefile:17: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.

It looks like it's expecting to be built inside the contrib directory of
a configured Postgres source tree. If you have a version that knows
about pgxs you can build it outside the source tree with

make USE_PGXS=1

regards, tom lane

#9codeWarrior
gpatnude@hotmail.com
In reply to: gustavo halperin (#1)
Re: Porting from ORACLE to PostgSQL

Perhaps you should look at EnterpriseDB -- It's an Oracle-compliant wrapper
for postgreSQL....

"gustavo halperin" <ggh.develop@gmail.com> wrote in message
news:44FCA0A7.5080100@gmail.com...

Show quoted text

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported in
PosgSQL like "number" or "varchar2", there fore, can I write some type of
declaration (like in c : #define alias_name name) in order to make PosgSQL
recognize these types? Or there are other solution that you recommend to
use ?

Thank you, Gustavo

--
||\ // \
| \\ // | I'm thinking.
\ \\ l\\l_ // |
_ _ | \\/ `/ `.| |
/~\\ \ //~\ | Y | | || Y |
| \\ \ // | | \| | |\ / |
[ || || ] \ | o|o | > /
] Y || || Y [ \___\_--_ /_/__/
| \_|l,------.l|_/ | /.-\(____) /--.\
| >' `< | `--(______)----'
\ (/~`--____--'~\) / U// U / \
`-_>-__________-<_-' / \ / /|
/(_#(__)#_)\ ( .) / / ]
\___/__\___/ `.`' / [
/__`--'__\ |`-' |
/\(__,>-~~ __) | |__
/\//\\( `--~~ ) _l |--:.
'\/ <^\ /^> | ` ( < \\
_\ >-__-< /_ ,-\ ,-~~->. \ `:.___,/
(___\ /___) (____/ (____) `---'

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

#10Ron Johnson
ron.l.johnson@cox.net
In reply to: codeWarrior (#9)
Re: Porting from ORACLE to PostgSQL

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eliminating 21 line .signatures would be nice, too.

codeWarrior wrote:

Perhaps you should look at EnterpriseDB -- It's an Oracle-compliant wrapper
for postgreSQL....

"gustavo halperin" <ggh.develop@gmail.com> wrote in message
news:44FCA0A7.5080100@gmail.com...

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported in
PosgSQL like "number" or "varchar2", there fore, can I write some type of
declaration (like in c : #define alias_name name) in order to make PosgSQL
recognize these types? Or there are other solution that you recommend to
use ?

Thank you, Gustavo

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/aQWS9HxQb37XmcRArJVAKCNjKPIGC0dZKCZNgZBTz9wdYl7nQCfYZFU
etqDdW8rRm+gXShS1iF3Nq8=
=g+pL
-----END PGP SIGNATURE-----

#11Scott Marlowe
smarlowe@g2switchworks.com
In reply to: gustavo halperin (#1)
Re: Porting from ORACLE to PostgSQL

On Mon, 2006-09-04 at 16:54, gustavo halperin wrote:

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported
in PosgSQL like "number" or "varchar2", there fore, can I write some
type of declaration (like in c : #define alias_name name) in order to
make PosgSQL recognize these types? Or there are other solution that you
recommend to use ?

If you just need a simple solution, look up domains:

http://www.postgresql.org/docs/8.1/static/sql-createdomain.html

specifically:

create domain varchar2 as varchar;

Note that you won't have a precision argument on the varchar2, but you
can put one on the varchar you use during domain creation:

This works:

create domain varchar2 as varchar(200);
create table test (info varchar);

This doesn't:
create domain varchar2 as varchar;
create table test (info varchar(200));

But once the tables are created, insert statements and such should work
normally.

#12Joshua D. Drake
jd@commandprompt.com
In reply to: Ron Johnson (#10)
Re: Porting from ORACLE to PostgSQL

Ron Johnson wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eliminating 21 line .signatures would be nice, too.

How about your 16 lines ;)

Sincerely,

Joshua D. Drake

codeWarrior wrote:

Perhaps you should look at EnterpriseDB -- It's an Oracle-compliant wrapper
for postgreSQL....

"gustavo halperin" <ggh.develop@gmail.com> wrote in message
news:44FCA0A7.5080100@gmail.com...

Hello

I need to porting many old ORACLE-oriented-SQL files and I have many
problem with this code. Sometimes the code use some types not supported in
PosgSQL like "number" or "varchar2", there fore, can I write some type of
declaration (like in c : #define alias_name name) in order to make PosgSQL
recognize these types? Or there are other solution that you recommend to
use ?

Thank you, Gustavo

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/aQWS9HxQb37XmcRArJVAKCNjKPIGC0dZKCZNgZBTz9wdYl7nQCfYZFU
etqDdW8rRm+gXShS1iF3Nq8=
=g+pL
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

#13Ron Johnson
ron.l.johnson@cox.net
In reply to: Joshua D. Drake (#12)
[OT] sig sizes (was Re: Porting from ...)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joshua D. Drake wrote:

Ron Johnson wrote:
Eliminating 21 line .signatures would be nice, too.

How about your 16 lines ;)

??? It's 8 lines.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/dGeS9HxQb37XmcRAswpAKDq0Zy5sF5nI+Ojl8zkOcDWf3VY8ACeOK6h
BJJadV19Ni9bwYPy+Hsq2fc=
=x6qe
-----END PGP SIGNATURE-----

#14Dave Page
dpage@pgadmin.org
In reply to: Ron Johnson (#13)
Re: [OT] sig sizes (was Re: Porting from ...)

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ron Johnson
Sent: 05 September 2006 20:36
To: pgsql-general@postgresql.org
Subject: [OT] sig sizes (was Re: [GENERAL] Porting from ...)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joshua D. Drake wrote:

Ron Johnson wrote:
Eliminating 21 line .signatures would be nice, too.

How about your 16 lines ;)

??? It's 8 lines.

I count 16, including PGP fluff. Not that I care much :-)

Regards, Dave.

#15Ron Johnson
ron.l.johnson@cox.net
In reply to: Dave Page (#14)
Re: [OT] sig sizes (was Re: Porting from ...)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Page wrote:

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ron Johnson
Sent: 05 September 2006 20:36
To: pgsql-general@postgresql.org
Subject: [OT] sig sizes (was Re: [GENERAL] Porting from ...)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joshua D. Drake wrote:

Ron Johnson wrote:
Eliminating 21 line .signatures would be nice, too.

How about your 16 lines ;)

??? It's 8 lines.

I count 16, including PGP fluff. Not that I care much :-)

Oh, ok. Tbird hides the PGP wrapper.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/diSS9HxQb37XmcRAgP7AJwIg9zzju3s3JJSz/jq165U7hFUCgCfXVKK
HNUAqY5J2urMEI6uGl5cr3Y=
=CTJ2
-----END PGP SIGNATURE-----

#16gustavo halperin
ggh.develop@gmail.com
In reply to: Ron Johnson (#15)
Re: [OT] sig sizes (was Re: Porting from ...)

Ron Johnson wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Page wrote:

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ron Johnson
Sent: 05 September 2006 20:36
To: pgsql-general@postgresql.org
Subject: [OT] sig sizes (was Re: [GENERAL] Porting from ...)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joshua D. Drake wrote:

Ron Johnson wrote:
Eliminating 21 line .signatures would be nice, too.

How about your 16 lines ;)

??? It's 8 lines.

I count 16, including PGP fluff. Not that I care much :-)

Oh, ok. Tbird hides the PGP wrapper.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/diSS9HxQb37XmcRAgP7AJwIg9zzju3s3JJSz/jq165U7hFUCgCfXVKK
HNUAqY5J2urMEI6uGl5cr3Y=
=CTJ2
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Are you serious about the length of my sign, I just think that is a
funny sign, but if it cause some trouble to the server y will cat my
sign from my mails and say sorry for the problem caused.

Regards,
Gustavo

--
||\ // \
| \\ // |
I'm thinking. \ \\ l\\l_ // |
_ _ | \\/ `/ `.| |
/~\\ \ //~\ | Y | | || Y |
| \\ \ // | | \| | |\ / |
[ || || ] \ | o|o | > /
] Y || || Y [ \___\_--_ /_/__/
| \_|l,------.l|_/ | /.-\(____) /--.\
| >' `< | `--(______)----'
\ (/~`--____--'~\) / U// U / \
`-_>-__________-<_-' / \ / /|
/(_#(__)#_)\ ( .) / / ]
\___/__\___/ `.`' / [
/__`--'__\ |`-' |
/\(__,>-~~ __) | |__
/\//\\( `--~~ ) _l |--:.
'\/ <^\ /^> | ` ( < \\
_\ >-__-< /_ ,-\ ,-~~->. \ `:.___,/
(___\ /___) (____/ (____) `---'