develooper Front page | perl.beginners | Postings from April 2002

Re: select from oracle and write to file

Thread Previous | Thread Next
From:
David vd Geer Inhuur tbv IPlib
Date:
April 30, 2002 23:29
Subject:
Re: select from oracle and write to file
Message ID:
200205010628.IAA27110@server39.iclab.ce.philips.nl

Hi Garrett,

Not shure if this is where you are looking for, but here is some simple info
on how to write data to a file. If it is not sufficient you'll have to wait for
the real ones to wake up :)

$file = "/path/to/file";
open(F, "> $file");

print F "What you want to store in your file, can also be a $variable";

close(F);

## ">" says create new or overwrite, ">>" says append or create new.

Good Luck !!


Regs David
------------------
> 
> Hello all,
> 
> Solaris, Oracle 8.1.6, Perl 5
> 
> How do I write my selected row from Oracle out to a new file? Below is what 
> I have so far. I can select the row, but I don't know how to write it to a 
> new file:
> 
> 
> #!/usr/local/bin/perl -w
> #
> # REMEMBER! Set the environment variable: ORACLE_HOME=/path-to-oracle BEFORE 
> running this script.
> #
> 
> use strict;
> use DBI;
> 
> my $dbh = DBI->connect( 'dbi:Oracle:db',
>                         'user',
>                         'passwd',
>                         {
>                         RaiseError => 1,
>                         AutoCommit => 0
>                         }
>                         ) || die "Database connection not made: 
> $DBI::errstr";
> my $sql = qq{ SELECT oid FROM bv_ep_project };
> my $sth = $dbh->prepare ( $sql );
> $sth->execute();
> $sth->finish();
> $dbh->disconnect();
> 
> Thank you for your help!!!
> 
> -garrett
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> 

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About