calculation of timing [message #341744] |
Wed, 20 August 2008 02:53  |
sajidrazmi
Messages: 47 Registered: August 2008 Location: oman
|
Member |
|
|
Hi All
I am getiing one problem when i am going to calulate the times
i have written these code
DECLARE
tempm VARCHAR2 (12);
temph VARCHAR2 (12);
temps VARCHAR2 (12);
BEGIN
Go_Block ('BLK_TAS_TEMP');
First_Record;
LOOP
Go_Block ('TEMP');
IF :BLK_TAS_TEMP.tAs_temp_Status IN ('A', 'P') THEN
Go_Block ('TEMP');
:TEMP.emp_Code := :BLK_TAS_TEMP.tAs_temp_emp_Code;
:TEMP.emp_Name := :BLK_TAS_TEMP.tAs_temp_emp_Name;
:TEMP.Morning_In := :BLK_TAS_TEMP.tAs_temp_Morning_In;
:TEMP.Lunch_Out := :BLK_TAS_TEMP.tAs_temp_Lunch_Out;
:TEMP.Tot_Morning := :BLK_TAS_TEMP.tAs_temp_Tot_Morning;
:TEMP.Post_Lunch_In := :BLK_TAS_TEMP.tAs_temp_Post_Lunch_In;
:TEMP.Evening_Out := :BLK_TAS_TEMP.tAs_temp_Evening_Out;
:TEMP.Tot_Evening := :BLK_TAS_TEMP.tAs_temp_Tot_Evening;
:TEMP.Tot_hrs := :BLK_TAS_TEMP.tAs_temp_Tot_hrs;
:TEMP.Status := :BLK_TAS_TEMP.tAs_temp_Status;
Next_Record;
END IF;
Go_Block ('BLK_TAS_TEMP');
EXIT WHEN :SYSTEM.Last_Record = 'TRUE';
Next_Record;
END LOOP;
BEGIN
Go_Block ('TEMP');
First_Record;
LOOP
BEGIN
tempm := (To_Date (:TEMP.Lunch_Out, 'HH:MI AM')
- To_Date (:TEMP.Morning_In, 'HH:MI AM'))
* 24
* 60;
temph := tRunc (tempm / 60);
temps := (tempm / 60 - tRunc (tempm / 60)) * 60;
:TEMP.Tot_Morning := (temph || ':' || temps);
EXCEPTION
WHEN OTHERS THEN
Message (SQLERRM);
END;
Next_Record;
IF :SYSTEM.Last_Record = 'TRUE' THEN
EXIT;
END IF;
END LOOP;
END;
END;
but it is not calulation the time and also exception raised and it out of the loop
please help me out
thanks and regards [EDITED by DJM: fixed mega-crappy formatting]
[Updated on: Wed, 20 August 2008 21:24] by Moderator Report message to a moderator
|
|
|
|
|