Form - Insert only if not a duplicate

Hi,
In Oracle Portal I have a form that submit data to a table.
I only want the information to be inserted if the table doesn't already contain that email address that the user has types into the form.
In the additional PL/SQL code I added the following under 'before processing the form'
declare
form_email varchar2(80);
row_count number;
begin
form_email := p_session.get_value_as_varchar2(
p_block_name => 'DEFAULT',
p_attribute_name => 'A_EMAIL');
select count(*) into row_count
from schema.mytable
where upper(email) = upper(form_email);
if row_count > 0 then
htp.p('You have already submitted the form');
end if;
end;
The above did nothing at all. The record was still inserted. I tried just having the htp.p('You have already submitted the form'); in there just to see if it displayed, but it doesn't seem to be processing anything at all.
I tried putting the code in the 'after processing the form' section, but this failed to process anything either.
I've even tried putting the code on the 'Submit' button's PL/SQL Button Event Handler, but again, nothing happened.
What am I doing wrong?
Thanks.

Sugestion:
1. Create a unique Constraint on the EMAIL column.
2. In the form design page, at the INSERT button Event Handler (PL/SQL), enter a code which intercepts the exception:
exception
when DUP_VAL_ON_INDEX then
htp.p('already exists');
If you have access to metalink , cf note [cf note 139274.1|https://metalink.oracle.com/CSP/ui/flash.html#tab=KBHome(page=KBHome&id=()),(page=KBNavigator&id=(bmDocType=HOWTO&bmDocDsrc=KB&bmDocTitle=%3Cb%3Eforms%3C/b%3E%20insert,%20update%20and%20delete%20PL/SQL%20event%20handler:%20user%20friendly%20%3Cb%3Eerror%3C/b%3E%20screen&bmDocID=139274.1&viewingMode=1143&from=BOOKMARK))].
Patrick.

Similar Messages

  • Make Item of Data Entry Form Insert Only, Non Updateable

    Hi,
    Can someone please tell me how to make an item on a data entry form insert only and not updateable. The user can enter the text item in insert mode but cannot update the text item in update mode. This was really simple in Oracle Forms, hoping it is as simple in APEX.
    Thanks

    I think that's too much of the wrong information.
    It sounds like you have multiple forms. Are they Modal or Non-Modal?
    What code do you use to call the form that's not working?
    Does it work initially and then stop working?
    James.

  • Trigger with Condition problem - insert only when not exists

    Hello experts!
    I have a problem with a trigger I'm trying to create. It compiles but I receive an error message when the trigger fires.
    The scenario is as follows:
    I have a table TBL_PUNKTDATEN. Whenever the status for a record in that table is changed to 3 or 4 I need the trigger to insert a dataset into my target table (TBL_ARBEIT_ZU_GEBIET).
    However, the trigger must only insert data when there's no existing record in the target table. The condition that specifies whether there is a dataset or not, is the field LNG_GEBIET, which exists in the source as well as in the target table. Hence, for each LNG_GEBIET there can be only one dataset in the target table!
    I created a trigger using the following code. However it doesn't work.
    Maybe you'll see what I want to achieve when having a look at my code.
    Can you please help me out on this one?
    Thanks a lot!
    Sebastian
    create or replace
    TRIGGER set_status_arbeit_zu_gebiet AFTER
      UPDATE ON TBL_PUNKTDATEN FOR EACH ROW WHEN(new.INT_STATUS=3 or new.INT_STATUS=4)
    declare
        cursor c is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET=:new.LNG_GEBIET;
        x number;
    begin
        open c;
        fetch c into x;
        if c%NOTFOUND  then 
        INSERT INTO TBL_ARBEIT_ZU_GEBIET
            LNG_GEBIET,
              LNG_ARBEITSSCHRITT,
              PNUM,
              INT_BEARBEITER,
              DATE_DATUM,
              GEPL_DATUM
            VALUES
            (:new.LNG_GEBIET,
             52,
             1114,
             895,
             sysdate,
             to_date('01.01.1990', 'DD.MM.YYYY')
        end if;
    end;Well, on the first insert the code works properly and inserts the recordset as expected. However, if there is an existing recordset where :new.LNG_GEBIET matches LNG_Gebiet in my target table, I receive the ORA-06502 error!
    Maybe that spcifies it a little bit???
    Hope you can help me!
    Thank you!
    Edited by: skahlert on 23.09.2009 10:26
    Edited by: skahlert on 23.09.2009 10:28

    Thank you very much Peter G!
    That %Rowtype mod did the trick! Great solution! Thanks! The trigger works principally if there wasn't the fact that it fires also when the status of one individual record is 3 or 4.
    I need it to fire only when all records with the same attribute LNG_GEBIET (by the way, you guess was right - it's not a number) are of status 3 or 4.
    Is it possible to use the cursor function for the trigger's when condition?
    Such as:
    declare
        cursor c3 is select COUNT(*) from TBL_PUNKTDATEN where LNG_GEBIET=:new.LNG_GEBIET;and
    declare
        cursor c4 is select COUNT(*) from TBL_PUNKTDATEN where INT_STATUS = 3 and  LNG_GEBIET=:new.LNG_GEBIET or INT_STATUS = 4 and  LNG_GEBIET=:new.LNG_GEBIET;
      And then subsequently somehow compare the results of both cursors?
    ... WHEN c3=c4
    declare
        cursor c2 is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET=:new.LNG_GEBIET;
        v_c2  c2%ROWTYPE;
    begin
    open c2;
    fetch c2 into v_c2;
    if c2%notfound then
            INSERT INTO TBL_ARBEIT_ZU_GEBIET
            LNG_GEBIET,
              LNG_ARBEITSSCHRITT,
              PNUM,
              INT_BEARBEITER,
              DATE_DATUM,
              GEPL_DATUM
            VALUES
            (:new.LNG_GEBIET,
             52,
             1114,
             895,
             sysdate,
             to_date('01.01.1990', 'DD.MM.YYYY')
            end if;
            close c2;
    end;Please excuse me if the attempt is simply stupid!
    Sebastian
    Edited by: skahlert on 23.09.2009 15:36
    I just saw your reply Max! Thank you! Now I understand far better! Seems to be a successful day! I'm learning a lot! Will also test that method!
    If we could find a solution to the problem I described above it would make it a perfect day! I'm continously trying different attempts to have the trigger only fire when all records are 3 or 4.
    Not that you think I'm just waiting for your answers! That's not the case!
    Thank you all!
    Edited by: skahlert on 23.09.2009 17:30

  • Master-detail page with form layout -- insert only -- not in create mode

    JDeveloper 10.1.3.1 with JHeadstart
    I have the following master-detail structure in JHeadstart:
    Group 1, Table a, Layout: table-form
    Group 2, Table b, Layout: table-form
    Group 3, Table c, Layout: form
    Group 4, Table d, Layout: form (on same page as master table c)
    Table a, b and c are updatable (insert, update and delete).
    I have problems with the last page, tables c and d, master-datail both in form layout.
    The master-table (c) is not an insert-only table, the detail table needs to be an insert-only form on the same page as the master table c.
    Settings Table d:
    Advanced search and quick search: none
    Autoquery: disabled
    Single row insert allowed (other options in Operations disabled)
    In my view object I have used the settings in the JDeveloper guide 8.1.2 ('no rows...' in tab Tuning).
    I run my application in JDeveloper (with the option run in my ViewController-project, which means that I am not running my detail page directly in JDeveloper??) and when I open this last page, the detail form is not in create mode (I see no rows found and a create rows button).
    I have read several threads in this forum, but I do not know how to solve this problem.

    This does not work.
    In my first post I made an mistake in describing my application, it is not a table-form, but a tree-form application:
    Group 1, Table a, Layout: tree-form
    Group 2, Table b, Layout: tree-form
    Group 3, Table c, Layout: tree-form
    Group 4, Table d, Layout: form (on same page as master table c)
    If I override the executeQueryForCollection method in the ViewObjectImpl of table d I get a message ('JBO-27122: SQL-fout tijdens voorbereiding van statement' and 'java.sql.SQLException: OALL8 is in an inconsistent state').
    while clicking on the tree (with table b and c). It seems that the QueryForCollection method is being executed to early.

  • Do Not Import Duplicates (former PC /user/)

    I about to set down and go through the Aperture Tutes.
    However, can anyone advise as to whether it is a good idea to check the box to not import duplicates from my iPhoto Library or whether there may be a better way to manually delete these once they are in the program? I used Duplicate Annhilator at one point while in iPhoto but I am not sure I got it to work correctly.
    I am moving from PC which means that the import into iPhoto was not very pretty and I had to do a lot of moving around to get images that had basically been in tens of different folders to sit in one single Album and in some cases there may be an image that should in fact show up in more than one or two Albums (even though I know this is not very good form).
    While I would very much like to avoid having duplicates in the original database I would also like to avoid a scenario where I know I had a photo in the database but I cannot find it because the Do Not Import Duplicates option deleted the dupe from an Album it /should/ be in and left the original image in an Album where I would not think to look (or where I would need to search for awhile).
    Any advice on helping me get further unstuck from the PC would be great.
    Thanks,
    Jon

    The "Don't import Duplicates" only checks by filename (iirc -- either way, it is very limited in function). It won't help you at all in your quest to cull duplicates from your iPhoto library.
    If your iPhoto Library is a mess and you import it into Aperture, your Aperture Library will also be a mess. The advantage here is that Aperture has better tools for you to use to organize and prune (and prevent making a mess in the future).
    My advice is: make the import; read the first seven chapters of the [Aperture User Manual|http://documentation.apple.com/en/aperture/usermanual> (if you haven't yet); and create two additional libraries:
    . a "practice" library containing nothing you don't mind losing (for instance, duplicates you make just for this purpose) which you use to try out everything you learn about Aperture, and
    . a new empty Library for the images you capture while you are learning how to use Aperture and molding your old iPhoto mess into shape
    Aperture makes it easy to switch between Libraries (and when you are ready, to merge Libraries).
    Take your time. Be patient. As the carpenter says to his apprentice: +Measure twice, cut once.+
    And ask more questions. You'll have plenty. Be as specific as possible.
    Message was edited by: Kirby Krieger

  • Insert Only Forms with custom Page Lifecycle class

    I discovered a bug/inconsistency in the JHS Generator:
    The business case (translated to the HR schema) is
    We have an Insert Only form for creating new Departments. (Group name: DepartmentsEntry)
    When the user saves a new Department, we want to forward them
    using the Faces Navigation Handler to the group named "Departments".
    The implementation we used:
    - Create a custom class which extends oracle.jheadstart.controller.jsf.lifecycle.JhsPageLifecycle.
    This class overrides the onCommit method: if there are errors we stay on this page,
    otherwise we redirect the user.
    - Specify this classname in the Page Lifecycle Class property (under "Customization Settings") within the Application Definition Editor.
    When we then try to run the page, the Insert-Only form does not work as expected;
    The user has to click on the "New Department" button first.
    I see that the specified classname occurs in the ControllerClass property of
    the Page Definition file DepartmentsEntryPageDef.xml file.
    The way I solved the problem was to create a custom groupFacesConfig.vm template
    which specifies the managed-bean-class property of the ${JHS.current.group.name}PageLifecycle managed bean.
    This then solves the problem - the InsertOnly form works as expected.
    This is not as I would expect the "Page Lifecycle Class" property to be used.
    In my opinion the "Page Lifecycle Class" property should also be used in the default groupdFacesConfig.vm template and not only in the Page Definition file.
    Is this behaviour expected?

    Cliff,
    You are right, this is a bug that has been fixed for the upcoming 10.1.3.2 release.
    Steven Davelaar,
    JHeadstart Team.

  • Birthday calendar for only some of my contacts are showing up twice in my iPhone. They are not showing up twice tho on my iMac. No, I do not have duplicate names in my address book either. Any idea how to fix that?

    my birthday events for only some of my contacts are showing up twice in my iPhone. They are not showing up twice tho on my iMac. No, I do not have duplicate names in my address book either. Any idea how to fix that?

    I have uploaded the InDesign file so that you can take a closer look at:
    http://www.hsdesign.comuf.com/downloads/
    The file is called "Template_File.indd"
    So, as discussed the main issues are:
    1) The TOC doesn't generate all the listings (only those with the applied paragraph style "Heading 1 - Appendix")
    2) When I try to create a new pargraph style and apply it to existing or new text, it reads the pargraph style in the Paragraph Style menu, but the style doesn't actually apply.
    Hopefully you can figure something out from this. I really appreciate your help.
    Thanks!

  • Printing "Form Fields Only" not working correctly in Adobe XI

    I have a pdf form with fields including check boxes. If I print this form with all fields it prints correctly, but if I select "Form Fields Only" then all check boxes print as checked regardless of whether or not they are checked. When I use this form in earlier versions of Adobe I do not get this problem. Any ideas or solutions?

    Also the "PrintParams" properties require version 6 or above of Acrobat/Reader.
    One has to review the Acrobat JavaScript API for all sorts of version variations in the way Acrobat's JS object works. And the documention is not always correct.

  • Custom tabular form for multi-row not saving data

    Ok, before anyone asks, yes, I did read the how-to:-)
    I have a custom tabular form, which I did cause I need to use popups and the popups that you can use in the wizard tabular form does not display the text but rather the value underneath it.
    It returns data rather nicely and when I go and update values I can tell it is changing the fields underneath. I put a process in that will display the values in text fields on the form (for one row only) and I see them changing from what is already there and with the proper values.
    However, when I do that the data that is displayed then gets reverted back to what it was previous to the update but reports that the process was successful.
    I have also tried to insert but that is basically doing the same thing. Can anyone guide me.
    SQL to generate the tablular form...
    SELECT x.sak_release_db
    , x.sak_object
    , x.sak_release
    , x.sak_participant
    , x.sak_csr
    FROM
    (SELECT htmldb_item.hidden(1,sak_release_db) sak_release_db
    , htmldb_item.popupkey_from_query(2, sak_object,
    'SELECT b.nam_schema||''.''||a.nam_technical as table_name , b.sak_object
    FROM system_object a
    , database_table b
    WHERE a.sak_object = b.sak_object') as sak_object
    , htmldb_item.hidden(4,sak_release) sak_release
    , htmldb_item.popupkey_from_query(5, sak_participant,
    'SELECT nam_first || '' '' || nam_last as name, sak_participant FROM co_participant') sak_participant
    , htmldb_item.popupkey_from_query(7, sak_csr,
    'SELECT external_id|| ''-''||id_split as co, sak_csr FROM co') sak_csr
    FROM release_db_xref
    UNION ALL
    SELECT htmldb_item.hidden(1,NULL) sak_release_db
    , htmldb_item.popupkey_from_query(2, NULL,
    'SELECT b.nam_schema||''.''||a.nam_technical as table_name , b.sak_object
    FROM system_object a
    , database_table b
    WHERE a.sak_object = b.sak_object') as sak_object
    , htmldb_item.hidden(4,NULL) sak_release
    , htmldb_item.popupkey_from_query(5, NULL,
    'SELECT nam_first || '' '' || nam_last as name, sak_participant FROM co_participant') sak_participant
    , htmldb_item.popupkey_from_query(7, NULL,
    'SELECT external_id|| ''-''||id_split as co, sak_csr FROM co') sak_csr
    FROM dual) x
    Process to verify that I have the correct global fields: (Type: PL/SQL anonymous block, Process Point: On Submit - After Computations and Validations)
    begin
    :P3_2 := replace(htmldb_application.g_f02(1),'%'||'null%',NULL);
    :P3_5 := replace(htmldb_application.g_f05(1),'%'||'null%',NULL);
    :P3_7 := replace(htmldb_application.g_f07(1),'%'||'null%',NULL);
    end;
    Process to do the insert/update. Note, I hardcoded the value in the where clause but I was originally using the global value for g_f01 (i also tried putting a commit in there for fun) (Type: PL/SQL anonymous block, Process Point: On Submit - After Computations and Validations):
    -- Update the RELEASE_DB_XREF table
    FOR i IN 1..htmldb_application.g_f01.count
    LOOP
    IF htmldb_application.g_f01(i) IS NOT NULL THEN
    UPDATE release_db_xref
    SET sak_object = replace(htmldb_application.g_f02(i),'%'||'null%',NULL)
    , sak_participant = replace(htmldb_application.g_f05(i),'%'||'null%',NULL)
    , sak_csr = replace(htmldb_application.g_f07(i),'%'||'null%',NULL)
    WHERE sak_release_db = 22;
    ELSE
    IF htmldb_application.g_f02(i) IS NOT NULL THEN
    INSERT INTO release_db_xref
    (sak_object
    ,sak_release
    ,sak_participant
    ,sak_csr)
    VALUES
    (replace(htmldb_application.g_f02(i),'%'||'null%',NULL)
    ,htmldb_application.g_f04(i)
    ,replace(htmldb_application.g_f05(i),'%'||'null%',NULL)
    ,replace(htmldb_application.g_f07(i),'%'||'null%',NULL));
    END IF;
    END IF;
    END LOOP;

    Florian,
    Checkboxes are different from other HTML form items. When you have a text box for example, there's always a value send to the server when submitting. Even if that value is NULL. When you have a checkbox however, you only get the value if the checkbox is checked. It's not posted to the server when it is not checked. That's the general behavior of HTML forms and not specific to Oracle HTML DB.
    When working with tabular forms in HTML DB, you can access your form values using the htmldb_application.g_f0x arrays. Now if you have for example 10 rows in your form, then you'll get ten elements in your array for text boxes, select lists, etc. For checkboxes however you'll only get as many elements as you have rows checked. If I read your update and insert code correctly, you're trying to use the checkbox arrays the same way you use the arrays based on other item types. My recommendation would be to use Yes/No select lists instead of checkboxes or at least use select lists initially to get it working and then work on properly processing the checkboxes.
    Some general information about working with checkboxes in tabuar forms can be found here:
    http://www.oracle.com/technology/products/database/htmldb/howtos/checkbox.html#CHECKBOX_IN_REPORT
    Hope this helps,
    Marc

  • Printing form fields only on Reader

    Before I get to the meat, a little background.  We are in the process of converting all of our forms into PDFs so to keep everything the same across the company.  My company is a contract packager, and we ship out many items.  We have purchased forms for Bills of Lading and Packing slips that have duplicate copies for the back.
    We would like to be able to scan the form into the computer, and create a PDF with text fields to type in the information, but then only print the form field data.  Basically, I want the form to show up on the computer screen but only print the data that's entered.  With Acrobat, I can select in the printer box to print form fields only, but when I put the form on the system and tried it on a computer that only has Reader it doesn't give me the option of printing the fields only.  (I'm the only computer that has and uses Acrobat).
    I'm not a programmer of any sorts, but is there a way to have Reader do what I want it to?
    Thanks in advance for any help!
    Bret

    Hello Eveyone
    My solution for this is simple
    In Adobe Pro, go to menu bar in:
    Documente-->
    Backgroup-->
    Add and Replace or Update
    in Apperance select
    Apperance Options
    remove the check for "SHOW WHEN PRINTING"
    This solved the problem to print forms with background in your company.
    GOOD LUCK

  • Forms inserts rather update on commit_form when changes made in records

    I have created a form in forms builder 10g. These are 3 tables.
    1. Recovery_Shift (Production Shift Information) -- Parent Table
    2. Recovery_Size (Many Size in one Production Shift) -- Child to Table- 1
    3. Recovery_Size_Dtl (Details of the Size Recovered) -- Child to Table- 2
    The form has been created using 3 datablocks correpsonding to the above tables in two canvases.
    In second canvas I have a "Save" Push Button with code "Commit_Form". Whenever I am inserting first time it is ok. After pressing this push button if I make any changes in any record and press the Save button, forms shows unique constraint error. When I disable this constraint in table. The form inserts a new duplicate row in the table.
    The problem is ==>if I make any changes in the form after pressing "Save" button (Commit_form) it inserts the whole row rather updating the row.
    What could be the cause and solution. Please guide. The module is at implimentation stage. Thanks in advance for guidance.
    Tables for your references.
    Table - 1. Recovery_Shift
    SHIFT_ID----------NUMBER(10,0)     --> PK
    RECOVERY_DATE-----DATE     
    SHIFT-------------VARCHAR2(1 Bytes)     
    SHIFT_START_TIME--DATE     
    SHIFT_END_TIME----DATE     
    SUPERVISOR--------VARCHAR2(6 Bytes)     
    OPT---------------VARCHAR2(6 Bytes)     
    ENTRY_BY----------VARCHAR2(6 Bytes)     
    ENTRY_DATE--------DATE     
    VALIDATE_BY-------VARCHAR2(6 Bytes)     
    VALIDATION_DATE---DATE     
    SHIFT_MINUTE------NUMBER(10,0)     
    Table - 1. Recovery_Size
    SIZE_ID-----------NUMBER(10,0)     --> PK
    SHIFT_ID----------NUMBER(10,0)     --> FK
    REJ_STAGE---------VARCHAR2(2 Bytes)     
    ITEM_SIZE---------NUMBER(7,2)     
    ITEM_CLASS--------NUMBER(4,2)     
    ITEM_GROUP--------VARCHAR2(2 Bytes)     
    ITEM_QUALITY------VARCHAR2(3 Bytes)     
    RECOVERED_MTR-----NUMBER(10,2)     
    RECOVERED_TON-----NUMBER(10,3)     
    AUCTION_MTR-------NUMBER(10,2)     
    AUCTION_TON-------NUMBER(10,3)     
    ITEM_SPEC---------NUMBER(2,0)     
    Table - 1. Recovery_Size_Dtl
    SIZE_ID-----------NUMBER(10,0)     --> FK
    LEN_MIN-----------NUMBER(4,2)     
    LEN_MAX-----------NUMBER(4,2)     
    REC_AUC-----------VARCHAR2(1 Bytes)     
    PCS---------------NUMBER(10,0)     
    MTR---------------NUMBER(10,2)     
    TON---------------NUMBER(10,3)     
    SEGMENT-----------VARCHAR2(1 Bytes)
    Message was edited by:
    Vinay Pandey

    for inserting a row it asks for commitThat is normal behavior. When you update or create a record in the Recovery_Size_Detail block, you must commit the record before working on another record.
    I think it may be the cause of problem that there are already saved (commited)records in the form when i am entering more records in 2nd & 3rd table and commiting them.If you are creating new records after the commit, and these new records are duplicates in the database, then the unique constraint error is expected. If you want to ensure the user is not creating duplicate records before trying to commit, then see this:
    http://sheikyerbouti.developpez.com/duplicates/duplicates.htm
    You might try creating the form with just two blocks:
    First block (master): Recovery_Shift
    Second block (detail) Recovery_Size
    Get that to work and test it by updating and creating records. After you are pleased that it works, save it and then add the 3rd block as a detail block for the the 2nd block. Then you have this:
    Block1. Recovery_Shift (master)
    Block2. Recovery_Size (detail for block 1 and master for block 3)
    Block3. Recovery_Size_Detail (detail for block 2)

  • Table field set as "Initial" is not acceptinf duplicate entries

    Hi all,
    I have inserted a custom include structure(which has only one field and is made as Initial) into a standard field.
    Then values inserted using
    INSERT <table> FROM TABLE <Internal table> ACCEPTING DUPLICATE KEYS.
    But if the internal table contains an entry which has the custom field value same as one of the value in database table, the insert statement is not working and is returning sy-subrc value 4.
    The custom field is not a key field in the table.
    Any pointers will be very helpful.
    Thanks in advance,
    Sreekanth

    Hi,
    first just provide some entries into the database table using SE16 then check whether the new field is containing data or not.
    if not just goto menu->utilities->database object->adjust & activate the table.
    if still there is no change than in the report check
    if the <internal table> line type is same as that of the database table.
    ie all the fields are arranged in the same order as in database table
    hope this help
    thanks
    ravi aswani

  • No option to not import duplicates in iPhoto 6

    When importing from my digital camera into iPhoto 5 running OS 10.3, I was always asked if I wanted to import duplicates or not, so only new photos would be imported and I could leave some of my favorites on the camera. Having just installed Tiger and upgraded to iPhoto 6, I went to import new photos from my camera and was not given the option of not importing duplicates, so everything form the camera imported. Can anyone help with how I get that option back? Thanks.
    --Hammertime12
    G4 Powerbook 17"   Mac OS X (10.4.5)  

    Hammertime:
    Welcome to the Apple Discussions. It appears that that feature is not working when importing directly from a camera. Post a bug report at iPhoto's feedback page: http://www.apple.com/feedback/iphoto.html
    However, I found that if I upload to a folder first and then import into iPhoto I get asked about duplicates when there are any. So a workaround would be to use Image Capture to upload to a temp folder on the desktop, title the folder as you'd want the roll to read, and then drag that folder into iPhoto's open window. An extra step but it does afford some extra measure of user control and security against uploads going bad.

  • Insert only the updated Fields

    I have a log table based on the master table. The master table have 50 fields. Any update in the master data has to be logged in a new table. So the master table will have only the last updated data.
    Any change in the master table to be inserted in to a logged table. I need to insert only the updated fileds not all the fields.
    How to write insert statement in forms 6i for inserting to a logged table where only the changed fields.
    INSERT TO EMASTER_LOGTABLE
    (ECODE,
    ENAME,
    EDEPT,
    ETRADE
    VALUES
    (:ECODE,
    :ENAME,
    :EDEPT,
    :ETRADE
    Row will be inserted in to the EMASTER_LOGTABLE with the updated field only not all the field except primary.

    Hi!
    Whats about a new idea?
    Create a new table:
    create table EMASTER_HISTORY (
    EMP_CODE        number(6),  --> i don't know yours
    CHANGED_COLUMN  varchar2(30) not null,
    CHANGED_USER    varchar2(30) default user not null,
    CHANGE_TIME     date default sysdate not null,
    OLD_VALUE       varchar2(4000),
    NEW_VALUE       varchar2(4000) )
    storage ( your storage );In your form create a pre-update-trigger on your block like:
    declare
    l_item varchar2(30) := get_block_property ( 'your_block', first_item );
    l_data_old varchar2(4000);
    l_data_new varchar2(4000);
    begin
    loop
      if
       get_item_property ( 'your_block.' || l_item, item_type ) in ( 'BUTTON', 'IMAGE' )
      then
        null;
      elsif
        get_item_property ( 'your_block.' || l_item, database_value ) != name_in ( 'your_block.' || l_item ) OR
         ( get_item_property ( 'your_block.' || l_item, database_value ) is null AND name_in ( 'your_block.' || l_item ) is not null ) OR
         ( get_item_property ( 'your_block.' || l_item, database_value ) is not null AND name_in ( 'your_block.' || l_item ) is null )
      then
        l_data_old := get_item_property ( 'your_block.' || l_item, database_value );
        l_data_new := name_in ( 'your_block.' || l_item );
        insert into test.emaster_history ( emp_code, changed_column, old_value, new_value )
        values ( :your_block.emp_code, l_item, l_data_old, l_data_new );
      end if;
      exit when l_item = get_block_property ( 'your_block', last_item );
      l_item := get_item_property ( 'your_block.' || l_item, nextitem );
    end loop;
    exception
    when others then message ( l_item || ': ' || nvl ( error_text, dbms_error_text ) );
    end;So, for every updated item in your form you will have a record in EMASTER_HISTORY with timestamp
    and you're able to read the history of data in every column in your emp_master table.
    Addition:
    The only disadvantage is, non database items may will be logged too.
    This because i don't know a "clean" item property to find out, if a item is a database item.
    The item property column_name is not required and could by null alltough the item is a database item.
    Regards

  • Insert statement does not insert all records from a partitioned table

    Hi
    I need to insert records in to a table from a partitioned table.I set up a job and to my surprise i found that the insert statement is not inserting all the records on the partitioned table.
    for example when i am using select statement on to a partitioned table
    it gives me 400 records but when i insert it gives me only 100 records.
    can anyone help in this matter.

    INSERT INTO TABLENAME(COLUMNS)
    (SELECT *
    FROM SCHEMA1.TABLENAME1
    JOIN SCHEMA2.TABLENAME2a
    ON CONDITION
    JOIN SCHEMA2.TABLENAME2 b
    ON CONDITION AND CONDITION
    WHERE CONDITION
    AND CONDITION
    AND CONDITION
    AND CONDITION
    AND (CONDITION
    HAVING SUM(COLUMN) > 0
    GROUP BY COLUMNS

Maybe you are looking for

  • How do you load exs. format files into EXS 24 sampler?

    How do you load EXS24 format files into the EXS24 sampler? the only format I can load directly is aiff and wav. can't find any posts addressing this question? please help

  • Input on HTTP_POST_FILES

    Hi, I need to export the Flat file from SAP to some HTTP server, I found that function module HTTP_POST_FILES for this. can any one help me to, waht are all the paramaeter values needs to be passed and how the flat files to be attched. Thanks

  • SQL Developer Abrupt behaviour -- Invalid Identifier

    I have tried to use below 2 SQL using Script output (F5) both of them are semantically incorrect, but first one give no error, while second one give error SELECT substr(argument,1,2) FROM DUAL WHERE XX_ID LIKE 'XX'; No error raised. SELECT argument F

  • PAN no. on payslip

    Hi Experts, I am trying to print PAN no. on payslip. I done the same with - pe51_checktab  under Form Class - CEDT. Table added p0185 & Field added ICNUM.  But in my table PA0185 there are two entries exist 1 - Gratuity ID (Subty = 02) & 2 - Pan No.

  • Display format page by page

    hi In my program resultset contain more than 30 records. I want to display 20 records and first page contain 10 records and second page contain 10 records. The results should be shown in two pages with the index Page 1 of 1 or Page 1 of 2. Suppose If