Help me! I do not want the date and user to change if only a a copy of the report is printed. How do I do that?
function AfterReport return boolean is
CURSOR C IS
SELECT USER, sysdate, DOC_STATE_NO
FROM DUAL, DOC_STATE
WHERE DOC_STATE_DESC LIKE 'PRINTED';
V_USER VARCHAR2(8);
V_DATE DATE;
V_DOC_STATE_NO NUMBER;
begin
IF :P_DOC_NO IS NOT NULL THEN
OPEN C;
FETCH C
INTO V_USER, V_DATE, V_DOC_STATE_NO;
IF C%NOTFOUND THEN
RAISE NO_DATA_FOUND;
END IF;
CLOSE C;
UPDATE DOCUMENT
SET PRINTED_DATE = V_DATE
WHERE DOC_NO = :P_DOC_NO;
UPDATE DOCUMENT
SET STATE_CHANGE_USER = V_USER
WHERE DOC_NO = :P_DOC_NO;
UPDATE DOCUMENT
SET STATE_CHANGE_DATE = V_DATE
WHERE DOC_NO = :P_DOC_NO;
UPDATE DOCUMENT
SET DOC_STATE_NO = V_DOC_STATE_NO
WHERE DOC_NO = :P_DOC_NO;
COMMIT;
END IF;
return (TRUE);
end;