Re: Perl "system" command and Informix
Posted in 1998
Edward Villalovoz wrote:
>
> Can anyone tell my what i'm doing wrong? The following procedure works if i
> hard code the $hh in as say, "12", but it won't work if i try to have it
> read from the list. I keep getting the error,
>
> 1262: Non-numeric character in datetime or interval.
> Error in line 3> Near character position 44
>
> 201: A syntax error has occurred.
> Error in line 1> Near character position 4
>
> Please tell me what i'm doing wrong. Thanks in advance.
> ============================================
> #!/usr/local/bin/perl
>
> @half_hours = ("12","13","14");
>
> foreach $hh (@half_hours) {
>
> $ENV{INFORMIXSERVER} = "n36_shm";
> system q{
> dbaccess << 'eof'
> database pmsys@n36;
> SELECT *
> FROM ama0_980714
> WHERE EXTEND (ostime, HOUR to HOUR) = "$hh";> eof
> };
>
> print "got half hour $hh\\n";
> #other code....
>
> }
You're using q instead of qq, so Perl is not interpolating the value
of $hh, so OnLine is complaining that $hh is not a valid datetime
literal.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.59 -- see http://www.perl.com/CPAN
#include <disclaimer.h>