Hi Friends..

I am facing problem while running a query (with oracle placeholder) in my Perl script. Following is the code :

#!/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>"; } } }
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.

What could be the problem ? If you need more detail..then i can supply iy to you..

Thanks in Advance..
Warm Regards,
Saravanan

Code tags added by Arunbear


In reply to Oracle Placeholder Problem in my Perl Script by slg_saravanan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.