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: ???? creating key by itself ??????

Re: ???? creating key by itself ??????

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/07/18
Message-ID: <5qnloh$d6o@camelot.dsccc.com>#1/1

You could create a database trigger.
Rough example follows:

create or replace trigger mytable_bier
before insert on mytable
for each row
begin
  declare cursor mseq is

        select mytable_seq.nextval from dual ;   begin
    if :new.pk is null then

      open mseq ;
      fetch mseq into new.pk ;
      close mseq ;

  end ;
end ;  

ido (ilepper_at_fac.fbk.eur.nl) wrote:
: I am using Delphi to work on my Tables wich are controlled by Oracle DBMS.
: The tables where created using Designer/2000.
: Ok my problem is, is it possible to let Oracle generate unique keys when
: inserting a record, so I don't have to do this in Delphi??
 

: Anyway thanks,
: Ido de Lepper
: ilepper_at_fac.fbk.eur.nl

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Fri Jul 18 1997 - 00:00:00 CDT

Original text of this message

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