Translate

Wednesday, June 12, 2019

Trigger for Button ( NEW, SAVE, FIND, CLEAR, EXIT )


To use Trigger:

Right click item > PL/SQL Editor
Select (User-named) > OK

*(User-named) - eg. for button NEW... right click button NEW > Property Palette , then change name from 'PUSH_BUTTON7' to 'BTN_NEW' . Then only Right click item > PL/SQL Editor > Select (User-named) > OK



Trigger for New and Clear Buttons

:course_block.course_name:=''; --assigne the null value to the course_name item on the course_block
:course_block.course_time:='';
:course_block.room:='';

Trigger for Save Button

begin
if :course_block.course_name is not null then
   insert into course (course_name, course_time, room)
   values (:course_block.course_name, :course_block.course_time, :course_block.room);
   message ('1 RECORD WAS INSERTED');
else
   message ('You need to specify a valid course name');
end if;
exception
   when dup_val_on_index then
   message ('A course with this name already exists.');
end;

Trigger for Save Button (Save, Commit, Clear)


begin
if :course_block.course_name is not null then
   insert into course (course_name, course_time, room)
   values (:course_block.course_name, :course_block.course_time, :course_block.room);
   :course_block.course_name:=''; --assigne the null value to the course_name item on the course_block
   :course_block.course_time:='';
   :course_block.room:='';
   message ('1 RECORD WAS INSERTED');
   commit;
else
   message ('You need to specify a valid course name');
end if;
exception
   when dup_val_on_index then
   message ('A course with this name already exists.');
end;


Trigger for Find Button

declare
   a course.course_name%type;
begin
   a:=:course_block.course_name;
   if a is not null then
      select course_name, course_time, room into :course_block.course_name, :course_block.course_time, :course_block.room
      from course where course.course_name=a;
   else
      message ('You need to specify a course name to be able to search courses');
   end if;
   exception
      when no_data_found then
      message ('A course with this name does not exist.');
      :course_block.course_name:='';
      :course_block.course_time:='';
      :course_block.room:='';
end;

Trigger for Exit Button

exit_form();

No comments:

Post a Comment

Text Message

Accounts Receivable-AR setups in Oracle EBS Functional Financials - Apps R12

   1. Oracle Receivables -> Setup -> System ->System Options     a. Receivable GL related setup    b. Transaction and Customer rela...