Insert Form Trigger in a Report

To discuss Oracle Forms & Reports related technical issues.
Post Reply
najm
Posts: 74
Joined: Wed Apr 05, 2006 8:04 am
Location: Pakistan

Insert Form Trigger in a Report

Post by najm »

Dear
I have a trigger in a Form (When-Button-Pressed) i want to use this Trigger on a button on Report runtime My tigger is

DECLARE
CURSOR C1 IS
SELECT NEW.CID,NEW.SNO,NEW.MT,GS.GP,GS.GRADE,c.CRHOURS chr, GS.GP*c.CRHOURS tp
FROM GRADING_SYSTEM GS,myclass my,course c,(
SELECT CA.CID,CA.SNO,CEIL(NVL(SUM(CA.MARKS),0)) MT
FROM STCA CA,ASST M
WHERE CA.AID = M.ID
AND M.T='Y'
AND CA.CID = :myclass.id

GROUP BY CA.CID,CA.SNO) NEW
WHERE NEW.MT = GS.NO
and new.cid = my.id
and my.cno = c.id;

C2 C1%ROWTYPE;
ATC NUMBER;
tp number(5,5):=0;
BEGIN

Set_Alert_Property('A1', ALERT_MESSAGE_TEXT, 'After grading, this class will be locked. Do you really want to grade class?');
atc :=show_alert('a1');

if atc=alert_button1 then
update myclass
set LOCK_STATUS = 'LOCKED'
WHERE ID = :MYCLASS.ID;
COMMIT;

OPEN C1;
LOOP
FETCH C1 INTO C2;
EXIT WHEN C1%NOTFOUND;
UPDATE STCLASS
SET TOTAL=C2.MT,GRADE=C2.GRADE,POINT=C2.GP ,CRHOURS = c2.chr,tpoint = c2.tp
WHERE STCLASS.SNO = C2.SNO
AND STCLASS.CID = C2.CID
and (stclass.grade In('A','B','C','B+','C+','F')OR STCLASS.GRADE IS NULL);

END LOOP;
COMMIT;

CLOSE C1;

GO_BLOCK('ASST_DEF');
EXECUTE_QUERY;
---------

-----------------
Set_Alert_Property('A2', ALERT_MESSAGE_TEXT, 'CLASS HAS BEEN GRADED AND LOCKED');
atc :=show_alert('a2');
Set_Item_Property('MYCLASS.P_GRADE',ENABLED,PROPERTY_FALSE);

else
message('OK..........!');
end if;
end;

Can i use this on a Report if yes pleae tell me the procedure.


Thanks
riv_sax
Posts: 16
Joined: Thu Aug 31, 2006 8:14 am
Location: South Africa

Post by riv_sax »

<img src=images/speech/icon_speech_oops.gif border=0 width=29 height=15>

i think you won't be able to write this code directly in the report trigger as the SQL code will return error as we need srw.do_sql pckage to use that

rivon
najm
Posts: 74
Joined: Wed Apr 05, 2006 8:04 am
Location: Pakistan

Post by najm »

Please let me know how can i do this through srw.do_sql pckage.

Thanks
Cheers
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 3 guests