slg_saravanan has asked for the wisdom of the Perl Monks concerning the following question:
I am facing problem while running a query (with oracle placeholder) in my Perl script. Following is the code :
I am making the final result in HTML report format. For example I am using the "select * from EMP where EMPNO = &eno " query here. So, $mainquery will carry this query and will process the rest.#!/usr/bin/perl -w use warnings; use strict; use CGI; use DBI; use CGI::Carp qw(fatalsToBrowser); my $query=new CGI; my $cgiobj = CGI -> new(); #my $xlsdata; my $querydata; my $querycreated; #print "Content-type:text/html\n\n"; my $querytitle = $cgiobj -> param('querytitle'); $ENV{ORACLE_HOME}="/home/oracle/product/10.2.0/db_1"; our $conn = DBI->connect("dbi:Oracle:host=10.0.0.1;sid=dev;","queryedi +tor","editor"); die($DBI::errstr) unless $conn; print $querytitle; print "Content-type: application/HTML\n"; print "Content-disposition: inline; filename=\"Report.html\"\n"; print "Pragma: no-cache\n"; print "Expires: 0\n\n"; my $query_detail1 = "select querydata from querydetail where querytitl +e='$querytitle'"; my $query_records1 = $conn->prepare($query_detail1) or die("Error on p +reparing the sql statement1 \n"); $query_records1->execute() or die("Error on getting the data from QUER +YDETAIL \n"); while(my @query_resultset1= $query_records1->fetchrow_array) { my $mainquery= $query_resultset1[0]; #print $mainquery; my $query_records2 = $conn->prepare($mainquery) or die("Error on prepa +ring the sql statement2 \n"); $query_records2->execute() or die("Error on getting the data from QUER +YDETAIL \n"); print "<h1><center>Report</center></h1><br><br>"; my $dat = $query_records2 -> fetchall_arrayref; foreach my $i ( 0..$#{ $dat } ) { foreach my $j ( 0..$#{ $dat->[$i] } ) { print $dat->[$i][$j]."<br>"; } } }
What could be the problem ? If you need more detail..then i can supply iy to you..
Thanks in Advance..
Warm Regards,
Saravanan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Oracle Placeholder Problem in my Perl Script
by bart (Canon) on May 28, 2007 at 08:46 UTC | |
|
Re: Oracle Placeholder Problem in my Perl Script
by mpeppler (Vicar) on May 28, 2007 at 19:12 UTC | |
|
Re: Oracle Placeholder Problem in my Perl Script
by nobull (Friar) on May 28, 2007 at 18:14 UTC | |
|
Re: Oracle Placeholder Problem in my Perl Script
by andreas1234567 (Vicar) on May 29, 2007 at 06:48 UTC | |
by slg_saravanan (Initiate) on May 31, 2007 at 05:26 UTC |