| version 1.29, 2008/08/23 14:36:41 |
version 1.30, 2008/08/23 14:38:14 |
|
|
| #!/usr/bin/perl |
#!/usr/bin/perl |
| |
|
| # $Platon: scripts/perl/oracle/oracledump.pl,v 1.28 2008-08-23 14:35:06 nepto Exp $ |
# $Platon: scripts/perl/oracle/oracledump.pl,v 1.29 2008-08-23 14:36:41 nepto Exp $ |
| |
|
| use strict; |
use strict; |
| |
|
|
|
| |
|
| foreach $table (@opt_tables) |
foreach $table (@opt_tables) |
| { |
{ |
| |
my @column_names; |
| my @column_types; |
my @column_types; |
| my @row; |
my @row; |
| my $table_out; |
my $table_out; |
|
|
| ); |
); |
| } |
} |
| } |
} |
| |
push ( @column_names, $row[0] ); |
| push ( @column_types, $row[1] ); |
push ( @column_types, $row[1] ); |
| } |
} |
| |
|
|
|
| |
|
| if(! defined $opt_no_data) |
if(! defined $opt_no_data) |
| { |
{ |
| my @column_names; |
|
| |
|
| |
|
| ## Print the per-table header |
## Print the per-table header |
| |
|
| Line 564 SET AUTOCOMMIT OFF; |
|
| Line 564 SET AUTOCOMMIT OFF; |
|
| MARK |
MARK |
| } |
} |
| |
|
| |
|
| ## Generate list of column names |
|
| |
|
| if ( defined $opt_owner ) { |
|
| $query = 'SELECT column_name |
|
| FROM all_tab_columns |
|
| WHERE UPPER(table_name) = \''.$table.'\' |
|
| AND UPPER(owner) = \''.$opt_owner.'\''; |
|
| } else { |
|
| $query = 'SELECT column_name |
|
| FROM user_tab_columns |
|
| WHERE UPPER(table_name) = \''.$table.'\''; |
|
| } |
|
| |
|
| $sth = $dbh->prepare($query); |
|
| $sth->execute() || die $DBI::errstr; |
|
| |
|
| while (@row = $sth->fetchrow_array()) |
|
| { |
|
| push(@column_names, @row); |
|
| } |
|
| |
|
| $sth->finish(); |
|
| |
|
| |
|
| ## Query for data then output SQL |
## Query for data then output SQL |
| |
|
| $query = sprintf( 'SELECT "%s" FROM %s', |
$query = sprintf( 'SELECT "%s" FROM %s', |