| version 1.14, 2007/03/17 06:47:38 |
version 1.15, 2007/03/17 07:27:43 |
|
|
| #!/usr/bin/perl |
#!/usr/bin/perl |
| |
|
| # $Platon: scripts/perl/oracle/oracledump.pl,v 1.13 2005-04-30 13:52:17 nepto Exp $ |
# $Platon: scripts/perl/oracle/oracledump.pl,v 1.14 2007-03-17 06:47:38 nepto Exp $ |
| |
|
| use strict; |
use strict; |
| |
|
| Line 312 if (scalar @opt_tables < 1) |
|
| Line 312 if (scalar @opt_tables < 1) |
|
| |
|
| $sth = $dbh->prepare("SELECT TABLE_NAME |
$sth = $dbh->prepare("SELECT TABLE_NAME |
| FROM DICTIONARY |
FROM DICTIONARY |
| WHERE TABLE_NAME = ?"); |
WHERE TABLE_NAME = \'V\$INSTANCE\'"); |
| |
$sth->execute() || die $DBI::errstr; |
| $sth->execute("V\$INSTANCE") || die $DBI::errstr; |
|
| |
|
| ($table) = $sth->fetchrow_array(); |
($table) = $sth->fetchrow_array(); |
| |
|
| $sth->finish(); |
$sth->finish(); |
| |
|
| if ($table eq "V\$INSTANCE") |
if ($table eq "V\$INSTANCE") |
|
|
| data_default, |
data_default, |
| nullable |
nullable |
| FROM all_tab_columns |
FROM all_tab_columns |
| WHERE UPPER(table_name) = ? |
WHERE UPPER(table_name) = \''.$table.'\' |
| AND UPPER(owner) = \''.$opt_owner.'\''; |
AND UPPER(owner) = \''.$opt_owner.'\''; |
| } else { |
} else { |
| $query = 'SELECT column_name, |
$query = 'SELECT column_name, |
|
|
| data_default, |
data_default, |
| nullable |
nullable |
| FROM user_tab_columns |
FROM user_tab_columns |
| WHERE UPPER(table_name) = ?'; |
WHERE UPPER(table_name) = \''.$table.'\''; |
| } |
} |
| |
|
| $sth = $dbh->prepare($query); |
$sth = $dbh->prepare($query); |
| $sth->execute($table) || die $DBI::errstr; |
$sth->execute() || die $DBI::errstr; |
| |
|
| my $c = 0; |
my $c = 0; |
| while (@row = $sth->fetchrow_array()) |
while (@row = $sth->fetchrow_array()) |
|
|
| if ( defined $opt_owner ) { |
if ( defined $opt_owner ) { |
| $query = 'SELECT column_name |
$query = 'SELECT column_name |
| FROM all_tab_columns |
FROM all_tab_columns |
| WHERE UPPER(table_name) = ? |
WHERE UPPER(table_name) = \''.$table.'\' |
| AND UPPER(owner) = \''.$opt_owner.'\''; |
AND UPPER(owner) = \''.$opt_owner.'\''; |
| } else { |
} else { |
| $query = 'SELECT column_name |
$query = 'SELECT column_name |
| FROM user_tab_columns |
FROM user_tab_columns |
| WHERE UPPER(table_name) = ?'; |
WHERE UPPER(table_name) = \''.$table.'\''; |
| } |
} |
| |
|
| $sth = $dbh->prepare($query); |
$sth = $dbh->prepare($query); |
| $sth->execute($table) || die $DBI::errstr; |
$sth->execute() || die $DBI::errstr; |
| |
|
| while (@row = $sth->fetchrow_array()) |
while (@row = $sth->fetchrow_array()) |
| { |
{ |