Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
Hello,
I was experiencing a problem when using WKT format export from Oracle, that I solved modifying the code of the file Ora2Pg.pm .
The problem I think was caused by the fact that ins subroutine format_data_row is evaluating if there is at least a gemotry field with :
$has_geom = 1 if (grep(/^(SDOGEOMETRY|ST|STGEOM_)/, @$src_data_types));
That was causing of having all the fields, of a table with at least a geometry in that way :
$row->[$idx] = "ST_Geometry('" . $row->[$idx] . "', $self->{spatial_srid}{$table}->[$idx])";
In order to avoid such behaviour I added the evaluation of has_geom variable inside the "for" cycle that is checcking all data types of the routine format_data_row :
for (my $idx = 0; $idx <= $#{$data_types}; $idx++)
{
if ($src_data_types->[$idx] =~ /SDO_GEOMETRY/i)
{
$has_geom = 1
}else{
$has_geom = 0
}
In attach the file.
Hello, I was experiencing a problem when using WKT format export from Oracle, that I solved modifying the code of the file Ora2Pg.pm . The problem I think was caused by the fact that ins subroutine format_data_row is evaluating if there is at least a gemotry field with : $has_geom = 1 if (grep(/^(SDOGEOMETRY|ST|STGEOM_)/, @$src_data_types)); That was causing of having all the fields, of a table with at least a geometry in that way : $row->[$idx] = "ST_Geometry('" . $row->[$idx] . "', $self->{spatial_srid}{$table}->[$idx])"; In order to avoid such behaviour I added the evaluation of has_geom variable inside the "for" cycle that is checcking all data types of the routine format_data_row : for (my $idx = 0; $idx <= $#{$data_types}; $idx++) { if ($src_data_types->[$idx] =~ /SDO_GEOMETRY/i) { $has_geom = 1 }else{ $has_geom = 0 } In attach the file.
Ora2Pg.pm.txt