Subject | time casting problem... |
---|---|
Author | Adam |
Post date | 2006-11-19T20:57:02Z |
When I set "StartTime" and "EndTime" variable like const char
/*"StartTime" = '17:15:00.0000';
"EndTime" = '18:15:00.0000';*/ it work (I get 5 results), but if I
have dinamic sign with the same values it doesn't work (I get
null)....please help me!
select condition is:
...
cast("Visit"."Time" as time) between cast(:"StartTime" as time)and
cast(:"EndTime" as time)
This is the code example:
//////////////////////PROCEDURE CODE/////////////////////////////
declare variable "StartTime" char(13);
declare variable "EndTime" char(13);
...
/*this don't work!!! I'm shure I have '17:15:00.0000' and
'18:15:00.0000' as result of previous query*/
"StartTime" = cast(:"StartHour" as char(2)) || ':' ||
cast(:"StartMinute" as char(2)) || ':' || '00.0000';
"EndTime" = cast(:"EndHour" as char(2)) || ':' || cast(:"EndMinute" as
char(2)) || ':' || '00.0000';this don't work!!!
/*this work!!!*/
/*"StartTime" = '17:15:00.0000';
"EndTime" = '18:15:00.0000';*/
/*FIND IF AT LEAST ONE MEMBER HAS BEEN AT CURRENT ACTIVITY IN
CURRENT DAY AND TIME RANGE*/
while ("StartDate" <= "EndDate")
do
begin
/*SELECT DATA IN SOME INTERVAL...*/
select
count( "Visit"."idPerson" )
from
"Visit"
where
"Visit"."idInstructor" = :"idInstructor" and
cast("Visit"."Time" as date) = :"StartDate" and
cast("Visit"."Time" as time) between cast(:"StartTime" as time)
and cast(:"EndTime" as time)
into
:"IsActivityVisited";
/*COUNT HOURS*/
if (:"IsActivityVisited" > 0 ) then
begin
"InstructorActivityHours" = "InstructorActivityHours" + 1;
end
/*reset*/
"IsActivityVisited" = 0;
"StartDate" = "StartDate" + 1;
end
///////////////////////////////////////////////////////////////
/*"StartTime" = '17:15:00.0000';
"EndTime" = '18:15:00.0000';*/ it work (I get 5 results), but if I
have dinamic sign with the same values it doesn't work (I get
null)....please help me!
select condition is:
...
cast("Visit"."Time" as time) between cast(:"StartTime" as time)and
cast(:"EndTime" as time)
This is the code example:
//////////////////////PROCEDURE CODE/////////////////////////////
declare variable "StartTime" char(13);
declare variable "EndTime" char(13);
...
/*this don't work!!! I'm shure I have '17:15:00.0000' and
'18:15:00.0000' as result of previous query*/
"StartTime" = cast(:"StartHour" as char(2)) || ':' ||
cast(:"StartMinute" as char(2)) || ':' || '00.0000';
"EndTime" = cast(:"EndHour" as char(2)) || ':' || cast(:"EndMinute" as
char(2)) || ':' || '00.0000';this don't work!!!
/*this work!!!*/
/*"StartTime" = '17:15:00.0000';
"EndTime" = '18:15:00.0000';*/
/*FIND IF AT LEAST ONE MEMBER HAS BEEN AT CURRENT ACTIVITY IN
CURRENT DAY AND TIME RANGE*/
while ("StartDate" <= "EndDate")
do
begin
/*SELECT DATA IN SOME INTERVAL...*/
select
count( "Visit"."idPerson" )
from
"Visit"
where
"Visit"."idInstructor" = :"idInstructor" and
cast("Visit"."Time" as date) = :"StartDate" and
cast("Visit"."Time" as time) between cast(:"StartTime" as time)
and cast(:"EndTime" as time)
into
:"IsActivityVisited";
/*COUNT HOURS*/
if (:"IsActivityVisited" > 0 ) then
begin
"InstructorActivityHours" = "InstructorActivityHours" + 1;
end
/*reset*/
"IsActivityVisited" = 0;
"StartDate" = "StartDate" + 1;
end
///////////////////////////////////////////////////////////////