Wednesday, August 29, 2012

HR: Create Person Extra infromation using API

Following HR (11i) api can be used for creating person extra information, below example show you how to insert a employee passport details into extra information tables using api.

Procedure create_pp_details(p_pp_country In Varchar2 -- passport issuing country
                            ,p_pp_number  In Varchar2 -- passport number
                            ,p_pp_issue_date In date -- passport issue date
                            ,p_pp_expiry_date In Date -- passport expiry date
                            ,p_pp_issue_place In Varchar2 -- passport issue place
                            ,p_person_id In Number
                            )

Is
  l_person_extra_info_id  Number;
   l_object_version_number Number;
 

Begin
 

 hr_person_extra_info_api.create_person_extra_info
    (p_validate                    => false
    ,p_person_id                   => p_person_id     -- employee person id
    ,p_information_type            => 'PASSPORT_DETAILS' -- this is same as your extra person information flex filed code.
    ,p_pei_attribute_category      => null
    ,p_pei_information_category    => 'PASSPORT_DETAILS' -- this is same as your extra person information flex filed code.
    ,p_pei_information1            =>  p_pp_country
    ,p_pei_information2            => p_pp_number
    ,p_pei_information3            => to_char(p_pp_issue_date,'RRRR/MM/DD HH:MI:SS')
    ,p_pei_information4            => to_char(p_pp_expiry_date,'RRRR/MM/DD HH:MI:SS')
    ,p_pei_information5            => p_pp_issue_place
    ,p_person_extra_info_id        => l_person_extra_info_id  -- out values
    ,p_object_version_number       => l_object_version_number -- out values

    );
 commit;
end;


Tuesday, August 21, 2012

ORA-01927: cannot REVOKE privileges you did not grant

Means you didn't grant to the user.

use the follwing dba table to find out details of grant privleges

dba_tab_privs

Insert %rowtype variable directly into a table

Can I insert a %rowtype variable directly into table without specifying each column?
Ans: Yes

 Normally we are putting open and closed brackets after values. Remove these brackets in the case %rowtype variable.

Syntax:
Insert into << values >><<%rowtype variable>>


eg: 
Procedure create_emp(p_emp_rec In emp%rowtype)
Is
Begin
insert into emp values p_emp_rec;
End create_emp;