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: Question on Trigger and Partitioning keys in Oracle 9i

Re: Question on Trigger and Partitioning keys in Oracle 9i

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 2 Dec 2005 16:30:21 +0000 (UTC)
Message-ID: <dmpsqs$828$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>

"Krispyqube" <kris.plakkat_at_gmail.com> wrote in message news:1133468842.749778.230530_at_g43g2000cwa.googlegroups.com...
>
> Can you specify a column as the partitioning column if that column is
> populated by a trigger?
>
> Assuming that i have a non-partitioned table and i intend to partition
> it and example is a date_created which is timestamp and this is
> populated by a trigger
>
> thanks for any answers are help
>
> regds
> Kris
>

Yes,
But it has to be a 'before row' trigger. For example:

drop table pt_hash_1;

create table pt_hash_1 (
 id number(4),
 grp number(4),
 small_vc varchar2(20)
)
nologging
pctfree 90
pctused 10
partition by hash(id)
partitions 4
;

create or replace trigger pth_bri
before insert on pt_hash_1
for each row
begin
 :new.id := dbms_random.value(0,1024);
 :new.small_vc := upper(:new.small_vc);
end;
/

insert into pt_hash_1(grp,small_vc) values (1,'asdf') ;

commit;

select * from pt_hash_1;

        ID GRP SMALL_VC

---------- ---------- --------------------
       863          1 ASDF

1 row selected.

-- 
Regards

Jonathan Lewis

http://www.jlcomp.demon.co.uk/faq/ind_faq.html
The Co-operative Oracle Users' FAQ

http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html
Cost Based Oracle: Fundamentals

http://www.jlcomp.demon.co.uk/appearances.html
Public Appearances - schedule updated 29th Nov 2005
Received on Fri Dec 02 2005 - 10:30:21 CST

Original text of this message

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