Type : User defined.
Oracle provided.
go_field('adm_rec_amount');----same block so no need prefix.
--- KEY-NEXT-ITME :
This trigger can use procedure(user defined) like prc_search procedure ;
Example :
PROCEDURE prc_search IS
V_DW_NEW VARCHAR2(4000);
BEGIN
V_DW_NEW :=GET_BLOCK_PROPERTY('EMV_COMPLAIN',DEFAULT_WHERE);
V_DW_NEW := 'company_no = :global.g_company_no';
IF :ctrl_blk.complain_src IS NOT NULL THEN
V_DW_NEW := V_DW_NEW||' AND upper(COMPLAIN_NAME) LIKE ''%''||upper(:CTRL_BLK.COMPLAIN_SRC)|| ''%'' ';
END IF;
GO_BLOCK('EMV_COMPLAIN');
CLEAR_BLOCK(NO_VALIDATE);
SET_BLOCK_PROPERTY('EMV_COMPLAIN',ONETIME_WHERE,V_DW_NEW );
:SYSTEM.MESSAGE_LEVEL:=5;
EXECUTE_QUERY;
:SYSTEM.MESSAGE_LEVEL:=0;
EXCEPTION
WHEN OTHERS THEN
MSGBOX(SQLCODE||' '||SQLERRM);
END;
------WHEN-VALIDATE-ITEM (( Trigger fires when item value is changed).)
example 1:
begin
if :ename is null then
message (‘Employee name cannot be blank’);
message(‘ ‘);
raise form_trigger_failure;
end if;
end;
example 3:
-------When-new-item-instance;
Properties : Item level trigger .
Effect in form :
Image after use this trigger :
Image before use this trigger :
Oracle provided.
go_field('adm_rec_amount');----same block so no need prefix.
--- KEY-NEXT-ITME :
This trigger can use procedure(user defined) like prc_search procedure ;
Example :
PROCEDURE prc_search IS
V_DW_NEW VARCHAR2(4000);
BEGIN
V_DW_NEW :=GET_BLOCK_PROPERTY('EMV_COMPLAIN',DEFAULT_WHERE);
V_DW_NEW := 'company_no = :global.g_company_no';
IF :ctrl_blk.complain_src IS NOT NULL THEN
V_DW_NEW := V_DW_NEW||' AND upper(COMPLAIN_NAME) LIKE ''%''||upper(:CTRL_BLK.COMPLAIN_SRC)|| ''%'' ';
END IF;
GO_BLOCK('EMV_COMPLAIN');
CLEAR_BLOCK(NO_VALIDATE);
SET_BLOCK_PROPERTY('EMV_COMPLAIN',ONETIME_WHERE,V_DW_NEW );
:SYSTEM.MESSAGE_LEVEL:=5;
EXECUTE_QUERY;
:SYSTEM.MESSAGE_LEVEL:=0;
EXCEPTION
WHEN OTHERS THEN
MSGBOX(SQLCODE||' '||SQLERRM);
END;
------WHEN-VALIDATE-ITEM (( Trigger fires when item value is changed).)
example 1:
begin
if :ename is null then
message (‘Employee name cannot be blank’);
message(‘ ‘);
raise form_trigger_failure;
end if;
end;
example 2:
BEGIN
IF :sal < 3000
THEN
MESSAGE (‘Employee sal must NOT be less than 3000’);
MESSAGE(‘ ‘);
raise form_trigger_failure;
end if;
end;
--Here use hr schema table employees filed(EMPLOYEE_ID)
--
begin
message('Here use global variable,record status');
message(:system.record_status);
select :EMPLOYEES.EMPLOYEE_ID into :global.v1
from dual;
if :global.v1 =1
then message(:global.v1);
else
:global.v1:=2;
message(:global.v1);
end if;
end;
screen short :
Properties : Item level trigger .
Effect in form :
Image after use this trigger :
Image before use this trigger :
Block Level Trigger :
When-new-record-instance
Example : Auto number generate:
:PM_RXCHD.MED_SL := :system.trigger_record;
0 comments:
Post a Comment