Validations in a database block before commit

Hi Folks,
I have a database block with three fields : Agency, Start Date, End Date. Agency has a List Of values. I need to change the LOV contents depending upon the values already entered. For example any agency with end date as null should not appear in the list and if end date is entered for an agency then it should start appearing in the list...etc. I have to consider both committed and Uncomitted data. Is there a way to traverse through the block without actually navigating through it. The user should not know see the cursor moving anywhere.
Any suggestions and ideas are most welcome.
Thanks a lot
Pranati

Forms does a select for update when a database item is changed, so the locks have already been established regardless of whether you do a post. You can confirm this behaviour by adding an on-lock trigger.
Your requirement to read other records in the block without navigating CAN be achieved using calculation properties, and I have used this technique several times in situations like yours.
Create another agency field in a control block.
Create a hidden non-database numeric item in your block with a calculation property of formula. The formula should be a user-written function with parameters of control.agency, datablock.agency, datablock.date. Write the function in the form program units: if the agencies match and the date exists return 1 else return 0.
Create a field in the control block with a summary calculation property doing a sum of the other cxalculated item.
Now all you need to do is copy the agency code from your current record into control.agency and hey presto ,the summary field instantly tells you how many other records for that agency have dates.
An alternative method would be to maintain a copy of your block in a record group, but that could get rather complicated.

Similar Messages

  • ADF : Non Database Block Fields Validation

    How should I add validation to "Non Database Block Fields"?
    My question is based on this example:
    see http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    "24. Passing User-Entered Data in "Non Database Block Fields" to Stored Procedure/Function"
    http://otn.oracle.com/products/jdev/tips/muench/stprocnondbblock/PassUserEnteredValuesToStoredProc.zip
    Should I add the validation to an Entity Object (where no fields are 'linked' to database fields) on which I base the "NonDBBlock" View Object?
    If this is "Entity Object abuse" (because no database involved, only validation), what would be a better approach?
    many thanks
    Jan Vervecken

    hi Steve
    If all the attributes in my Entity Object are marked as not persistent, it makes sense this Entity Object doesn't "take part" in a transaction.
    I would like to avoid the message box about Commit or Rollback when closing my Frame, because this use case isn't transaction related in any way.
    It seems to work if I override the getPostState() method like this:
    public byte getPostState()
         return EntityImpl.STATUS_UNMODIFIED;
    question :
    Are there any side effects to this approach or is there another way to mark an Entity Object as "not in any transaction"?
    thanks
    Jan

  • How to check an item in a database block has changed before updating

    hi,
    i have a database block having designation and other relative field are there . a ctrl item status (checkbox) in the same block. i want to update records only the status is marked as ticked get updated. what trigger in which levels should be used
    thanks in advance

    In genral forms marks the records as "changed" by itself. If you want to override this "marking", you'll have to overrwrite the DML-logic (for you cannot change the status of the record back to QUERY). So, you have to create ON-INSERT, ON-UPDATE and ON-DELETE-triggers and do something in it like
    IF :BLOCK.MARKED='Y' THEN
      UPDATE_RECORD;
    END IF;

  • How to do validation on multi record block at run time...

    Dear Friends,
    I have to do validation at run time on multi record block.
    If user tries to enter and save two or more records in same multi record block with same data at run time, it should not allow it and display a message like, " error : Records are having same(duplicate) values. "
    I already did validation with the data coming from database table using cursor. But confused about how to do at run time(on one screen only) ??
    Please, give details about how to check duplicate records on form block before saving it to the table ????
    Regarding details would be greatly helpful.
    thanks,

    Hi...Pankaj
    thanx for your reply..
    I already did validation for the data coming from table....
    but I need to do it on form only...at run time...
    exa...
    In one multi record block
    record no : column 1 : column 2 : column 3
    1 abc 123 hi
    2 abc 123 hi
    so it should check on the form itself, here I m not getting data from table...I am just
    navigating from first record to second using down arrow.
    so, may be 2 possibilities.
    1) when user navigates using tab to third record, it should say like two duplicate records.(may be like when validate record or item)
    2) or when user tries to save, it should say two duplicate records.
    so, everyting should take place on form screen only.....
    waiting for your reply,
    thanx...

  • DBWn and LGWR work before commit

    " - Oracle has generated redo log entries in the redo log buffer of the SGA. The redo log record contains the change to the data block and the change to the rollback
    block. These changes may go to disk before a transaction is committed.
    - The changes have been made to the database buffers of the SGA. These changes may go to disk before a transaction is committed."
    (c) Concepts 10g R.2
    When this situation (write dirty blocks and redo entries befor commit) occurs? It is importantly for me to refer on official documentation, when this situations occurs.
    Thanks,
    Best Regards

    915968 wrote:
    " - Oracle has generated redo log entries in the redo log buffer of the SGA. The redo log record contains the change to the data block and the change to the rollback
    block. These changes may go to disk before a transaction is committed.
    - The changes have been made to the database buffers of the SGA. These changes may go to disk before a transaction is committed."
    (c) Concepts 10g R.2
    When this situation (write dirty blocks and redo entries befor commit) occurs? It is importantly for me to refer on official documentation, when this situations occurs.
    no

  • How to set "Maximum Lenght" column property for database block at RUNTIME?

    Hi folks,
    Is it possible to somehow set a "Maximum Length" property for database block column at runtime?
    I have a dynamic form, which maintains mostly "STATIC DATA" within all application which are stored in different static data tables (which have similar structure). But now, description column in some of those tables was extended (not in all at this stage). I would like to avoid truncating form error while reading data from those extended tables, so I would like to set an MAXIMUM SIZE to accurate value at the time when I'm specifying TABLE NAME for that database block.
    What property should I use to set it?
       -- before executing query in "MAIN_BLOCK" I always set QUERY_DATA_SOURCE_NAME to user defined value => STATIC DATA TABLE name
       Set_block_Property('MAIN_BLOCK',QUERY_DATA_SOURCE_NAME,:control.table_name);
       Set_block_Property('MAIN_BLOCK',DML_DATA_TARGET_NAME,:control.table_name);
       -- here I would like to set also MAXIMUM LENGHT for particular column (based on some condition, etc.. correct value I can get from ALL_TAB_COLS dictionary
       SET_ITEM_PROPERTY('MAIN_BLOCK.DESCRIPTION', <<XXXXXXX>>, 300);What should I use instead of "<<XXXXXXX>>" if I want to overwrite MAIN_BLOCK.DESCRIPTION column's maximum length to 300?
    Thanks,
    Tomas

    Hi Magoo, thanks for reply.
    Yes, but then user can get other errors while trying to set description with value longer than in database (for all not extended tables).
    Aby idea how to implement SET_CUSTOM_PROPERTY like mentioned here?
    Oracle Forms - "maximum length" property.
    Thanks,
    Tomas

  • How to get the total record in the block before save them

    Hello,
    I need to recalculate the amout for all records in one block before saving them.
    How can I get it?
    Thanks for your helping

    You write a loop, something like this:
    Go_block('B1');
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    First_Record;
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    Loop
      If :system.record_status in('CHANGED','INSERT') then
        -- modify the record here--
      End if;
      Exit when :System.Last_Record = 'TRUE';
      Next_Record;
    End Loop;
    First_Record;But be very careful-- If your block can fetch a large number of rows, (over 100), this loop can take a long time, and you should not use this method. The loop will continue fetching more rows from the database until all rows satisfying the query are retrieved.

  • Unable to read changes before commit

    I have a mix of insert and select statements for a particular transaction operation.
    I need to insert to table 1 a set of five records. ie. five inserts to table 1.
    Then i need to sum up a column in table 1, this may have certain records which were inserted recently and some might be older ones.
    This sum needs to be inserted into another table 2.
    In my code i maintain the sequence of inserting, fetching the sum and inserting. I confirm the sequence by giving System.out.println().
    But since everything runs inside a container managed external transaction controller.
    Even though i see the System.out.println's in proper sequence, the suming query is happening before.
    At the end, i have Before JTS completion, followed by my insert sqls, followed by After JTS completion.
    Clearly the problem is, the fetch is happening before i insert, in JTS.
    So how do i make sure, that the fetch happens after my first insert.

    I assume that you are using the TopLink UnitOfWork. The UnitOfWork defers committing all changes to the database until the commit (beforeCompletion in JTA), so any queries you perform will not see any of these changes until after the commit. It does this to optimize the commit, maintain referential integrity, avoid deadlocks, avoid holding pooled connections, etc.
    You must either:
    - perform the inserts and the sum query in two separate transactions
    - compute the sum from the objects in memory
    - use a database session and insertObject instead of a unit of work
    To compute the sum in memory you may wish to use a conforming query in TopLink to query the new objects that have not yet been inserted to the database.
    In the 10.1.3 release, there will be support for a non-deferred unit of work, and a writeChanges() unit of work API to write changes before the commit.

  • 8K Database Block Size in 11.5.2

    The Release Notes for 11.5.2 state the minimum database block size is 8K. However, this was not a requirement for 11.5.1 and instead patch 1301168 was created for customers with a database block size less than 8K.
    In 11.5.2 is it MANDATORY that the database block size be 8K or greater, or can patch 1301168 be applied in lieu of migrating to a larger block size?

    4K to 8K:
    Use 7.3.4 Export using Unix Pipe to create the export. Files mayhave to split.
    Rebuild the 8.1.6 database. Good Opportunity to consolidate files.
    Import using Unix Pipe with 8.1.6 import utility.
    Set data files to autoextend, unlimited including system. Do not autoextend RBS, TEMP and log.
    Use COMMIT and IGNORE on import.
    Use COMPRESS on export.
    USE very large buffers on both export and import.
    Ignore messages on SYS and SYSTEM tablespace and other definitions.
    If you are using 10.7 with 8.1.6, use interop patch,a nd other module patches (see release notes). Run adprepdb.sql after Import.
    Compile all invalid modules till they match 10.7 invalid modules. Fix invalid modules like the ones documented in release notes.
    If you doing it for just 11.5.2 Just do export import in 8.1.6 with large file system set on your file system and you should be fine. AIX supports Large file systems.
    null

  • Oracle forms commiting database blocks

    I have created a form with 4 database blocks. Fac_master is the main block, which has a not required FK to Fac_potential_cus. Fac_services which has a required FK to fac_master. fac_serv_locations which has a required FK to fac_services. I have put the relationships on the tables that have the PK related to a FK. I am able to insert the data into the form, but when I save the form. The current form's record only saves the data to fac_master. When I create a new form and save it, the current form's record for fac_master saves, but the previous form's record saves to fac_potential_cus and fac_services. Fac_services fk to fac_master does populate with the correct pk from fac_master. Which is causing the FK to not be put into fac_master for fac_potential_cus and fac_serv_locations data is not being put into the table at all because the FK to fac_services is null at the time it trys to put the current record data in itl.
    Can any give me any ideas why only the main datablock(fac_master) saves at the time the form is saved then the other datablocks(fac_services & fac_potential_cus) data saves from the previous record once a new record is saved in fac_master? The data in fac_services is one record behind fac_master and in sync.
    I am using a key_commit at form level. I put a libpack in there to make sure it is reading INSERT and it is. The sql in the key commit is:
    If :system.record_status = 'CHANGED' then
    SUBMIT_BUTTON;
    Elsif :system.record_status = 'INSERT' then
    Commit_Form;
    End if;
    Thanks.
    Edited by: 939341 on Jun 7, 2012 11:27 AM

    Welcome to the forum.
    Unfortunately you posted this question in the Database - General forum. Try posting in the Forms forum
    Forms

  • Encrypt value before commit

    Hello,
    I'm using Oracle JDeveloper 11g Release 2 (11.1.2.3.0).
    I have a form that the user must enter some values, one of these values is a password. I need to pick up that value before commit and encrypt it. Actually the password is stored in the database without encyptation, just as the user entered it.
    My application does not use adf security, and now it's too late to change everything.
    Any idea that how  can I fix this?
    Thanks in advance!

    Hello Shay!
    Thanks a lot for your answer, I'm newby in ADF and I don't know how to do that. I think that the easiest option is to overwrite the doDML method.
    I overwrite this method in the EOImpl and, now I have this:
         * Custom DML update/insert/delete logic here.
         * @param operation the operation type
         * @param e the transaction event
        protected void doDML(int operation, TransactionEvent e) {
            super.doDML(operation, e);
    I have a method called encrypt(password), that return the password encrypted.
    How can I set the new string to the password attribute when I update on database? I guess I have to insert this code before super.doDML(operation e);, is it?
      if (operation == this.DML_UPDATE){
                // CODE HERE
    Please can you help me with this? Thanks in advance!

  • Inserting Record with database block (with contorl block)

    In my application I have a form in which i have button when pressed a record should be entered in database that this button has been pressed.
    Whether it should have database block or not.
    when i wrote the pl/sql in the wbp trigger
    insert into xyz values ('Add Button Purchase Order');
    commit
    Message appears
    FRM-40401 No changes to Save
    How to conrol this message.
    Thanks
    MAQ

    hi there
    i managed to remove this message by putting the following
    if error_code=40401 then
    null ;
    else
    message(error_text) ;
    message(error_text) ;
    raise form_trigger_failure ;
    end if ;
    on ON-ERROR trigger at form level
    hope it helps !

  • FROM query clause (Database Block)

    Hi Friends,
         I have a Database block having FROM clause query.
    My question is can we filter the records by a column that has not been selected in the FROM clause query.
    Or else do we have any other alternative.Because I use DISTINCT in the query which results in duplicate records.
    Regards,
    Marlon.

    Hi,
    I had a try but forms frames the query as this
    SELECT mgr, hiredate, sal, comm, deptno, empno, ename, job
    FROM (SELECT e.mgr mgr, e.hiredate hiredate, e.sal sal, e.comm comm,
    e.deptno deptno, e.empno empno, e.ename ename, job job
    FROM emp e, dept d
    WHERE e.deptno = d.deptno)
    ORDER BY d.loc
    and it gives an invalid identifier error.
    I dono how to solve this.Can anyone suggests me how to do this.
    Regards,
    Marlon.

  • How check value befor commit my form

    hi master
    sir
    how check value befor commit my form if that value right than commit otherwise show message box and not save
    please give me idea
    thanking you
    aamir

    Have you not tried using When-Validate-Item Trigger.
    Like if i have an Item Which can only take dates between sysdate and sysdate-3 your code in when-validate of the item should be
    If :BlockName.ItemName NOT BETWEEN SYSDATE-3 AND SYSDATE THEN
    MESSAGE('Pleaes Enter valid date);
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    This will fire, and commit will fail.

  • HOW TO CREATE MULTIPLE RECORDS IN A NONE DATABASE BLOCK?

    I have a Form where I have a none database block with unbound items. The block
    has 10 records. In the when-new-block instance I run a query by which I would
    like to fill up the block with data. The code fragment looks like the
    following:
    begin
    declare
    tmp_curr_rec_id number;
    begin
    -- a hibak kiolvasasa
    for c_hibak in ( select h.*, h.rowid
    from hibak h
    where 1=1 -- WF - Ide kerul a szurofeltetel
    order by bejelentes_datum asc
    ) loop
    -- bemasoljuk az adatokat az unbound item-ekbe
    :mc_adat.ub_azonosito := c_hibak.azonosito;
    :mc_adat.ub_verzio_letrehozas_datum :=
    c_hibak.verzio_letrehozas_datum;
    :mc_adat.ub_bejelento := c_hibak.bejelento;
    :mc_adat.ub_bejelentes_datum := c_hibak.bejelentes_datum;
    :mc_adat.ub_wf_verzio_csomopont :=
    c_hibak.wf_verzio_csomopont;
    :mc_adat.ub_wf_utolso_esemeny_szoveg :=
    c_hibak.wf_utolso_esemeny_szoveg;
    :mc_adat.ub_hiba_leiras := c_hibak.hiba_leiras;
    :mc_adat.ub_hiba_hely := c_hibak.hiba_hely;
    :mc_adat.ub_rekord_jelleg := 'H';
    :mc_adat.ub_rowid := c_hibak.rowid;
    -- beallitjuk a rekordot-ot olyanra, mintha semmi nem valtozott
    volna
    -- nem szeretnenk a form bezaraskor mindenfele figyelmezteteseket
    -- olvasni a kepernyon
    tmp_curr_rec_id := get_block_property( :system.current_block,
    current_record );
    set_record_property( tmp_curr_rec_id, :system.current_block,
    status, new_status );
    create_record;
    end loop;
    end;
    end;
    The block's update allowed, insert allowed, delete allowed property is set to
    true.
    The result of the code above is that only the last record fetched shows up in
    the block. The problem is - as I found out - is that aech record is fetched,
    the values are copied to the block items, but the create_record built-in
    command would not move the cursor to the next row.
    Can some one please help me with this?
    TIA,
    Tamas Szecsy

    The problem was with the following code segment:
    tmp_curr_rec_id := get_block_property( :system.current_block, current_record );
    set_record_property( tmp_curr_rec_id, :system.current_block, status, new_status );
    After omitting these two lines, the code worked properly.
    Thansk for all whoe replied.
    Regards,
    Tamas

Maybe you are looking for

  • Huge file size  grow when using external editor

    Hello, I want to use an external editor such as Photoshop or Pixelmator. When I set one of the applications to be the external editor everytime I open a file for editing a version is created with a file size of approx. 57 Mb. Any ideas what is going

  • How to load internet explorer to Os10.5.8

    Hi A couple of websites need internet explorer = I thought I had it as part of OS10 but it is not now there.  Cana anyone please advise me how to best install it Many thanks Pam

  • Why is iTunes asking for security questions?

    Why is iTunes asking for security questions?

  • Reason for Rejection getting Auto Populated

    Hi, I am creating an std order without reference to a preceding document, still the "reason for rejection" is auto populating in the Reason for rejection Tab. I dont want this to happen, please suggest. Sachin

  • Add fields to rebate aggrement in CRM system

    hi ,      i need to add some of fields to Rebate aggrement in the Tcode Crmd_order. For this the Business transcation type is <b>REBATE</b> . But when i go inside i don't find the <b>Rebate</b> transcation . Is there any alternative transcation type