Date Problem
Posted in 1997
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design, Platform-Specific Issues
Hi Charles
I have posted this query in the Informix Newsgroup. Can you help me?
[You don't miss a chance to sell your trainings..yeah!!!] I have forwarded
the mail to my boss. I personally hope this training was in Bangalore.
Regards
Amita
Hi Jonathan
I am sorry I didn't give you complete picture.
Well this problem we are facing only at our Customer place. I only have what
they have sent me. I'll reproduce it again. [You are right INTO comes before
FROM and after SELECT..sorry..].
1. If a field is declared as DATE in a table, and when we read it from
table to a program variable, the program variable is NULL.
select f_date into :ws_date from tableA
In this query ws_date is NULL eventhouh f_date has some value.
2.
/* Declare Cursor to get Trailer Details */
EXEC SQL
DECLARE trailer_location CURSOR FOR
SELECT tl_carrier, tl_trailer_no, tl_dflag, tl_truck_type,tl_date_emptied,
trail_rep.cur_row = 6;
create_line ( trail_bodywin, 2, 1, 75 );
/* Call Initialise Screen */
initialise_trailer_loc ( trail_bodywin );
create_line ( trail_bodywin, 5, 1, 75 );
/* Declare Cursor to get Trailer Details */
EXEC SQL
DECLARE trailer_location CURSOR FOR
SELECT tl_carrier, tl_trailer_no, tl_dflag, tl_truck_type,tl_date_emptied,
tl_time_emptied, tl_arrival_date, tl_arrival_time
FROM
truckmaster
WHERE
date(tl_arrival_date) BETWEEN date(from_date) AND date(to_date);
EXEC SQL
OPEN trailer_location;
if ( sqlca.sqlcode != 0 )
{
..................
tl_arrival_date is defined as char(9) in the table.[This was suggested by
our Customer]
if This is the condition the date( tl_arrival_date ) is NULL.
From these queries it is very clear that date as data type and date function
as such is not a problem. Where is the problem ? Should we define a date
field as char(9) at all?
Please help.
Background is - INFORMIX online 5.05, ESQL/C running on AIX 3.2.5
Thanks
Amita
The clock is running, make the most of today.......