Subject RE: [ib-support] Error conversion on time field
Author Brian K. Woods
Bayu,
You _are_ running sql dialect 3, right?

Your procedure runs fine against my fb ( fb 1.0.2 ).
I created the tarif table as you defined ( minus the LIBUR field ) and the
procedure as you defined,
except for commenting out the LIBUR reference in the query.
The only change I made was to change the params section so it returns
something for testing
with a select * from TESTING query, as such:

CREATE PROCEDURE TESTING
RETURNS (
MULAI_WAKTU1 TIME,
SELESAI_WAKTU2 TIME)
AS
DECLARE VARIABLE JAM TIME;
BEGIN
jam = current_time;
...

You sure you gave the variable and field types correctly? None of them are
char or time_stamp or anything like that
in your real database?

I'm not sure on this, but I think dialect 1 handled date/time types
differently. If you aren't running dialect 3, your problem is likely to be
conversion. If that is the case, try casting:
and ( tarif.mulai_waktu <= CAST(:jam as TIME) )

Although, I would have thought that if :jam wouldn't work, current_time
wouldn't either...

If you still can't get it, repost with your exact table and procedure
definitions and hopefully someone
with more experience than me will have an immediate answer for you. @;-)

HTH,
Brian

> -----Original Message-----
> From: Bayu [mailto:bayu@...]
> Sent: Wednesday, January 15, 2003 3:14 AM
> To: IB Support
> Subject: [ib-support] Error conversion on time field
>
>
> 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
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>