How to execute xxx.sql in DBI in perl

Would you help me how to execute like [at] xx.sql in PL/SQL in perl?

If I do not execute select query, I want to get the query result using by x=
..sql file.

It mean that I want to execute x.sql file after connecting oracle, then I w=
ant to get the output.

Is it possible or not ?





use DBI;

....
....

my $dbh =3D DBI->connect ($dsn, $username, $password, \%attr) || die "Datab=
ase connection not mode : $DBI::errstr";

my $que =3D " [at] /lhome/elcaro/scripts/admin/moniCPU.sql";
#my $que =3D "select instance_name from v\$instance";

my $cursor =3D $dbh->selectall_arrayref($que);

for ( [at] $cursor) {
print " [at] {$_} \n";
}

$dbh->disconnect;




Hyejin Woo
GM&Q / Network & DBA

Certificate : CISA, CCNP, IBM AIX Expert, HP-UX, ITIL

HP-DIS
23, Sungju-dong, Changwon, Kyeongnam, 641-745, South Korea
Office : +82-55-269-1272 / Fax: +82-55-269-1261
Mobile : +82-10-9300-6793
Mail : hye-jin.woo [at] hp.com




--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
hye-jin.woo [ Do, 26 Mai 2011 11:58 ] [ ID #2060114 ]

Re: How to execute xxx.sql in DBI in perl

--0016e643461e906d2404a42ae09a
Content-Type: text/plain; charset=ISO-8859-1

you can open the .sql file and store the contents in a perl variable (lets
say $SQL) and then execute the command.

On Thu, May 26, 2011 at 3:28 PM, Woo, Hye Jin <hye-jin.woo [at] hp.com> wrote:

> Would you help me how to execute like [at] xx.sql in PL/SQL in perl?
>
> If I do not execute select query, I want to get the query result using by
> x.sql file.
>
> It mean that I want to execute x.sql file after connecting oracle, then I
> want to get the output.
>
> Is it possible or not ?
>
>
>
>
>
> use DBI;
>
> ...
> ...
>
> my $dbh = DBI->connect ($dsn, $username, $password, \%attr) || die
> "Database connection not mode : $DBI::errstr";
>
> my $que = " [at] /lhome/elcaro/scripts/admin/moniCPU.sql";
> #my $que = "select instance_name from v\$instance";
>
> my $cursor = $dbh->selectall_arrayref($que);
>
> for ( [at] $cursor) {
> print " [at] {$_} \n";
> }
>
> $dbh->disconnect;
>
>
>
>
> Hyejin Woo
> GM&Q / Network & DBA
>
> Certificate : CISA, CCNP, IBM AIX Expert, HP-UX, ITIL
>
> HP-DIS
> 23, Sungju-dong, Changwon, Kyeongnam, 641-745, South Korea
> Office : +82-55-269-1272 / Fax: +82-55-269-1261
> Mobile : +82-10-9300-6793
> Mail : hye-jin.woo [at] hp.com
>
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>

--0016e643461e906d2404a42ae09a--
Abhinav Kukreja [ Do, 26 Mai 2011 11:59 ] [ ID #2060115 ]
Perl » gmane.comp.lang.perl.beginners » How to execute xxx.sql in DBI in perl

Vorheriges Thema: Message queue
Nächstes Thema: Perl For system admin