Updating a record using pay element using the API (Almost Done)

Hi Everyone,
I have a question about updating a record using the PAY_ELEMENT_ENTRY_API.update_element_entry
I have process that doesn't error out, but its doesn't seem to update the record. So my question is, is the query below the correct way to get the element name and object version number when using this API? If not, what do I need to do?
BEGIN
SELECT MAX(pee.element_entry_id)
INTO x_element_id_mgr
FROM pay_element_types_f pet,
pay_element_links_f pel,
pay_element_entries_f pee,
per_all_assignments_f paaf,
per_all_people_f papf
WHERE pee.element_link_id = pel.element_link_id
AND pel.element_type_id = pet.element_type_id
AND paaf.assignment_id = pee.assignment_id
AND papf.person_id = paaf.person_id
AND pet.element_name = 'Mgr Rec Pct'
AND sysdate BETWEEN pee.effective_start_date AND pee.effective_end_date
AND sysdate BETWEEN pel.effective_start_date AND pel.effective_end_date
AND sysdate BETWEEN pet.effective_start_date AND pet.effective_end_date
AND sysdate BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND sysdate BETWEEN papf.effective_start_date AND papf.effective_end_date
AND paaf.assignment_id = c_staging.assignment_id
AND papf.person_id = c_staging.person_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
--ROLLBACK TO s1;
v_error_message := 'For employee number '||c_staging.employee_number||' No data found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
WHEN OTHERS THEN
--ROLLBACK TO s1;
v_error_message := 'For employee number '||c_staging.employee_number||' Error found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
END;
--- Get OVN
BEGIN
SELECT MAX(Object_version_number)
INTO x_ele_object_version_number
FROM pay_element_entries_f
WHERE element_entry_id = x_element_id_mgr;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct ' || SUBSTR(sqlerrm, 1, 200);
DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
WHEN OTHERS THEN
v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
END;

Your SQL isn't bad, although you're including loads of tables you don't need to so it's probably not as fast as it could be. I'm not sure you know what element entry to update so let's look at an example:
-- | Element Entry Id | OVN | Start Date | End Date    | Pay Value |
-- +------------------+-----+------------+-------------+-----------+
-- | 123                2    1-Jan-2009   31-Jan-2011   USD 400
-- | 123                1    1-Feb-2009   18-Jun-2011   USD 500
-- | 123                1    19-Jun-2011  25-Jun-2011   USD 600
-- | 123                5    26-Jun-2011  31-Dec-4712   USD 700Here the one element entry (Id 123) has 4 effective rows. The employee gets $400 in Jan 2009, $500 from Feb 2009 to mid-June 2011, $600 for a few days later in June 2011 and then $700 from 26th June 2011 onwards.
So your question to the forum is which one do I update. Well, that depends which one you want to update. If you want to update the 1st Jan 2009 to 31st Jan 2011 you'd pass element_entry_id => 123, ovn => 2, effective_date => to_date('1-Jan-2009', 'DD-MON-YYYY') and datetrack_mode => 'CORRECTION'.
If you wanted to update the $700 row you'd pass OVN 5 and an effective date of 26th June 2011. And so-on.
Now in your SQL you're filtering based on sysdate, which means you'd be updating the $500 row (ovn=1). Is that what you want?
I have simplified your SQL as follows:
SELECT pee.element_entry_id
      ,pee.object_version_number
INTO   x_element_id_mgr
      ,x_ele_object_version_number
FROM   pay_element_entries_f pee
      ,pay_element_types_f pet
WHERE  pee.assignment_id = c_staging.assignment_id
AND    pee.element_type_id = pet.element_type_id
AND    pet.element_name = 'Mgr Rec Pct'
AND    trunc(sysdate) BETWEEN
       pee.effective_start_date AND pee.effective_end_date
AND    trunc(sysdate) BETWEEN
       pet.effective_start_date AND pet.effective_end_date;This selects both the entry Id and OVN in one go; there's no need to have 2 SQL statements. If multiple entries are allowed, this SQL could return more than one row so just watch out for that. If you don't want the row as of sysdate change the two sysdate joins accordingly.
I hope that helps.

Similar Messages

  • Photoshop and elements 13  Working in iPhoto Want to edit image using photoshop elements Did the following  IPhoto Preferences Advanced Edit Photos: In drop down menu chose in Photoshop Elements  Also control click and chose edit in external editor  Drop

    Photoshop and elements 13
    Working in iPhoto
    Want to edit image using photoshop elements
    Did the following
    IPhoto>Preferences>Advanced>Edit Photos: In drop down menu chose in Photoshop Elements
    Also control click and chose edit in external editor
    Drop down menu edit photos in external program>photoshop Elements
    Go to to the image I'm working on  --- selected the image, the clicked on edit. When nothing happened I double clicked the image. Still elements didn't open. Then I opened the Elements editor, went back to iphoto and tried the entire process again. the photo still didn't open on Elements 13 for editing.
    I have 3 Elements 13 books as well as looked on line--all my references say the exact same thing ---- iPhoto>Preferences>advanced>edit in external program>photoshop Elements
    I uninstalled and reinstalled both iPhoto as well as Elements.
    I spoke with application technical support.  There appears to be nothing wrong with my copy of iPhoto.  However there is no support from Adobe.  I waited for over 1.5 hours for chat support several days ago, and finally gave up.

    You are probably choosing the obvious file rather than the correct file as the PSE editor. The actual editor is hidden away inside the Support Files folder. The PSE file at the top level of the PSE folder in Applications is just an alias for the welcome screen and what you're describing is exactly what happens when you choose that. You want this one:

  • Need to sort an object array using an element in the object.

    hi all,
    i need to sort an object array using an element in the object.can someone throw some light on this.
    Edited by: rageeth on Jun 14, 2008 2:32 AM

    [http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html]

  • I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!

    I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!  Can anyone help??

    You selected Encrypt iPhone Backups in iTunes.  Then you entered a password.
    It would be that specific password it is asking for.
    See here:
    https://discussions.apple.com/thread/3284065?start=0&tstart=0

  • While trying to access my local network I get the message..."The page could not be opened because server cannot be found."  This, after updating to Yosemite and paying (again) for the server app.

    while trying to access my local network I get the message..."The page could not be opened because server cannot be found."  This, after updating to Yosemite and paying (again) for the server app.

    It's absolutley scandalous that a company with Apple's resources can let this happen.  They should have staggered the release by region rather than opening the flood gates.  The upgrade itself took me about 10 attempts to download it, and then I thought I was home free.  That was until it rebooted and won't activate.  It's over 2 hours now.
    Scandalous!

  • Updating multiple records without having to use a cursor

    I am trying to update multiple records in a table.
    Eg
    Table A -20 records
    Table B -10 records.
    Would like to update Table B with the updated records in Table A for those records which the primary key matches
    and I dont want to use cursors. Is this possible??
    Thanx in Advance.

    Please refer to the test below, it should give you the general idea,SQL> desc tableA;
    Name                            Null?    Type
    SEQ                                      NUMBER
    INV                                      VARCHAR2(20)
    AMT                                      NUMBER(12,2)
    AMT2                                     NUMBER(12,2)
    SQL> desc tableB;
    Name                            Null?    Type
    SEQ                                      NUMBER
    INV                                      VARCHAR2(20)
    AMT                                      NUMBER(12,2)
    AMT2                                     NUMBER(12,2)
    SQL> select count(*) from tableA;
      COUNT(*)
             6
    SQL> select count(*) from tableB;
      COUNT(*)
            12
    SQL> UPDATE tableB b
      2  SET b.inv = NVL((SELECT a.inv from tableA a WHERE a.seq = b.seq), b.inv),
      3      b.amt = NVL((SELECT a.amt from tableA a WHERE a.seq = b.seq), b.amt),
      4      b.amt2 = NVL((SELECT a.amt2 from tableA a WHERE a.seq = b.seq), b.amt2)
      5  /
    12 rows updated.
    *** Please note that this is DIFFERENT from what you asked, here tableB is having more rows, which is fine. We **may not be** able update tableA in this example by reversing the table names, because the join may bring more rows than UPDATE statement needs. ***Thx,
    Sri

  • How to update multiple records in a table using procedure?

    Dear All,
    1 am using 11.1.2.1.0
    my question is i have a table like
    emp id(primary key), empname,location
    1                             damby      blore
    2                             rocky       kormangala
    3                              biswa     india
    my question  is i need to write one procure that at a time i can update empname and location(wat the value are there in empname and location i  need to change at a time).
    thanks
    Damby

    Hi, Damby,
    That sounds like what the UPDATE statement does, exactly.  Just use an UPDATE statement to change any number of columns in existing rows.  You don't need a procedure, but, if you're using a procedure for some other reason, you can do the UPDATE in the procedure.  UPDATE works the same in SQL or PL/SQL.
    Sometimes MERGE is more convenient than UPDATE.  Like UPDATE, it can change any number of columns, either in SQL or PL/SQL.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Map several records to different elements in the same xml node

    Hi,
    I am trying to map data from relational tables to elements as per my xml schema. One of my tables has several records that I need to map to different elements in the same xml node.
    For example:
    Customer_Id | Param_Id |Param_Name
    212 | 1 |State
    212 | 2 |Country
    212 | 3 |ZipCode
    I can not change the structure of this existing table and need to work with it.
    How do I map the different params for a specific customer to my Customer node in the schema?
    One option is to join on the parameters table several times, but there ought to be a better way!
    PLEASE HELP!!!
    Thanks,

    First I question the design that contains/allows 600 attributes on an element. They sound like they really should be elements in the XML.
    Regardless, the following (NOT TESTED) should work for you (assuming you want to write one SQL with 600 columns)
    CREATE OR REPLACE VIEW APPLICATION_XML
    OF XMLTYPE
    Element "LOAN_APPLICATION"
    with object ID
    substr(extractValue(object_value,'/LOAN_APPLICATION/APPLICATION_DATA/@CallID'),1,5)
    AS
    WITH parm_tb AS
    SELECT MAX(DECODE(prv_valu, 1, prv_value)) BusinessType,
           MAX(DECODE(param_id, 2, prv_value)) Product,
           MAX(DECODE(param_id, 3, prv_value)) SomethingElse
      FROM parameter_details
    WHERE prv_pmh_header_id = 1
    SELECT xmlElement
       ("APPLICATION_DATA",
         xmlAttributes
          p.prv_detail_id as "CallID",
          p.PRV_PRM_PARAM_ID as "RandomID",
          p.prv_value as AppInitDate
         xmlElement
         ("PRODUCER_DATA",
           xmlAttributes
            parm_tb.BusinessType as "BusinessType" ,
            parm_tb.Product as "Product"
      FROM parameters_table p
    WHERE p.PRV_PMH_HEADER_ID = 1

  • How to update multiple records in custom table using checkbox in APEX 4.1?

    Hi,
    I have a SQL report which brings up all the data records using the following query.
    select
    "REC_NO" AS hidden_rec_no,
    "REC_NO",
    APEX_ITEM.CHECKBOX (3,rec_no) AS edit,
    "MEETING_TYPE",
    "PAGE_NO",
    "CHECKBOX"
    from "XX_TEST" m
    WHERE page_no = :p_page_no
    Out of all records, any records which are checked, I only want to update their flag to 'Y' on the database column "Checkbox". For this, I have a SUBMIT button on the report region. The processing code on pressing the SUBMIT button is:
    DECLARE.
    l_row NUMBER := 1;
    BEGIN
    FOR i IN 1..APEX_APPLICATION.G_F03.COUNT
    LOOP
    FOR j IN l_row..APEX_APPLICATION.G_F01.COUNT
    LOOP
    IF APEX_APPLICATION.G_F01(j) = APEX_APPLICATION.G_F03(i) THEN
    UPDATE xx_test
    SET checkbox = 'Y', -- APEX_APPLICATION.G_F03(j)
    WHERE rec_no = APEX_APPLICATION.G_F03(i);
    l_row := j + 1;
    EXIT;
    END IF;
    END LOOP;
    END LOOP;
    COMMIT;
    END;
    However, that is not happening. Please help me with this. Any solutions/suggestions are most welcome.
    Regards.

    Hi,
    Try
    BEGIN
      FOR i IN 1..APEX_APPLICATION.G_F03.COUNT LOOP
        UPDATE xx_test
        SET checkbox = 'Y'
        WHERE rec_no = APEX_APPLICATION.G_F03(i);
      END LOOP;
    END;Code loops all checked checkbox. You do not need commit on page process.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • When i try to use photoshop elements 12 the ALT key for cloning brings up a brush pallet instead of letting me clone

    when i try to use the ALT key in cloning it just brings up a brush pallet instead of letting me clone can you advise me what to do as i have been trying for days @@@

    No you don’t need to uninstall iPhoto but are you trying to edit a photo from the iPhoto Library?
    If so export a copy from iPhoto to the desktop and then open that copy in the Elements editor.

  • Issues with the new update (change of view, ease of use??) someone please help

    About the new iTunes version, where and how do I choose to sync tv shows to my device, whereas on the older version, you could go to it however I can't seem to find it on this latest version, is this something that they forgot about when they created this latest version or is it an issue where they should really consider ease of use, because it was easy to do at first but now I am lost and it is frustrating to not be able to use my phone like I was used to, that's the reason I don't like downloading new updates

    And not just that, like books for instance, it is the same for books and audiobooks, it isn't anywhere on the sync tab where you can choose which books, audiobooks or tv shows from your library that you want to choose to add to your device

  • Using Photoshop Elements as External Editor for iPhoto

    I have set up iPhoto so that I can use Photoshop Elements as the external editor. When I select a photo and choose 'External Editor,' Elements comes up but my photo is not displayed.

    Hi Toomuchtrouble000,
    When you are making the settings from iPhoto, make sure you select Photoshop Elements Editor, which is present in Support Files, not Photoshop Elements 11, which is actually the Welcome Screen.
    Please change that setting.
    Hope this helps.

  • Payment review after using "Pay after Delivery"???

    I paid for an item I got from eBay using "Pay after Delivery" as I've done many times in the past.  This time however I see it's been put into a Payment review which I understand comes up for suspicious transactions.  First it seems bizarre since PP pays the buyer directly then in 14 days after I've received the item and had a chance to make sure it's all good PP takes the $$$ from my bank account.  So is PP reviewing themselves since they are the ones making the payment initially???  Craziest thing I've heard of plus it is embarassing to me since notice is sent to the seller as if I've done something that made them suspicious!!!  My standing with both PP and eBay are perfect and only thing I've done different is sell a few camera equipment which I can't access for whatever time they hold my money.  As much as I was really liking using PP these types of issues really make me question my judgement;-/It was also stated in the review notice that should my payment be denied I should just redo the transaction?  That really sounds nuts since theyre the ones reviewing it, right??? 

    PayPal (PP) might have its source of funds overseas. If this is the case then the iTS will not allow you to purchase as the requirements for a USiTS account is that you have a valid credit card from the USA and a USA address.
    As PP is not a credit card hence they are not required to follow credit card rules or other US banking rules.
    PP in the past has frozen my PP account and withheld my money - hundreds of dollars - for 6 months - they finally released the money even thought I had not violated any of the PP rules. PP are judge, jury and executioner.
    MJ

  • Edit and update multiple records in JSP buisness components

    Hi everybody,
    I'm building BC4J components using entities and views and JSP buisness components.
    how can I edit and update multiple records
    at a time in the jsp file
    Note using the databean
    "oracle.jbo.html.databeans.EditCurrentRecord"
    one can view one record at a time
    thank you

    do you have a sample code? thanks
    Hi
    There are several options. One of them could be
    1) use <input name=rc[j] value="..."> instead of
    display a raw text
    2) parse parameters in doPost method of your servlet
    to update appropriate values.
    3) Make a empty row enable inserts
    Regards
    Jan

  • Update multiple records on one page php/mysql

    Hi folks,
    I am trying to adapt a page to offer the option to update multiple records on one page.
    The intention is to edit FAQ categories which are contained in a table with just two fields - the category and an id.
    The page lists each categories in a form with a submit button which is then repeated for each record in the recordset.
    Unfortunately my plan didn't work and only the first record updates as intended.
    Can anyone suggest how I can make it work?
    Here's the code I have so far.
    ************** The Update Code *****************
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if (!isset($mm_abort_edit) || !$mm_abort_edit) {
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE faq_categories SET category=%s WHERE id=%s",
                           GetSQLValueString($_POST['category'], "text"),
                           GetSQLValueString($_POST['id'], "int"));
      mysql_select_db($database_con_mysite, $con_mysite);
      $Result1 = mysql_query($updateSQL, $con_mysite) or die(mysql_error());
      $updateGoTo = "faq-category-edit.php
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    ************** Update Code Ends *****************
    ************** The Form *****************
    <form name="frm_editcategory" id="frm_editcategory" method="POST" action="<?php echo $editFormAction; ?>">
      <?php do { ?>
    <fieldset>
              <input name="id" type="hidden" value="<?php echo $row_rs_faqcategory['id']; ?>" />
              <input name="category" type="text" class="formrightcolumn"  value="<?php echo $row_rs_faqcategory['category']; ?>" />
              <input name="save" type="submit" class="submitbutton" id="save" value="save" />
    </fieldset>
              <input type="hidden" name="MM_update" value="form1" />
       <?php } while ($row_rs_faqcategory = mysql_fetch_assoc($rs_faqcategory)); ?>
    </form>
    ************** The Form Ends *****************
    Cheers
    Dave

    What does debugging tell you? What's the value of each of the variables? Did you try using regular echo statements to monitor what's going on? That's what I always do whenever I am stuck in my PHP coding.

Maybe you are looking for