Re: Date Problem
Posted in 1997
> Amita wrote
>
> I have a problem with date fields.
>
> 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
> from table-A
> into :ws-date
> In this query ws-date is NULL eventhouh f_date has some value.>
> 2. if f_date > date ( "10/10/1997")
>
> if This is the condition the date( char ) is NULL.
>
I'm not understanding completely your problem.
I'm assuming that you are using 4GL.
First there's a syntax error in the select, the "into" comes before the
"from".
I've created a table with only one date field in it, and then run the
following program and it works fine. (I've inserted the date 30/01/1997 in
the table).
The output is the following and it's correct:
01/30/1997
GREATER
HTP
Serafim Fonseca
------------------------
DATABASE database1
GLOBALS
DEFINE p_data DATE
END GLOBALS
MAIN
SELECT f_date
INTO p_data
FROM tab1
DISPLAY p_data
IF p_data > date("10/10/1996") THEN
DISPLAY "GREATER"
END IF
END MAIN
------------------------
==========================================================================
Serafim Fonseca e-mail: sf@dpx20.growela.pt
Growela Portuguesa Calcado, Lda. phone : +351 2 9820510
S. Pedro Avioso, Castelo fax : +351 2 9812212
4470 Maia - PORTUGAL