db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: hv any solution
Date Mon, 16 Jul 2007 16:33:42 GMT
Prakash K wrote:
>
>  
> i did create the below tables
>
> create table one (v_id int not null primary key generated always as 
> identity(start with 1, increment by 1), v_date date, cs_cr char (1) 
> default 's' constraint cscr check (cs_cr in('s','r')), total decimal (5) )
>
> create table two (v_id int not null primary key generated always as 
> identity(start with 1, increment by 1), one_v_id inf foreign key 
> references one(v_id), prd_code int foreign key references 
> prd(prd_code), qty double, uom int foreign key references 
> uom(uom_code), rate decimal (3) )
>
> create table three (v_id int not null primary key generated always as 
> identity(start with 1, increment by 1), one_v_id int, one_v_date, 
> two_v_id int, prd_code int ,qty double)
>
> after create i want to know hw to create a single triger to 
> insert/update [on change] values from "one", "two" to "three".
>
> column in table three value from table(column)
> v_id should be auto generated.
> one_v_id one(v_id)
> one_v_date one(v_date)
> two_v_id two(v_id)
> prd_code two(prd_code)
> qty two(qty)
>
> it could be found that the above table are without schema. if it is 
> created with schema then hw to write a trigger.
>
> Prakash
>
>
>
>
>
> select view apply 
> <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@Middle5/1307758_1301384/1307141/1?PARTNER=3&OAS_QUERY=null%20target=new%20>

>
>
Hi -
It's looks to me you need an AFTER trigger on table two that performs 
and insert into table three using

Statement trigger referencing NEW
INSERT INTO THREE (<col-list>)
select <cols-from-one>, <cols-from-NEW> where
NEW. one_v_id = one.vid




Mime
View raw message