Put this sql in a file called query.sql and put it in the cgi-bin.
set linesize 100 set verify off select date_time_out,order_id,error_message,customer_id from ECS_SCHEMA.cob_mcom_log where end_date_time between to_date(&1,'YYYYMMDD') and to_date(&2,'YYYYMMDD') and error_code <> 0; exit;
together with this script
#!/usr/bin/perl use strict; use warnings; use CGI; use Time::Piece; my $sqlfile = '/var/www/cgi-bin/query.sql'; my $q = new CGI; my $today = Time::Piece->new->ymd(''); my $startdate = $q->param('startdate') || $today; my $enddate = $q->param('enddate') || $today; my $msg; if ( ($startdate =~ /^20\d{6}$/) && ($enddate =~ /^20\d{6}$/) ){ my $connstr = 'USER/PASWORD@DB'; $msg = qx"sqlplus -s $connstr \@$sqlfile $startdate $enddate"; } else { $msg = "ERROR : Dates must be 20YYMMDD"; } print $q->header,$q->start_html; print qq! <h3>Dates</h3> <form> Start date : <input type="text" maxlength="8" name="startdate" value=" +$startdate"/> yyyymmdd <br/> End date : <input type="text" maxlength="8" name="enddate" value="$ +enddate"/> yyyymmdd</br> <input type="submit"/> </form> </hr> <h3>Result for $startdate to $enddate</h3> <pre> $msg </pre>!; print $q->end_html;
Open script with browser, enter dates and press submit
update yy-mm-dd corrected to yyyymmdd
pojIn reply to Re^3: CGI-SQL Query Issue
by poj
in thread CGI-SQL Query Issue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |