next line, new line

rasdj at frontiernet.net rasdj at frontiernet.net
Mon Jan 31 04:42:22 CET 2005


I have a lot of SQL to convert to postgres from oracle. I have most of
the problems worked out except for this last bit. Many of my tables
need the last comma replaced with a close parenthesis - they look like
this:

create table schema.table (
FLD000 NUMERIC(10,0) NOT NULL,
FLD001 CHAR(3) NOT NULL,
FLD002 DATE NOT NULL,
;

when the syntax requires:

FLD002 DATE NOT NULL)
;

I output the text in reverse thinking I could find the semicolon, go to
the next line and replace the 'comma newline' with 'closeparen newline'
and then go on to find the next semicolon.

;
FLD002 DATE NOT NULL,
FLD001 CHAR(3) NOT NULL,
FLD000 NUMERIC(10,0) NOT NULL,
create table schema.table (
;
FLD002 DATE NOT NULL,
FLD001 CHAR(3) NOT NULL,
FLD000 NUMERIC(10,0) NOT NULL,
create table schema.table2 (

I don't seem to be making any progress altho I have had some
interesting output. 

Throw me a bone?

Thank you,

RasDJ




More information about the Python-list mailing list