in reply to Re^2: CGI-SQL Query Issue
in thread CGI-SQL Query Issue
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
poj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: CGI-SQL Query Issue
by Anonymous Monk on Mar 18, 2016 at 10:59 UTC | |
by Corion (Patriarch) on Mar 18, 2016 at 11:23 UTC | |
by Anonymous Monk on Mar 18, 2016 at 11:26 UTC | |
by Corion (Patriarch) on Mar 18, 2016 at 11:28 UTC | |
|
Re^4: CGI-SQL Query Issue
by Anonymous Monk on Mar 18, 2016 at 11:10 UTC | |
by poj (Abbot) on Mar 18, 2016 at 11:33 UTC | |
by Anonymous Monk on Mar 18, 2016 at 12:15 UTC | |
by poj (Abbot) on Mar 18, 2016 at 12:50 UTC | |
by Anonymous Monk on Mar 18, 2016 at 15:22 UTC | |
|