APIs Vs Interfaces
APIs Vs Interfaces
The term Open Interfaces actually refers to table driven interfaces, where you put
data in a table that sits between your external application and the Oracle module
you are interfacing with.
The term API refers to stored procedure driven interfaces, where you call a stored
procedure to perform an action within an Oracle Module, and the data from your
external application is passed through the stored procedure’s parameters.
Historically, there were only table driven interfaces and they were called Open
Interfaces. Later, stored procedures were added and were called APIs.
API – it’s validating the record(s) and inserting directly into base tables. (if
any error occurs, it’s just thrown an error at run time.)
Interface – Loads the data through interface table(s) and error-out record(s)
histories’ available in the same interface tables or provided error tables.
———————————————————————————————————-
Oracle APIs:
Oracle APIs are a logical grouping of all external process routines. The Oracle
HRMS API sets delivers a set of PL/SQL packages procedures and functions that
provide an open interface to the database.
——————————————————————————————————————-
Example……
An example call to the create_employee API where the business group method of
employee number generation is manual, the default employee person type is required
and the e-mail attributes do not need to be set.
declare
l_emp_num varchar2(30);
l_person_id number;
l_assignment_id number;
l_per_object_version_number number;
l_asg_object_version_number number;
l_per_effective_start_date date;
l_per_effective_end_date date;
l_full_name varchar2(240);
l_per_comment_id number;
l_assignment_sequence number;
l_assignment_number varchar2(30);
l_name_combination_warning boolean;
l_assign_payroll_warning boolean;
l_orig_hire_warning boolean;
begin
--
-- Set variable with the employee number value,
-- which is going to be passed into the API.
--
l_emp_num := 4532;
--
-- Put the new employee details in the database
-- by calling the create_employee API
--
hr_employee_api.create_employee
(p_hire_date =>
to_date('06-06-1996','DD-MM-YYYY')
,p_business_group_id => 23
,p_last_name => 'Bloggs'
,p_sex => 'M'
,p_employee_number => l_emp_num
,p_person_id => l_person_id
,p_assignment_id => l_assignment_id
,p_per_object_version_number => l_per_object_version_number
,p_asg_object_version_number => l_asg_object_version_number
,p_per_effective_start_date => l_per_effective_start_date
,p_per_effective_end_date => l_per_effective_end_date
,p_full_name => l_full_name
,p_per_comment_id => l_per_comment_id
,p_assignment_sequence => l_assignment_sequence
,p_assignment_number => l_assignment_number
,p_name_combination_warning => l_name_combination_warning
,p_assign_payroll_warning => l_assign_payroll_warning
,p_orig_hire_warning => l_orig_hire_warning
);
end;
Note: The database column for employee_number is defined as varchar2 to allow for
when the business group method of employee_number generation is set to National
Identifier.
Example……
DECLARE
— Local Variables
— ———————–
lc_dt_ud_mode VARCHAR2(100) := NULL;
ln_assignment_id NUMBER := 33561;
ln_supervisor_id NUMBER := 2;
ln_object_number NUMBER := 1;
ln_people_group_id NUMBER := 1;
BEGIN
— Find Date Track Mode
— ——————————–
dt_api.find_dt_upd_modes
( p_effective_date => TO_DATE(’12-JUN-2011′),
p_base_table_name => ‘PER_ALL_ASSIGNMENTS_F’,
p_base_key_column => ‘ASSIGNMENT_ID’,
p_base_key_value => ln_assignment_id,
— Output data elements
— ——————————–
p_correction => lb_correction,
p_update => lb_update,
p_update_override => lb_update_override,
p_update_change_insert => lb_update_change_insert
);
IF ( lb_correction = TRUE )
THEN
— CORRECTION
— ———————-
lc_dt_ud_mode := ‘CORRECTION’;
END IF;
IF ( lb_update = TRUE )
THEN
— UPDATE
— ————–
lc_dt_ud_mode := ‘UPDATE’;
END IF;
IF ( lb_correction = TRUE )
THEN
— CORRECTION
— ———————-
lc_dt_ud_mode := ‘CORRECTION’;
END IF;
IF ( lb_update = TRUE )
THEN
— UPDATE
— ————–
lc_dt_ud_mode := ‘UPDATE’;
END IF;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
dbms_output.put_line(SQLERRM);
END;
/
SHOW ERR;
In Oracle On Terminate screen, select Actual Process Date and/or Final Process Date
and click on Terminate button. Optionally, enter ‘Leaving Reason,’ ‘Notified,’
‘Projected,’ ‘Last Standard Proces’ values. These are API’s are available for
termination
Hr_ex_employee_api (File name: peexeapi.pkb) This file contains three (3)
procedures.....
hr_ex_employee_api.actual_termination_emp
hr_ex_employee_api.update_term_details_emp
hr_ex_employee_api.final_process_emp
Note: The API's have to be called in that order.
Address Insert or Update:
Qualifications:
Insert or create a qualifications information :
per_qualifications_api.create_qualification
update qualifications records : per_qualifications_api.update_qualification
Jobs:
Create new Job : hr_job_api.create_job
Updating the job details : hr_job_api.update_job
Positions
Create new position : hr_position_api.create_position
Updating the position details : hr_position_api.update_position