in reply to Re^3: CGI-SQL Query Issue
in thread CGI-SQL Query Issue

I removed the "Time/Piece.pm" part from the code & tried to rerun it. This time the query worked, but when I enter the dates, I just get the output as "Result for 20160303 to 20160320", I entered START DATE as 20160303 & END DATE as 20160320... Dates Start date : yyyy-mm-dd End date : yyyy-mm-dd Result for 20160303 to 20160320 The sql query result is not getting populated in the web page outout. Could you suggest?

Replies are listed 'Best First'.
Re^5: CGI-SQL Query Issue
by poj (Abbot) on Mar 18, 2016 at 11:33 UTC

    Does it work if you put the dates in the SQL ?

    between to_date('20160303','YYYYMMDD') and to_date('20160320','YYYYMMDD')
    poj
      NO, same result as before. That's the whole problem, SQL query is not working.

        Create a file called dual.sql in cgi-bin with these 2 lines

        select SYSDATE from dual; exit;

        Create and access this cgi program

        #!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; my $sqlfile = '/var/www/cgi-bin/dual.sql'; my $q = new CGI; my $connstr = 'USER/PASSWORD@DB'; my $msg = qx"sqlplus -s $connstr \@$sqlfile"; print $q->header,$q->start_html, $q->pre($msg),$q->end_html;
        poj