I write a cursor in button trigger "WHEN BUTTON PRESSED":
In this i have to insert values in table if user enter the date in ":TM.NEW_APP" column if that column is null then update the data in table
DECLARE
CURSOR C1
IS
SELECT DISTINCT (CID) AS id1,
cname,
contact,
app_date,
old_remarks,
new_app,
new_remarks,
s_date,
t_id
FROM TRA_MASTER;
BEGIN
GO_BLOCK ('TM');
FIRST_RECORD;
FOR I IN C1
LOOP
IF ( :TM.NEW_APP IS NOT NULL)
THEN
INSERT INTO TRA_MASTER
VALUES ( :TM.ID,
:TM.name,
:TM.contact,
:TM.app_date,
:TM.old_remarks,
:TM.new_app,
:TM.new_remarks,
:TM.s_date,
:TM.t_id);
ELSE
UPDATE TRA_MASTER
SET S_DATE = SYSDATE
WHERE CID = :tm.ID;
END IF;
NEXT_RECORD;
END LOOP;
CLEAR_RECORD;
FIRST_RECORD;
END;
When i tried to run this code, it shows
FRM-40102: Record must be entered or deleted first.
Moreover it's also not terminating
[EDITED by LF: formatted code and applied [code] tags]
[Updated on: Fri, 01 December 2017 04:20] by Moderator
Report message to a moderator