Subject | Error conversion on time field |
---|---|
Author | Bayu |
Post date | 2003-01-15T08:14:22Z |
Hi all,
I have confused with my problem about compare value in time format.
I will simplify with this format
We have table tarif with structure like this
MULAI_WAKTU TIME,
SELESAI_WAKTU TIME,
ZONA VARCHAR(3)
and have Store Proc like this
CREATE PROCEDURE TESTING
AS
declare variable jam time;
declare variable MULAI_WAKTU1 time;
declare variable SELESAI_WAKTU2 time;
BEGIN
jam = current_time;
for
Select mulai_waktu, selesai_waktu
from tarif
where tarif.zona = 'Z2'
and tarif.libur = 'T'
and ( tarif.mulai_waktu <= :jam ) <-- error in conversion jam
variable
and ( tarif.selesai_waktu >= :jam ) <--
into
:mulai_waktu1, :selesai_waktu2
do suspend;
END
Just execute this proc and give me conversion error.
But, we replace :jam with current_time, this sP will execute with no errors.
This is make me confused, althought jam have a time type field. Why passing
variable with time field can't compare in where section ? I miss something
... ?
thanks
Bayu
I have confused with my problem about compare value in time format.
I will simplify with this format
We have table tarif with structure like this
MULAI_WAKTU TIME,
SELESAI_WAKTU TIME,
ZONA VARCHAR(3)
and have Store Proc like this
CREATE PROCEDURE TESTING
AS
declare variable jam time;
declare variable MULAI_WAKTU1 time;
declare variable SELESAI_WAKTU2 time;
BEGIN
jam = current_time;
for
Select mulai_waktu, selesai_waktu
from tarif
where tarif.zona = 'Z2'
and tarif.libur = 'T'
and ( tarif.mulai_waktu <= :jam ) <-- error in conversion jam
variable
and ( tarif.selesai_waktu >= :jam ) <--
into
:mulai_waktu1, :selesai_waktu2
do suspend;
END
Just execute this proc and give me conversion error.
But, we replace :jam with current_time, this sP will execute with no errors.
This is make me confused, althought jam have a time type field. Why passing
variable with time field can't compare in where section ? I miss something
... ?
thanks
Bayu