Re: Default item values & using sequences

From: M. Armaghan Saqib <armaghan_at_yahoo.com>
Date: Mon, 17 Jan 2000 09:18:10 GMT
Message-ID: <85umo9$tlk$1_at_nnrp1.deja.com>


You can achive these things from a PRE-INSERT trigger.

  1. :NEW.dname := UPPER(:new.dname);
  2. :NEW.tr_date := SYSDATE;
  3. Following code (Generated using my freeware SQL PlusPlus)

DROP SEQUENCE seq_deptno;

CREATE SEQUENCE seq_deptno

   START WITH 1 INCREMENT BY 1

   MINVALUE 1 MAXVALUE 999999999999999999999999999
   CYCLE CACHE 20 ORDER;
  • This optional trigger applies sequence values to a table column thus
  • creating an auto-increment column which can be used as primary-key

CREATE OR REPLACE TRIGGER trg1_dept
BEFORE INSERT
ON dept
FOR EACH ROW
BEGIN
   SELECT seq_deptno.NEXTVAL

     INTO :NEW.deptno
     FROM DUAL;

END;
/

regards,
M. Armaghan Saqib

+---------------------------------------------------------------
[Quoted] | 1. SQL PlusPlus => Add power to SQL Plus command line
| 2. SQL Link for XL => Integrate Oracle with XL
| 3. Oracle CBT with sample GL Accounting System | Download free: http://www.geocities.com/armaghan/
+---------------------------------------------------------------

In article <388189F6.B1716A8D_at_hotmail.com>,   Bob Hirons <bob_hirons_at_hotmail.com> wrote:
> Having been a Forms developer for some years, I have recently written
my
> first WebDB application for production use.
>
> Can anybody advise me on how I can implement the following features: -
>
> 1. Default item values to uppercase. (So that queries are
> case-insensitive).
> 2. Default a data item to SYSDATE. (current system date)
> 3. Use a sequence to generate an item value when entering new records.
> (Possibly using a button to action).

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Jan 17 2000 - 10:18:10 CET

Original text of this message