in reply to PERL DBI and oracle
DBI->trace(3); # Added call to trace method my $dbh = DBI->connect("DBI:Oracle:host=$host;port=$port;sid=$sid",$us +er, $password, {PrintError=>1,RaiseError=>1}) or die "Can't connect to ORACLE database:$DBI::errstr\n"; my $subj_code_query = qq{SELECT * FROM LOOKUP}; my $sth_subj = $dbh->prepare($subj_code_query); # ---A function--- sub execute_subject_query() { open(SWRT, ">SUBJECT_CODES_FOR_XML.txt"); my $rv = $sth_subj->execute(); if($rv == 0) { print "No Value Returned\n"; } else { print "subject_id\tsubject_sex\tsubject_type\n"; while( my $array_ref = $sth_subj->fetchrow_arrayref) { for(my $i=0; $i<@$array_ref;$i++) { print "$array_ref->$i\n";<STDIN>; print SWRT "$array_ref->$i\n"; } } } $sth_subj->finish(); close SWRT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PERL DBI and oracle
by hakiran (Initiate) on Jun 12, 2007 at 18:14 UTC | |
by hakiran (Initiate) on Jun 12, 2007 at 18:41 UTC | |
by thezip (Vicar) on Jun 12, 2007 at 19:02 UTC | |
by Anonymous Monk on Jun 12, 2007 at 21:54 UTC |