Hi,
According to my logic I need to accomplish in this script(Logic: My perl script should check for a certain column(column name STATUS) in a table(table name INFO). If the status column is equal to 'I OR D' it has to look at the data in the" ID ,number column", remember that ID and number and then go to the location "c:\Documents and Settings\user\Files and delete the directories that are named by this ID.).
I was able to connect to oracle and select the required columns and print them, but need help from here. How to remember the data in the "ID " column and go to the location " c:\Documents and Settings\user\Files" and delete these directories.
Current Script:
#!/usr/perl/5.8.8/bin/perl -w
use strict;
use DBI;
my $db = DBI->connect( "dbi:Oracle:*****", "*****", "******" )
|| die( $DBI::errstr . "\n" );
$db->{AutoCommit} = 0;
$db->{RaiseError} = 1;
$db->{ora_check_sql} = 0;
$db->{RowCacheSize} = 16;
my $SEL = "SELECT number,id,status FROM info where status in ('I,D')"
+;
my $sth = $db->prepare($SEL);
$sth->execute();
while ( my @row = $sth->fetchrow_array() ) {
foreach (@row) {
$_ = "\t" if !defined($_);
print "$_\t";
}
print "\n";
}
END {
$db->disconnect if defined($db);
}
current output:
number Id status
HDF0008 89456R I
HDF0009 34567R D
Files: c:\Documents and Settings\user\Files
HDF0009 -> 34567R -> folder1 , folder2 ....
HDF0008 -> 89456R -> folder1 , folder2....
DIR -> Subdirectory -> older1 , folder2....
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|