Re: HELP: Sequences and Items

From: Leo Mannhart <mannhart_at_zuv.unizh.ch>
Date: Tue, 14 Jun 1994 08:03:08 GMT
Message-ID: <mannhart-140694090308_at_zuvmaclm.unizh.ch>


In article <Cr78pB.LCD_at_undergrad.math.uwaterloo.ca>, aarhemtu_at_cayley.uwaterloo.ca (Anil) wrote:

> I have a SEQUENCE set up on Oracle 7. It's simply a four didgit number which
> I would like to concatenate with the current year and place the new 8 didgit
> number into and item in Forms 4.0.
>
> I know I can use :SEQUENCE.seq_name.nextval in the default field of an item,
> but I can't figure out how to get a sequence number into a trigger so I
> can prefrom the concatenation.
>
> Please HELP,
>
> Anil

Create an appropriate trigger (a PRE-INSERT trigger seems best for this purpose) with the text
begin
  select seq_schema_name.seq_name.nextval || to_char(sysdate,'yyyy')   into :block_name.field_name
  from dual ;
end ;
If you wish this number to the user you can put this code into a ON-NEW-FIELD-INSTANCE (or whatever you prefer)

Hope this helps
LM

-- 
Leo Mannhart
Planning Office
University of Zurich               phone: ++41 1 257 23 34
Kuenstlergasse 15                    fax: ++41 1 257 22 12
CH-8001 Zurich, Switzerland        eMail: mannhart_at_zuv.unizh.ch
Received on Tue Jun 14 1994 - 10:03:08 CEST

Original text of this message