in reply to Perl on Oracle
use DBI; ... my $dbh = DBI->connect($dsn, $usr, $pwd, \%attr); my $stm = 'SELECT <something> FROM <something><etc>'; my $sth = $dbh->prepare($stm); $sth->execute; while (my $row_of_data = $sth->fetchrow_arrayref) { ...process data, ie, append each row to variable... } ... __END__
A couple of notes here. The \%attr is an optional arg to connect, but using {AutoCommit => 1, RaiseError =>1} is recommended by Bunce et al in "Programming the Perl DBI" for convenience and safety. You WILL have to consult DBD::Oracle for how to fill in the $dsn arg. The meat of the script is really the contents of the $stm variable, and you will have to learn enough SQL to do what you want to do, no way around it. Finally, fetchrow_arrayref is used here because I don't know how many fields you are returning...fetchrow_array returns an array of results, whereas the former is faster for huge returns because it's merely passing around a reference to that array. This of course means you have to use the usual dereferencing semantics to get at the guts of the results.
|
|---|