PER_ALL_ASSIGNMENTS_F

I need to correlate an employee to a supervisor. I am aware this is done through the PER_ALL_ASSIGNMENTS_F table.
How do i populate the PER_ALL_ASSIGNMENTS_F table with supervisor assignments related to person_ids? Is there an API? I can't find the appropriate one.

Whenever You call the create_employee_api, a primary assignment is automatically created with basic information. Then You update that primary assignment with complete information.
For your scenario after creating employee a, you'll get an assignment_id as out parameter. If in the same step, You may use that to update B employee asg after creation. Or if a later step query employee A by a unique key (employee number, ssn) and get the info to update supervised employees.

Similar Messages

  • Optimize the following update on per_all_assignments_F

    Hi
    I am trying to optimize this sql which is taking a long time to complete.
    declare
    cursor c1 is
    select person_id, annual_rt from xxdl.xxdl_papf_scrambling_view;
    begin
    for i in c1
    loop
    update PER_ALL_ASSIGNMENTS_F
    set as_attribute4 = i.annual_rt
    where person_id = i.person_id
    end loop;
    end;
    There are indexes on ass_attribute4, i.annual_rt, person_id, i.person_id.
    per_all_assignments_f is a standard oracle apps table.
    xxdl.xxdl_papf_scrambling_View is a custom table that I created by joining some columns in per_all_people_f and some other views and tables in peoplesoft database. Basically the objective is to scramble the data in oracle based on already scrambled data in peoplesoft. So I create xxdl_papf_scrambling_view using info from psft database (over a db link) and then try to use the information in the custom table to update the ebusiness tables on oracle financials. The updates appears to be working except that some of them like the one above are slow.
    I tried using a corelated update (but it does not work because single row subquery returns more than one row and I was not sure how to join these tables to make it return one row based on how I created the above tables)
    and I used bulk collect and forall but the performance is not any better.
    Any ideas or suggestions.
    Thank you
    Kumar
    Edited by: Kumar Madduri on Nov 2, 2009 6:55 AM

    Hi
    I tried that approach already but the subquery returns more than one row.
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    and this one runs in roughly one hour which I am trying to further reduce
    declare
    cursor c1 is
    select person_id, annual_rt from xxdl.xxdl_papf_scrambling_view;
    type pid_tab is table of xxdl.xxdl_papf_scrambling_view.person_id%type;
    type art_tab is table of xxdl.xxdl_papf_scrambling_view.annual_rt%type;
    pid_tab1 pid_tab;
    art_tab1 art_tab;
    begin
    open c1;
    loop
    fetch c1 bulk collect into pid_tab1, art_tab1;
    forall i in 1..pid_tab1.count
    update PER_ALL_ASSIGNMENTS_F
    set ass_attribute4 = art_tab1(i)
    where person_id = pid_tab1(i);
    exit when c1%notfound;
    end loop;
    close c1;
    end;
    Edited by: Kumar Madduri on Nov 2, 2009 7:09 AM

  • PER_ALL_ASSIGNMENTS_F identifier

    Hi All,
    PER_ALL_ASSIGNMENTS_F is returning 7 rows for a particular assignment_id. If it is not assignment_id, then could you please state what is the unique identifier of PER_ALL_ASSIGNMENTS_F table.
    Thanks.

    Whenever You call the create_employee_api, a primary assignment is automatically created with basic information. Then You update that primary assignment with complete information.
    For your scenario after creating employee a, you'll get an assignment_id as out parameter. If in the same step, You may use that to update B employee asg after creation. Or if a later step query employee A by a unique key (employee number, ssn) and get the info to update supervised employees.

  • Update a DFF in per_all_assignments_f table

    Hello gurus,
    We are storing information from a legacy system in one of the assignment attributes in the per_all_assignments_f table.
    I'm aware that using an API would be the right approach to update any columns on the table.
    I'm curious to know what are the things to check (specifically user hooks) when updating a dff using a simple update statement??
    My question basically is, since I'm updating just a dff, how can I check what are the things that can be  affected by the update statement?
    Thanks

    Hi,
    Quoting the flexfield manual..
    Warning About Changing Data
    Oracle provides powerful tools you can use to insert, update, and delete information in an Oracle database. But, if you use Oracle tools like SQL*Plus or Oracle Data Browser to modify Oracle Applications data, you risk destroying the integrity of your data and you
    lose the ability to audit changes to your data. Because Oracle Applications tables are interrelated, any change you make using an
    Oracle Applications form can update many tables at once. But when you modify Oracle Applications data using anything other than Oracle Applications forms, you may change a row in one table without making corresponding changes in related tables. If your tables get out of synchronization with each other, you risk retrieving erroneous information and you risk unpredictable results throughout Oracle Applications.

  • Per_all_assignments_f in table how to capture change information only

    Hi
    i want to capture in Report Changes Field Summary in Assignment form. When ever change in assignment form , that change information goes in Data Track History Form. In this Data Track History i want to chapture Mainly "Changes Field Summary". how to ? can you please any idea.......

    Hello,
    Please check these FMs:
    CHANGEDOCUMENT_READ_HEADERS    Change document: Read change document header
    CHANGEDOCUMENT_READ_POSITIONS  Change document: Read change document items
    These FMs are designed to read change logs of specific fields. They access data from tables CDHDR and CDPOS.
    Thanks!

  • Any API to Update assignment_category of Per_all_assignments_f

    Hi All,
    Is there any API to update assignment_category of table per_all_assignment_f.
    I didnt find any API that updates assignment_category except for contingent worker. I need to update the assignment_category for normal, active employee.
    Thanks
    Sumit B

    Does hr_assignment_api.update_emp_asg not cover it?
    or, for GB legislation, hr_assignment_api.update_gb_emp_asg ?
    Clive

  • Autopopulating PER_ALL_ASSIGNMENTS_F column fields depending on Job Id.

    Hi,
    Currently the following fields are getting populated in assignment form depending on the Position name.
    1) Payroll
    2) Salary Basis
    3) Working Hours
    4) Frequency
    Now our client want to disable the position field. They want to store these information in Job DFF field. So going forward the above mentioned field need to be populated depending on the Job name in Core HR forms and Self Service pages. I have tried dynamic trigger and API hook. But none of them are working.
    Regards,
    Rakesh.

    Hi Sanjay,
    Thank you for the reply. But we are not looking for any trigger option. Because if we make such trigger on oracle seeded table then later on support from ORACLE would not be possible. Rather if we can do via form personalization then it would be better.
    So I tried it in the following way(form personalization). But it is not working. Please correct me if I am wrong at any steps. Right now I am trying to fetch a constant value after changing the job.
    Condition
    Trigger Event : WHEN-NEW-ITEM-INSTANCE
    Trigger Object : ASSGT.JOB_NAME
    Condition : :SYSTEM.RECORD_STATUS IN ('CHANGED')
    Actions
    Seq - 1
    Type - Property
    Object Type - Item
    Target object - ASSGT.NORMAL_HOURS
    Property Name - VALUE
    Value - 32.12
    But after this when I am changing job name it is not changing the normal hours.
    Regards,
    Rakesh.

  • Query to pick up people of retirement age 1 year in advance

    Hi,
    I wrote the below query to pick up all staff who will be of retirement age in a year's time. This will be used in an alert that must go to payroll 1 year before retirement date, then 6 months before retirement date and then finally 1 month before retirement date.
    select distinct papf.employee_number
    , papf.full_name
    , apps.meds_hr_util_pkg.return_department(papf.person_id) org
    , papf.date_of_birth
    , (select payroll_name from pay_all_payrolls_f where payroll_id = paaf.payroll_id) payroll_name
    , (select first_name||' '||last_name from per_all_people_f where person_id = paaf.supervisor_id and trunc(sysdate) between effective_start_date and effective_end_date) mgr
    , (select email_address from per_all_people_f where person_id = paaf.supervisor_id and trunc(sysdate) between effective_start_date and effective_end_date) mgr_email
    , add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-12) date_12month_advance
    , add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-6) date_6month_advance
    , add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-1) date_1month_advance
    , trunc(months_between(add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-12),papf.date_of_birth)/12) age_12mon
    --into &emp_no, &emp_name, &org, &date_of_birth, &payroll_name, &mgr, &mgr_email, &retirement_date     
    from per_all_people_f papf
    ,per_all_assignments_f paaf
    ,per_person_type_usages_f pptuf
    ,per_person_types ppt
    where papf.person_id = paaf.person_id
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date
    and paaf.primary_flag = 'Y'
    and paaf.assignment_type = 'E'
    and papf.person_id = pptuf.person_id
    and pptuf.person_type_id = ppt.person_type_id
    and trunc(sysdate) between pptuf.effective_start_date and pptuf.effective_end_date
    and ppt.system_person_type = 'EMP'
    and ppt.user_person_type != 'Pensioners'
    and trunc(months_between(add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') )
    ||to_char(sysdate, '-YYYY')),-12),papf.date_of_birth)/12) >= 62
    and trunc(sysdate) in (add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-12)
    , add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-6)
    , add_months(to_date(DECODE(to_char(papf.date_of_birth, 'DD-MON'), '29-FEB', '28-FEB', to_char(papf.date_of_birth, 'DD-MON') ) ||to_char(sysdate, '-YYYY')),-1)
    and to_char(papf.date_of_birth, 'DD-MON') != '29-FEB'
    order by 1
    The query works only when I have this line in
    " and to_char(papf.date_of_birth, 'DD-MON') != '29-FEB' "
    As soon as I remove it I get an ORA-01847: day of month must be between 1 and last day of month error. I can't seem to figure out why because there is 1 person with a birth date of 29-FEB and I am catering for this in the query. Also, I am using TO_DATE for the values so using add_months and months_between should not be an issue.
    Please help....maybe someone else can see something I am missing...
    Thanks
    Shalantha

    Hi,
    To find people who are 65 years old (or older) as of today, you can simply say
    WHERE     date_of_birth <= ADD_MONTHS ( SYSDATE
                                       , -12 * 65
                                )ADD_MONTHS knows how to adjust for leap years, but it may not adjust for them the way you expect.
    If today is February 28, 2013, the condition above will include people born on Februry 29, 1948. That's actually 1 day before they reach 65. If that's a problem, the solution is slightly more complicated.
    If today is March 1, 2013, it will include people born on Februry 29, 1948.
    If today is February 29, 2012 (or February 28, 2012) it will include people born on February 28, 1947, but not people born on March 1, 1947.
    To find people who will be 65 years old (or over) 3 months from today:
    WHERE     date_of_birth <= ADD_MONTHS ( SYSDATE
                                       , (-12 * 65) + 3
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data. Simplify the problem as much as possible.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on May 26, 2011 11:48 AM

  • Query Help in OLM

    I am new to OLM and not aware of the tables much,
    Any idea to build the query for following requirement?
    query to fetch records, who have been enrolled into the training and have not yet completed it.
    They can either be because, they have not completed the course fully or they have not yet completed the test
    Thanks in Advance,
    Vasi

    Hello,
    use below tables to build query,
    ota_delegate_bookings
    ota_events
    ota_offerings
    ota_offerings_tl
    per_all_people_f
    per_all_assignments_f
    Links:- ota_delegate_bookings.delegate_person_id=per_all_people_f.person_id
    i think its useful to u
    --Narendra                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I am not able to assign job_id  in my Assignment api

    Hi
    Can anybody help me
    I am created one for create job using hr_job_api
    What am trying to assign my job_id to assignment api
    logic is
    If the job is not it creates job using job api,
    If job is already exists it assign to assignment api
    CREATE OR REPLACE PROCEDURE xxhr_job_proc IS
    l_assignment_number number;          
    l_assignment_id      number;          
    v_special_ceiling_step_id          number;          
    v_object_version_number           number;     
    V_concatenated_segments      number;     
    V_soft_coding_keyflex_id      number;     
    V_comment_id      number;     
    v_effective_start_date      date;     
    v_effective_end_date      date;     
    V_no_managers_warning      boolean;     
    V_other_manager_warning      boolean;     
    v_num number;     
    v_seg_conc VARCHAR2(2000);     
    l_change_reason                    varchar2(50);     
    l_date_probation_end                date;          
    l_default_code_comb_id               number;          
    l_set_of_books_id               number;     
    G_USER_ID                     number;     
    G_LOGIN_ID                    number;     
    v_resp_id                     number;     
    v_resp_APPL_id                    number;     
    v_assignment_id                    number;
    v_org_id number;
    l_object_version_number number;
    l_effective_date date;
    v_job_id                    NUMBER;
    v_job_definition_id                NUMBER;
    v_business_group_id               NUMBER;
    v_name                          VARCHAR2(240);
    l_job_id                    number;
    l_job_group_id                    number;
    CURSOR Job_emp Is
         SELECT      empl_id
              ,empl_rcd_nbr
              ,effective_date
              ,effective_sequence
              ,rehire_date
              ,probation_date
              ,department
              ,supervisor_id
              ,direct_manager_id
              ,location_code
              ,reason_code
              ,action
              ,salary_grade
              ,job_code
              ,full_or_part_time
              ,hr_responsible_id
         FROM xxhr_job_all;
    BEGIN
         G_USER_ID                := FND_PROFILE.VALUE('USER_ID');
         G_LOGIN_ID                := FND_PROFILE.VALUE('LOGIN_ID');
    v_org_id := FND_PROFILE.VALUE('ORG_ID');
         v_resp_id                := FND_PROFILE.VALUE('RESP_ID');
         v_resp_APPL_id               := FND_PROFILE.VALUE('RESP_APPL_ID');
    v_business_group_id          := FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID');
         FND_GLOBAL.APPS_INITIALIZE(G_USER_ID,v_resp_id,v_resp_APPL_id);
    -- Open the Cursor for Validation
    FOR v_job_emp IN job_emp LOOP
         SELECT fnd_flex_ext.get_ccid('PER',
                             'JOB',
                             101,
                             TO_CHAR(SYSDATE, 'DD-MON-YYYY'),
                             v_job_emp.job_code)
                             INTO v_job_definition_id
                             FROM dual;
    SELECT job_group_id
              INTO l_job_group_id
                   FROM PER_JOB_GROUPS
                        WHERE master_flag = 'Y';
    -- Validation for job code
    BEGIN
         SELECT job_id
              INTO v_job_id
         FROM per_jobs
         WHERE name = v_job_emp.job_code;
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
    FND_FILE.PUT_LINE(FND_FILE.LOG,'There is no job id Exist For this job code'||v_job_emp.job_code);
    WHEN OTHERS THEN
    FND_FILE.PUT_LINE(FND_FILE.LOG,'Error While Inserting a Record'||SQLCODE||SQLERRM);
    END;
    if v_job_id is null then
    hr_job_api.create_job
              (p_validate                => FALSE
              ,p_business_group_id      => v_business_group_id
              ,p_date_from                => SYSDATE
              ,p_job_group_id               => l_job_group_id
              ,p_segment1                => v_job_emp.job_code
              ,p_job_id                => v_job_id
              ,p_job_definition_id           => v_job_definition_id
              ,p_object_version_number      => v_object_version_number
              ,p_name                => v_name
    ELSE
    -- Validation for assignment id
         SELECT      assignment_id
              ,effective_start_date
              ,object_version_number
    INTO     l_assignment_id
              ,l_effective_date
              ,l_object_version_number
         FROM per_all_assignments_f
         WHERE person_id =
         (SELECT person_id
         FROM per_all_people_f
         WHERE employee_number = v_job_emp.empl_id);
    -- Validation for set of book id
         SELECT ho.org_information3
         INTO l_set_of_books_id
         FROM gl_sets_of_books gsb,
         hr_organization_information ho
         WHERE gsb.set_of_books_id = ho.org_information3
         AND ho.org_information_context='Operating Unit Information'
         AND ho.ORGANIZATION_ID = v_org_id;
    -- Validation for code combination id
    SELECT fnd_flex_ext.get_ccid('SQLGL',
                             'GL#',
                             50268,
                             TO_CHAR(SYSDATE,'DD-MON-YYYY'),
                             '50001.1820000281.7501.0000000000.00000.00000'
                             ) INTO l_default_code_comb_id
                             FROM dual;
    hr_assignment_api.update_emp_asg
    (p_validate => FALSE
    ,p_effective_date => sysdate
    ,p_datetrack_update_mode => 'CORRECTION'
    ,p_object_version_number => l_object_version_number
    ,p_assignment_number => NULL --l_assignment_number
         ,p_supervisor_id      => NULL
         ,p_assignment_id      => l_assignment_id
         ,p_default_code_comb_id           => l_default_code_comb_id
         ,p_set_of_books_id           => l_set_of_books_id
         ,p_title                => NULL
         ,p_ass_attribute_category     => v_business_group_id
         ,p_ass_attribute1          => v_job_emp.empl_rcd_nbr
         ,p_ass_attribute2          => v_job_emp.effective_date
         ,p_ass_attribute3          => v_job_emp.effective_sequence
         ,p_ass_attribute4          => v_job_emp.rehire_date
         ,p_ass_attribute5          => v_job_emp.probation_date
         ,p_ass_attribute6          => v_job_emp.department
         ,p_ass_attribute7          => v_job_emp.supervisor_id
         ,p_ass_attribute8          => v_job_emp.direct_manager_id
         ,p_ass_attribute9          => v_job_emp.location_code
         ,p_ass_attribute10          => v_job_emp.reason_code
         ,p_ass_attribute11          => v_job_emp.action
         ,p_ass_attribute12          => v_job_emp.salary_grade
         ,p_ass_attribute13          => v_job_emp.full_or_part_time
         ,p_ass_attribute14          => v_job_emp.hr_responsible_id
    ,p_effective_start_date => v_effective_start_date
    ,p_effective_end_date => v_effective_end_date
    ,p_no_managers_warning => v_no_managers_warning
    ,p_other_manager_warning => v_other_manager_warning
         ,p_comment_id               => V_comment_id
         ,p_soft_coding_keyflex_id     => v_soft_coding_keyflex_id
    ,p_cagr_grade_def_id => v_num
    ,p_cagr_concatenated_segments => v_seg_conc
         ,p_concatenated_segments => V_concatenated_segments
    END IF;
    DBMS_OUTPUT.PUT_LINE('Ex:'||v_job_id||','||v_object_version_number);
    END LOOP;
    COMMIT;
    EXCEPTION
         WHEN OTHERS THEN
              DBMS_OUTPUT.PUT_LINE('Error:'||SQLERRM);
    END;
    Regards
    Samarpan
    Message was edited by:
    Deekshitulu Mantha

    You are not passing the THE CORRECT out parmeters P_JOB_DEFINITION_ID,P_NAME , as looks in your calling API.
    Pass the following parameters
    P_JOB_DEFINITION_ID => l_JOB_DEFINITION_ID
    P_NAME => L_NAME
    Take a note,
    1)P_JOB_DEFINITION_ID is 'In & Out ' parameter in API's.
    If p_validate is false, uniquely identifies the Job Key flexfield combination for this job. If p_validate is true, set to null.
    2)P_NAME Out is OUT paramter in API's
    If p_validate is false, concatenation of all key flexfield segments. If p_validate is true, set to null.
    Hope it works

  • Unable to view data in some HR tables

    Since I upgraded to SQL Developer 2.1.1.64 I have not been able to view data in the data tab for the following tables that I have run accross: per_all_people_f, per_all_assignments_f or per_all_positions_f.
    Other tables that I have been using seem to be working fine, but these I need to use all the time. I get the column numbers returned, but no data or column headings.
    Another co-worker that has upgraded is experiencing the same problem.

    I could not get the ddl to show up on the sql tab in version 2.1.1.64, but I did run it in version 1.5.4 and this is what was returned.
    -- Unable to Render DDL with DBMS_METADATA using internal generator.
    CREATE TABLE HR.PER_ALL_PEOPLE_F
    PERSON_ID NUMBER(10, 0) NOT NULL,
    EFFECTIVE_START_DATE DATE NOT NULL,
    EFFECTIVE_END_DATE DATE NOT NULL,
    BUSINESS_GROUP_ID NUMBER(15, 0) NOT NULL,
    PERSON_TYPE_ID NUMBER(15, 0) NOT NULL,
    LAST_NAME VARCHAR2(150 BYTE) NOT NULL,
    START_DATE DATE NOT NULL,
    APPLICANT_NUMBER VARCHAR2(30 BYTE),
    BACKGROUND_CHECK_STATUS VARCHAR2(30 BYTE),
    BACKGROUND_DATE_CHECK DATE,
    BLOOD_TYPE VARCHAR2(30 BYTE),
    COMMENT_ID NUMBER(15, 0),
    CORRESPONDENCE_LANGUAGE VARCHAR2(30 BYTE),
    CURRENT_APPLICANT_FLAG VARCHAR2(30 BYTE),
    CURRENT_EMP_OR_APL_FLAG VARCHAR2(30 BYTE),
    CURRENT_EMPLOYEE_FLAG VARCHAR2(30 BYTE),
    DATE_EMPLOYEE_DATA_VERIFIED DATE,
    DATE_OF_BIRTH DATE,
    EMAIL_ADDRESS VARCHAR2(240 BYTE),
    EMPLOYEE_NUMBER VARCHAR2(30 BYTE),
    EXPENSE_CHECK_SEND_TO_ADDRESS VARCHAR2(30 BYTE),
    FAST_PATH_EMPLOYEE VARCHAR2(30 BYTE),
    FIRST_NAME VARCHAR2(150 BYTE),
    FTE_CAPACITY NUMBER(5, 2),
    FULL_NAME VARCHAR2(240 BYTE),
    HOLD_APPLICANT_DATE_UNTIL DATE,
    HONORS VARCHAR2(45 BYTE),
    INTERNAL_LOCATION VARCHAR2(45 BYTE),
    KNOWN_AS VARCHAR2(80 BYTE),
    LAST_MEDICAL_TEST_BY VARCHAR2(60 BYTE),
    LAST_MEDICAL_TEST_DATE DATE,
    MAILSTOP VARCHAR2(45 BYTE),
    MARITAL_STATUS VARCHAR2(30 BYTE),
    MIDDLE_NAMES VARCHAR2(60 BYTE),
    NATIONALITY VARCHAR2(30 BYTE),
    NATIONAL_IDENTIFIER VARCHAR2(30 BYTE),
    OFFICE_NUMBER VARCHAR2(45 BYTE),
    ON_MILITARY_SERVICE VARCHAR2(30 BYTE),
    ORDER_NAME VARCHAR2(240 BYTE),
    PRE_NAME_ADJUNCT VARCHAR2(30 BYTE),
    PREVIOUS_LAST_NAME VARCHAR2(150 BYTE),
    PROJECTED_START_DATE DATE,
    REHIRE_AUTHORIZOR VARCHAR2(30 BYTE),
    REHIRE_REASON VARCHAR2(60 BYTE),
    REHIRE_RECOMMENDATION VARCHAR2(30 BYTE),
    RESUME_EXISTS VARCHAR2(30 BYTE),
    RESUME_LAST_UPDATED DATE,
    REGISTERED_DISABLED_FLAG VARCHAR2(30 BYTE),
    SECOND_PASSPORT_EXISTS VARCHAR2(30 BYTE),
    SEX VARCHAR2(30 BYTE),
    STUDENT_STATUS VARCHAR2(30 BYTE),
    SUFFIX VARCHAR2(30 BYTE),
    TITLE VARCHAR2(30 BYTE),
    VENDOR_ID NUMBER(15, 0),
    WORK_SCHEDULE VARCHAR2(30 BYTE),
    WORK_TELEPHONE VARCHAR2(60 BYTE),
    COORD_BEN_MED_PLN_NO VARCHAR2(30 BYTE),
    COORD_BEN_NO_CVG_FLAG VARCHAR2(30 BYTE),
    DPDNT_ADOPTION_DATE DATE,
    DPDNT_VLNTRY_SVCE_FLAG VARCHAR2(30 BYTE),
    RECEIPT_OF_DEATH_CERT_DATE DATE,
    USES_TOBACCO_FLAG VARCHAR2(30 BYTE),
    BENEFIT_GROUP_ID NUMBER(15, 0),
    REQUEST_ID NUMBER(15, 0),
    PROGRAM_APPLICATION_ID NUMBER(15, 0),
    PROGRAM_ID NUMBER(15, 0),
    PROGRAM_UPDATE_DATE DATE,
    ATTRIBUTE_CATEGORY VARCHAR2(30 BYTE),
    ATTRIBUTE1 VARCHAR2(150 BYTE),
    ATTRIBUTE2 VARCHAR2(150 BYTE),
    ATTRIBUTE3 VARCHAR2(150 BYTE),
    ATTRIBUTE4 VARCHAR2(150 BYTE),
    ATTRIBUTE5 VARCHAR2(150 BYTE),
    ATTRIBUTE6 VARCHAR2(150 BYTE),
    ATTRIBUTE7 VARCHAR2(150 BYTE),
    ATTRIBUTE8 VARCHAR2(150 BYTE),
    ATTRIBUTE9 VARCHAR2(150 BYTE),
    ATTRIBUTE10 VARCHAR2(150 BYTE),
    ATTRIBUTE11 VARCHAR2(150 BYTE),
    ATTRIBUTE12 VARCHAR2(150 BYTE),
    ATTRIBUTE13 VARCHAR2(150 BYTE),
    ATTRIBUTE14 VARCHAR2(150 BYTE),
    ATTRIBUTE15 VARCHAR2(150 BYTE),
    ATTRIBUTE16 VARCHAR2(150 BYTE),
    ATTRIBUTE17 VARCHAR2(150 BYTE),
    ATTRIBUTE18 VARCHAR2(150 BYTE),
    ATTRIBUTE19 VARCHAR2(150 BYTE),
    ATTRIBUTE20 VARCHAR2(150 BYTE),
    ATTRIBUTE21 VARCHAR2(150 BYTE),
    ATTRIBUTE22 VARCHAR2(150 BYTE),
    ATTRIBUTE23 VARCHAR2(150 BYTE),
    ATTRIBUTE24 VARCHAR2(150 BYTE),
    ATTRIBUTE25 VARCHAR2(150 BYTE),
    ATTRIBUTE26 VARCHAR2(150 BYTE),
    ATTRIBUTE27 VARCHAR2(150 BYTE),
    ATTRIBUTE28 VARCHAR2(150 BYTE),
    ATTRIBUTE29 VARCHAR2(150 BYTE),
    ATTRIBUTE30 VARCHAR2(150 BYTE),
    LAST_UPDATE_DATE DATE,
    LAST_UPDATED_BY NUMBER(15, 0),
    LAST_UPDATE_LOGIN NUMBER(15, 0),
    CREATED_BY NUMBER(15, 0),
    CREATION_DATE DATE,
    PER_INFORMATION_CATEGORY VARCHAR2(30 BYTE),
    PER_INFORMATION1 VARCHAR2(150 BYTE),
    PER_INFORMATION2 VARCHAR2(150 BYTE),
    PER_INFORMATION3 VARCHAR2(150 BYTE),
    PER_INFORMATION4 VARCHAR2(150 BYTE),
    PER_INFORMATION5 VARCHAR2(150 BYTE),
    PER_INFORMATION6 VARCHAR2(150 BYTE),
    PER_INFORMATION7 VARCHAR2(150 BYTE),
    PER_INFORMATION8 VARCHAR2(150 BYTE),
    PER_INFORMATION9 VARCHAR2(150 BYTE),
    PER_INFORMATION10 VARCHAR2(150 BYTE),
    PER_INFORMATION11 VARCHAR2(150 BYTE),
    PER_INFORMATION12 VARCHAR2(150 BYTE),
    PER_INFORMATION13 VARCHAR2(150 BYTE),
    PER_INFORMATION14 VARCHAR2(150 BYTE),
    PER_INFORMATION15 VARCHAR2(150 BYTE),
    PER_INFORMATION16 VARCHAR2(150 BYTE),
    PER_INFORMATION17 VARCHAR2(150 BYTE),
    PER_INFORMATION18 VARCHAR2(150 BYTE),
    PER_INFORMATION19 VARCHAR2(150 BYTE),
    PER_INFORMATION20 VARCHAR2(150 BYTE),
    PER_INFORMATION21 VARCHAR2(150 BYTE),
    PER_INFORMATION22 VARCHAR2(150 BYTE),
    PER_INFORMATION23 VARCHAR2(150 BYTE),
    PER_INFORMATION24 VARCHAR2(150 BYTE),
    PER_INFORMATION25 VARCHAR2(150 BYTE),
    PER_INFORMATION26 VARCHAR2(150 BYTE),
    PER_INFORMATION27 VARCHAR2(150 BYTE),
    PER_INFORMATION28 VARCHAR2(150 BYTE),
    PER_INFORMATION29 VARCHAR2(150 BYTE),
    PER_INFORMATION30 VARCHAR2(150 BYTE),
    OBJECT_VERSION_NUMBER NUMBER(9, 0),
    DATE_OF_DEATH DATE,
    ORIGINAL_DATE_OF_HIRE DATE,
    TOWN_OF_BIRTH VARCHAR2(90 BYTE),
    REGION_OF_BIRTH VARCHAR2(90 BYTE),
    COUNTRY_OF_BIRTH VARCHAR2(90 BYTE),
    GLOBAL_PERSON_ID VARCHAR2(30 BYTE),
    COORD_BEN_MED_PL_NAME VARCHAR2(80 BYTE),
    COORD_BEN_MED_INSR_CRR_NAME VARCHAR2(80 BYTE),
    COORD_BEN_MED_INSR_CRR_IDENT VARCHAR2(80 BYTE),
    COORD_BEN_MED_EXT_ER VARCHAR2(80 BYTE),
    COORD_BEN_MED_CVG_STRT_DT DATE,
    COORD_BEN_MED_CVG_END_DT DATE,
    PARTY_ID NUMBER(15, 0),
    NPW_NUMBER VARCHAR2(30 BYTE),
    CURRENT_NPW_FLAG VARCHAR2(30 BYTE),
    GLOBAL_NAME VARCHAR2(240 BYTE),
    LOCAL_NAME VARCHAR2(240 BYTE)
    , CONSTRAINT PER_PEOPLE_F_PK PRIMARY KEY
    PERSON_ID,
    EFFECTIVE_START_DATE,
    EFFECTIVE_END_DATE
    ENABLE
    TABLESPACE "HR_DATA_SPACE_01"
    LOGGING
    PCTFREE 10
    PCTUSED 40
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 48K
    NEXT 8000K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PEOPLE_F_FK1 FOREIGN KEY
    BUSINESS_GROUP_ID
    REFERENCES HR.HR_ALL_ORGANIZATION_UNITS
    ORGANIZATION_ID
    ) ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PEOPLE_F_FK2 FOREIGN KEY
    PERSON_TYPE_ID
    REFERENCES HR.PER_PERSON_TYPES
    PERSON_TYPE_ID
    ) ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT HR_PER_DATE_OF_DEATH CHECK
    (DATE_OF_DEATH >= DATE_OF_BIRTH)
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_ON_MILITARY_SRV_CHK CHECK
    (ON_MILITARY_SERVICE IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_DPDNT_VLNTRY_SVCE_FLAG_CHK CHECK
    (DPDNT_VLNTRY_SVCE_FLAG in ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_SECOND_PASSPORT_CHK CHECK
    (SECOND_PASSPORT_EXISTS IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_FAST_PATH_EMPLOYEE_CHK CHECK
    (FAST_PATH_EMPLOYEE IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_COORD_BEN_NO_CVG_FLAG CHECK
    (COORD_BEN_NO_CVG_FLAG in ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_RESUME_EXISTS_CHK CHECK
    (RESUME_EXISTS IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_SEX_CHK CHECK
    (SEX IN ('M', 'F'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_EXPENSE_CHECK_SEND_CHK CHECK
    (EXPENSE_CHECK_SEND_TO_ADDRESS IN ('H', 'O', 'P'))
    ENABLE
    CREATE INDEX HR.CSUH_PPF_ATTR12_IDX ON HR.PER_ALL_PEOPLE_F (ATTRIBUTE12 ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE
    INITIAL 1M
    NEXT 104K
    MINEXTENTS 1
    MAXEXTENTS 8192
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.CSUH_PPF_ATTR1_IDX ON HR.PER_ALL_PEOPLE_F (ATTRIBUTE1 ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 560K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 8192
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N1 ON HR.PER_ALL_PEOPLE_F (UPPER(FULL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N2 ON HR.PER_ALL_PEOPLE_F (UPPER(LAST_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N50 ON HR.PER_ALL_PEOPLE_F (LAST_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 496K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N51 ON HR.PER_ALL_PEOPLE_F (EMPLOYEE_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 328K
    NEXT 80K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N52 ON HR.PER_ALL_PEOPLE_F (APPLICANT_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 8K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N53 ON HR.PER_ALL_PEOPLE_F (NATIONAL_IDENTIFIER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 496K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N54 ON HR.PER_ALL_PEOPLE_F (FULL_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 760K
    NEXT 240K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N55 ON HR.PER_ALL_PEOPLE_F (PARTY_ID ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N56 ON HR.PER_ALL_PEOPLE_F (NPW_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N57 ON HR.PER_ALL_PEOPLE_F (UPPER(GLOBAL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N58 ON HR.PER_ALL_PEOPLE_F (UPPER(LOCAL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N59 ON HR.PER_ALL_PEOPLE_F (EMAIL_ADDRESS ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N60 ON HR.PER_ALL_PEOPLE_F (GLOBAL_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    ;

  • Display of data in a single row

    Hi
    Here is my query:
    SELECT
    --Element Classification Details:
    pec.CLASSIFICATION_ID,
    pec.classification_name,
    pec1.classification_id "Sub Classification Id",
    DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions',
    'Others Voluntary Deductions', 'Other Deductions',
    'Personal Deductions', 'Personal Deductions',
    'Personal Voluntary Deductions', 'Personal Deductions',
    'Car Loan Deductions') "Sub Classification",
    pec1.parent_classification_id,
    scr.sub_classification_rule_id,
    --Element Details:
    pet.element_name, pet.element_type_id, pet.reporting_name,
    DECODE(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
    pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
    --Run Result Details:
    prr.run_result_id,
    TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)) "Amount",
    piv.NAME "Input Value",
    --Assignment Details:
    paa.assignment_id,
    --Time Period
    ptp.START_DATE, ptp.end_date,
    ptp.period_name "Payroll Period"
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv,
    hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0
    AND paa.ASSIGNMENT_ID = '560'
    I needed to display the amounts as separate columns pertaining to different elements or rather different sub classification of the elements
    This is the final expected result for the report:
    Employee Personal Deductions PD Amount Other Deductions OD Amt
    XYZ Element1 00000.00 Element3 0000.00
    Element 2
    Car Loan Deductions CLD Amt Total Deductions (Total of all three)
    Element4 00000.00 00000000.00
    Here Personal Deductions, Other, Car Loan etc. are grouping of elements (sub classifications)
    I have used MAX function to display the results as separate columns like this:
    SELECT
    --Run Result Details:
    prr.run_result_id,
    MAX(DECODE(pec1.classification_name, 'Personal Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal Deductions",
    MAX(DECODE(pec1.classification_name, 'Personal Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal V Deductions",
    MAX(DECODE(pec1.classification_name, 'Other Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Other Deductions",
    MAX(DECODE(pec1.classification_name, 'Others Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Others V Deductions",
    MAX(DECODE(pec1.classification_name, 'Car Loan Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Car Loan Deductions"
    /*--Assignment Details:
    paa.assignment_id,
    --Time Period
    ptp.START_DATE, ptp.end_date,
    ptp.period_name "Payroll Period"*/
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv
    /*hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp*/
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    /*AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    --and pet.element_NAME like 'IVTB%' 
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE*/
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    --and paa.PRIMARY_FLAG like 'Y%'
    /*AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0*/
    GROUP BY
    prr.run_result_id
    However, the fact is that my each element_type_id has each run_result_id, which means 1 element has 1 run result id. Thus, I cannot display the data in a single row.
    Can someone guide me on this? How can I display the data for an employee as a single row?
    Thanks and regards,
    Aparna

    SELECT EMP_ID,
         Sum(Decode(DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions','Others Voluntary Deductions', 'Other Deductions'),'Other Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Other deduction',
         sum(Decode(DECODE(pec1.classification_name,'Personal Deductions', 'Personal Deductions', 'Personal Voluntary Deductions', 'Personal Deductions'),'Personal Deductions'),TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Personal deduction',
         sum(DECODE(pec1.classification_name,'Car Loan Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Car deduction'
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv,
    hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0     
    I hope this may help!
    Brijesh

  • TWO ERRO ORA-01427: single-row subquery returns more than one row

    Hi,
    I have a procedure which contains a cursor. If i run the select statement in the cursor separetly, it returns only value and works fine. But the same select statement in the cursor of a procedure throws me the error as below:
    TWO ERRO ORA-01427: single-row subquery returns more than one row
    Not sure what going on...any help appreciated.
    Below is the select statement:
    SELECT DISTINCT PSE.PARENT_POSITION_ID,
    (SELECT DISTINCT PPD1.SEGMENT2
    FROM PER_POSITION_DEFINITIONS PPD1,
    HR_ALL_POSITIONS_F HAPF2,
    PER_POS_STRUCTURE_ELEMENTS PSE2
    WHERE TRUNC(SYSDATE) BETWEEN
    HAPF2.EFFECTIVE_START_DATE AND
    HAPF2.EFFECTIVE_END_DATE
    AND PPD1.POSITION_DEFINITION_ID =
    HAPF2.POSITION_DEFINITION_ID
    AND
    HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
    AND PSE2.PARENT_POSITION_ID =
    PSE.PARENT_POSITION_ID
    AND ROWNUM = 1) SEGMENT2,
    (SELECT DISTINCT PAPF1.FIRST_NAME || ' ' ||
    PAPF1.LAST_NAME CHIEF_NAME
    FROM PER_ALL_PEOPLE_F PAPF1,
    PER_ALL_ASSIGNMENTS_F PAAF1
    WHERE TRUNC(SYSDATE) BETWEEN
    PAPF1.EFFECTIVE_START_DATE AND
    PAPF1.EFFECTIVE_END_DATE
    AND TRUNC(SYSDATE) BETWEEN
    PAAF1.EFFECTIVE_START_DATE AND
    PAAF1.EFFECTIVE_END_DATE
    AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
    AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
    AND ROWNUM = 1) CHIEF_NAME
    FROM PER_POS_STRUCTURE_ELEMENTS PSE,
    HR_ALL_POSITIONS_F HAPF,
    PER_POSITION_DEFINITIONS PPD
    WHERE PSE.SUBORDINATE_POSITION_ID = 52744
    AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND
    HAPF.EFFECTIVE_END_DATE
    AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
    AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;
    Thanks
    PK
    Edited by: user539616 on Jun 30, 2009 6:30 PM

    Hi,
    The cursor has a different parameter? Maybe the query is not exactly the same. Could you check this?
    This is your query (formatted):
    SELECT DISTINCT PSE.PARENT_POSITION_ID,
                    (SELECT DISTINCT PPD1.SEGMENT2
                       FROM PER_POSITION_DEFINITIONS   PPD1,
                            HR_ALL_POSITIONS_F         HAPF2,
                            PER_POS_STRUCTURE_ELEMENTS PSE2
                      WHERE TRUNC(SYSDATE) BETWEEN HAPF2.EFFECTIVE_START_DATE AND
                            HAPF2.EFFECTIVE_END_DATE
                        AND PPD1.POSITION_DEFINITION_ID = HAPF2.POSITION_DEFINITION_ID
                        AND HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
                        AND PSE2.PARENT_POSITION_ID = PSE.PARENT_POSITION_ID
                        AND ROWNUM = 1) SEGMENT2,
                    (SELECT DISTINCT PAPF1.FIRST_NAME || ' ' || PAPF1.LAST_NAME CHIEF_NAME
                       FROM PER_ALL_PEOPLE_F      PAPF1,
                            PER_ALL_ASSIGNMENTS_F PAAF1
                      WHERE TRUNC(SYSDATE) BETWEEN PAPF1.EFFECTIVE_START_DATE AND
                            PAPF1.EFFECTIVE_END_DATE
                        AND TRUNC(SYSDATE) BETWEEN PAAF1.EFFECTIVE_START_DATE AND
                            PAAF1.EFFECTIVE_END_DATE
                        AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
                        AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
                        AND ROWNUM = 1) CHIEF_NAME
      FROM PER_POS_STRUCTURE_ELEMENTS PSE,
           HR_ALL_POSITIONS_F         HAPF,
           PER_POSITION_DEFINITIONS   PPD
    WHERE PSE.SUBORDINATE_POSITION_ID = 52744
       AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND HAPF.EFFECTIVE_END_DATE
       AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
       AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;Tips: To put formatted code you must use {noformat}{noformat} tags, start tag and end tag are the same,you don't need to put '/' in the close tag.
    Regards,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Removing the Duplicate Values from output without using Keyword DISTINCT

    Hi,
    I'm running the below query without DISTINCT Keyword and getting Duplicate results. can you please tell me what needs to be done if I want unique values without using Distinct.
    select hra.Location_code
    ,hra.Description
    ,hra.Address_line_1
    ,hra.Address_line_2
    ,hra.Address_line_3
    ,hra.town_or_city
    ,hra.Region_1
    ,hra.Postal_Code
    ,hra.country
    ,hra.attribute1
    ,hra.attribute5
    ,hra.attribute6
    ,hra.attribute8
    ,hra.attribute9
    ,hra.attribute2
    ,hra.attribute3
    ,hra.attribute4
    ,hra.attribute7
    ,hra.attribute10
    from hr_locations_all hra
    ,per_all_people_f papf
    ,per_person_types ppt
    , per_person_type_usages_f pptuf
    ,hr_all_organization_units haou
    ,hr_all_organization_units haou1
    where 1=1
    and hra.business_group_id = papf.business_group_id
    and hra.business_group_id = ppt.business_group_id
    and pptuf.person_id = papf.person_id
    and pptuf.person_type_id = ppt.person_type_id
    and ppt.system_person_type = 'EMP'
    and ((hra.inactive_date is null) or (trunc(hra.inactive_date)>= to_date('01/01/2012','mm/dd/yyyy')))
    and to_date('01/01/2012','mm/dd/yyyy') between trunc(pptuf.effective_start_date) and trunc(pptuf.effective_end_date)
    and((papf.effective_end_date is null) or (trunc(papf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
    and ((haou1.date_to is null) or (trunc(haou1.date_to)>= to_date('01/01/2012','mm/dd/yyyy')))
    and papf.business_group_id = haou.organization_id
    and hra.location_id = haou1.location_id;

    Hi,
    Try using this Code
    select hra.Location_code
    ,hra.Description
    ,hra.Address_line_1
    ,hra.Address_line_2
    ,hra.Address_line_3
    ,hra.town_or_city
    ,hra.Region_1
    ,hra.Postal_Code
    ,hra.country
    ,hra.attribute1
    ,hra.attribute5
    ,hra.attribute6
    ,hra.attribute8
    ,hra.attribute9
    ,hra.attribute2
    ,hra.attribute3
    ,hra.attribute4
    ,hra.attribute7
    ,hra.attribute10
    from hr_locations_all hra
    ,per_all_people_f papf,
    per_all_assignments_f paaf,
    per_person_types ppt
    , per_person_type_usages_f pptuf
    ,hr_all_organization_units haou
    --,hr_all_organization_units haou1
    where 1=1
    and
    hra.business_group_id = papf.business_group_id
    and hra.business_group_id = ppt.business_group_id
    and pptuf.person_id = papf.person_id
    and papf.person_id=paaf.person_id
    and pptuf.person_type_id = ppt.person_type_id
    and ppt.system_person_type = 'EMP'
    --and ((hra.inactive_date is null) or (trunc(hra.inactive_date)>= to_date('01/01/2012','mm/dd/yyyy')))
    and to_date('01/01/2012','mm/dd/yyyy') between trunc(pptuf.effective_start_date) and trunc(pptuf.effective_end_date)
    --and((papf.effective_end_date is null) or (trunc(papf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
    --and((paaf.effective_end_date is null) or (trunc(paaf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
    and to_date('01/01/2012','mm/dd/yyyy') between trunc(papf.effective_start_date) and trunc(papf.effective_end_date)
    and to_date('01/01/2012','mm/dd/yyyy') between trunc(paaf.effective_start_date) and trunc(paaf.effective_end_date)
    --and ((haou1.date_to is null) or (trunc(haou1.date_to)>= to_date('01/01/2012','mm/dd/yyyy')))
    --and papf.business_group_id = haou.organization_id
    and paaf.location_id=hra.location_id
    and paaf.organization_id=haou.organization_id
    --and papf.employee_number='1010008830'
    and hra.location_id = haou.location_id;

  • How to handle mid month proration in a calendar to month payroll

    Appreciate if some 1 can help in handling the mid month proration in a calendar to month payroll.
    i.e if an employee desides to quit his job by giving a 24 hours notice say in the middle of the month, then how can one handle such cases in monthly payroll calculations?
    Plz help me......!
    regards

    1. Create a Proration Event Group grouping all the events (here date track update on assignment_status_id of per_all_assignments_f). Attach the event group to elements that you want to prorate.
    2. Write a Proration Formula (Formula Type Payroll Run Proration) sth like this.
    inputs are pay_value,
    proration_start(date),
    proration_end(date)
    l_days = days_between(prorate_end,prorate_start) + 1
    pay_value = pay_value * l_days / 31 /* instead of hardcoding 31 u can get the days_between period start and period end db items */
    return pay_value.
    3. Attach the above proration formula to the elements that you want to prorate ( element screen > proration tab)
    Hope this helps.
    Regards,
    sharath

Maybe you are looking for

  • Edit to tape in Final Cut Studio 2 question

    This entire week we've been dividing time and shoots using one camera, a Panasonic DVX100A. As a result I think the settings on our camera and computer have changed a bit between shoots. That being said I'm having a problem doing an 'Edit to Tape' fr

  • Logic for stock aging report

    I am trying to create a stockaging report using 0IC_C03. I am see that the tables actually stores the qty recieved and issued of an article on a particular day/period. Can some one explain how it is being used in aging? How is it used to compute agai

  • Screen to tv via hdmi

    I have a tendency to elaborate so i will make this short sweet and simpleProblem: damage screen on hp stream laptopTroubleshooting steps taken:hdmi cable swap out ( both hdmi cables worked tested on bluray player)Tv hdmi ports reset and testedTried f

  • Can't get Rogers.ca accounts to work on iPad 2 ??

    Anyone know how to get cogeco.ca accounts to work on IPad 2??

  • Trouble creating List of Channels in SunOne Portal

    Hi, I am trouble creating new channel withlist of all the channels availbale in the portal. If any body can help in this that will be really great. Thank you,