Home » Developer & Programmer » Forms » how to insert new/next record?
how to insert new/next record? [message #87174] Sun, 12 December 2004 21:11 Go to next message
Dhalan
Messages: 15
Registered: August 2004
Junior Member
hia guys,

im using oracle 8i to develop some program related to attendance.

below are my table

- ic -
- date1 -
- start_am -
- end_pm -

- 0123456 -
- 14-dec-2004 -
- 07:45:30 -
- 16:30:30 -

- -
- -
- -
- -

- -
- -
- -
- -

as you can see from above table, i got some data inside it. my question is can anyone teach me how to insert new/next record with same ic(013456) and date(14-dec-2004) and the only different is just the time for start and end.

the reason y i ask you guys because i want to record how many time the person going out from work.

for you information i use this following coding to generate 1st record. my problem is to insert new record with same ic but different in time

BEGIN

select login_id, name into :keluar_masuk.ic,:keluar_masuk.name 
from jhd.staff
where login_id = :login2.ic;
GO_BLOCK('KELUAR_MASUK');
:KELUAR_MASUK.date1 := to_char(SYSDATE,'DD-MON-YYYY');
  
  
  END;


  DECLARE
 
  STAFF_CHECK_IN exception;
 
 BEGIN


select start_am, end_pm into :keluar_masuk.start_am, :keluar_masuk.end_pm
from keluar_masuk
where icno = :keluar_masuk.icno AND date1 = TO_CHAR(SYSDATE, 'dd-MON-yyyy');
  


  if :keluar_masuk.jam_masuk is null then
   raise STAFF_CHECK_IN;
  end if;

 
-----if data not exist in the database, below statement will automatically generated----------
 
 exception
  
when no_data_found then
select to_char(sysdate, 'hh24:mi:ss') into :keluar_masuk.start_am
from sys.dual;
RAISE Form_Trigger_Failure;
   
when STAFF_CHECK_IN then
select to_char(sysdate, 'hh24:mi:ss') into :keluar_masuk.end_pm
from sys.dual;
delete from keluar_masuk where icno = :keluar_masuk.icno;
RAISE Form_Trigger_Failure;



end;

 

hope anyone can solve my problems. 

thanks guys for trying to help me

god bless you

regards

eboy
 

Re: how to insert new/next record? [message #87202 is a reply to message #87174] Mon, 13 December 2004 23:53 Go to previous message
Niranjan
Messages: 34
Registered: June 2001
Member
Hi,
i suppose u have a multi rec block.
u wanted in new records the 1st 2 items ( empcode and date1) should remain same and rest two user has to enter.

go for a when-new-item-instance of 1st 2 items and write the following.
if :system.cursor_record>1
and
( :system.record_status='NEW'
or
:system.record_status='INSERT'
) then
duplicate_item;
end if;

But the above code will help u only in that case where u want to enter recs for same emo code(1st item).
Hope this helps u.
Previous Topic: object groups&object libraries
Next Topic: List Items Urgent Help plz.
Goto Forum:
  


Current Time: Sun Sep 08 03:47:33 CDT 2024