hakiran has asked for the wisdom of the Perl Monks concerning the following question:
---A function---my $dbh = DBI->connect("DBI:Oracle:host=$host;port=$port;sid=$sid",$us +er, $password, {PrintError=>1,RaiseError=>1}) or die "Can't connect t +o ORACLE database:$DBI::errstr\n"; my $subj_code_query = qq{SELECT * FROM LOOKUP}; my $sth_subj = $dbh->prepare($subj_code_query);
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: PERL DBI and oracle
by thezip (Vicar) on Jun 12, 2007 at 17:57 UTC | |
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 | |
|
Re: PERL DBI and oracle
by wagnerc (Sexton) on Jun 12, 2007 at 21:01 UTC | |
|
Re: PERL DBI and oracle
by agianni (Hermit) on Jun 12, 2007 at 20:26 UTC | |
by hakiran (Initiate) on Jun 12, 2007 at 21:43 UTC |