Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Unique Check for Forms 6 Data Block

Re: Unique Check for Forms 6 Data Block

From: <schroeerm_at_my-deja.com>
Date: 2000/04/12
Message-ID: <8d1mc3$78f$1@nnrp1.deja.com>#1/1

In article <8ck1ln$734$1_at_mawar.singnet.com.sg>,   "William" <sucheeha_at_singnet.com.sg> wrote:
> Currently my data block is displaying multiple records and my
 application
> requires that we allow the user to input multiple records. All the
 records
> are still buffered in the Forms and not Posted to the database, so
 even if I
> issue a query against the database I won't find any.(am I right?)
>
> e.g.
> Item_Code Brand_Code
> line 1 0-10 NTN
> line 2 0-12 NTN
> line 3 0-10 NTN -----> how to detect this
> duplicate entry
>
> Thanks a lot!
>
>

Hi William,

If it is possible to do a commit when navigating to next row, you can do so by building a key-down trigger with following plsql-code commit; -- or do_key('commit_form');
down; -- or do_key('down')

If it is not possible to do a commit you have to go through your rows and check the primary key values in the when-validate-item trigger e.g:
declare
  cur_rec number;
  cur_primary_key varchar2;
  i number;
  pragma exception_init (duplicate_key, -20000); begin
  currec:=:system.trigger_record;
  cur_primary_key:=:block_name.primary_key_column;   i:=1
  go_record(1);
  while i < currec loop
    if :block_name.primary_key_column = cur_primary_key then       raise duplicate_key;
    end if;
    next_record;
  end loop;
exception
  when duplicate_key then
    go_record(currec);
    message('duplicate key´');
end;

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Apr 12 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US