@@ -17,8 +17,13 @@ package Ora2Pg;
1717use varsqw( $VERSION $PSQL) ;
1818use Carpqw( confess) ;
1919use DBI;
20+ use POSIXqw( locale_h) ;
2021
21- $VERSION =" 1.8" ;
22+ # set locale to LC_NUMERIC C
23+ setlocale(LC_NUMERIC," C" );
24+
25+
26+ $VERSION =" 1.9" ;
2227$PSQL =" psql" ;
2328
2429=head1 NAME
@@ -854,7 +859,7 @@ print STDERR "Add triggers definition...\n" if ($self->{debug});
854859# Escaping Single Quotes
855860# $trig->[4] =~ s/'/''/sg;
856861
857- $sql_output .=" CREATE FUNCTION pg_fct_\L $trig ->[0]\E () RETURNSTRIGGER AS '\n $trig ->[4]\n ' LANGUAGE 'plpgsql'\n\n " ;
862+ $sql_output .=" CREATE FUNCTION pg_fct_\L $trig ->[0]\E () RETURNSOPAQUE AS '\n $trig ->[4]\n ' LANGUAGE 'plpgsql'\n\n " ;
858863$sql_output .=" CREATE TRIGGER\L $trig ->[0]\E\n\t $trig ->[1]$trig ->[2] ON\L $trig ->[3]\E FOR EACH ROW\n\t EXECUTE PROCEDURE pg_fct_\L $trig ->[0]\E ();\n\n " ;
859864}
860865}
@@ -1002,7 +1007,7 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10021007if ($self -> {type }ne ' COPY' ) {
10031008if ($tt [$i ] =~/ (char|date|time|text)/ ) {
10041009$row -> [$i ] =~s / '/ ''/ gs ;
1005- if ($row -> [$i ]) {
1010+ if ($row -> [$i ]ne ' ' ) {
10061011$row -> [$i ] =" '$row ->[$i ]'" ;
10071012}else {
10081013$row -> [$i ] =' NULL' ;
@@ -1017,7 +1022,8 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10171022}
10181023}
10191024}else {
1020- if (!$row -> [$i ]) {
1025+ $row -> [$i ] =~s / ,/ ./ ;
1026+ if ($row -> [$i ]eq ' ' ) {
10211027$row -> [$i ] =' NULL' ;
10221028}
10231029if ($self -> {dbhdest }) {
@@ -1042,7 +1048,10 @@ print STDERR "Dumping table $table...\n" if ($self->{debug});
10421048}
10431049}
10441050}else {
1045- if (!$row -> [$i ]) {
1051+ if ($tt [$i ] !~/ (char|date|time|text)/ ) {
1052+ $row -> [$i ] =~s / ,/ ./ ;
1053+ }
1054+ if ($row -> [$i ]eq ' ' ) {
10461055$row -> [$i ] =' \N' ;
10471056}
10481057if ($self -> {dbhdest }) {
@@ -1228,7 +1237,7 @@ sub _get_data
12281237my $tmp =" SELECT" ;
12291238for my $k (0 ..$# {$name }) {
12301239if ($type -> [$k ] =~/ (date|time)/ ) {
1231- $str .=" to_char($name ->[$k ], 'YYYY-MM-DD')," ;
1240+ $str .=" to_char($name ->[$k ], 'YYYY-MM-DD HH24:MI:SS ')," ;
12321241}else {
12331242$str .=" $name ->[$k ]," ;
12341243}
@@ -1290,8 +1299,8 @@ sub _sql_type
12901299' VARCHAR2' => ' varchar' ,
12911300' NVARCHAR2' => ' varchar' ,
12921301# The DATE data type is used to store the date and time information.
1293- # Pg typetimestamp should match all needs
1294- ' DATE' => ' timestamp ' ,
1302+ # Pg typedatetime should match all needs
1303+ ' DATE' => ' datetime ' ,
12951304# Type LONG is like VARCHAR2 but with up to 2Gb.
12961305# PG type text should match all needs or if you want you could use blob
12971306' LONG' => ' text' ,# Character data of variable length