Re: rowid and trigger
Posted in 1999
In article <A47C1A259D12D31194870008C71EF37E8A542A@WMSTO3SI1481>,
"Pettersson, Robert" <ropet@wmdata.com> wrote:
> Hi
>
> Is it posible to use ROWID in a insert trigger ?
If you mean
create trigger itable_1 insert on table_1referencing new as t1new
for each row
(
insert into table_2 values ( t1new.rowid, t1new.id )
);
then probably not.
> I dont have a primary key so i want to use ROWID.
>
> This is example off my problem
> table 1
> char id
> char id1
>
> table 2
> integer rowid_table1
> char id
>
> On table 1 i want to have one insert trigger that move information to
> table2 whit rowid from table 1
> Is this posible ?
>
> When i tray this the error message is that new.rowid is no colume ?
You can use ROWID in select statement.
create trigger itable_1 insert on table_1referencing new as t1new
for each row
(
insert into table_2
select rowid, id
from table_1
where id = t1new.id
);
Problem is 'where ...' part.
If you don't have primary key on table_1
then select statement can return many rows.
Well, obviously you know this.
And you know from manuals:
...
Informix recommends that you use primary keys as an
access method rather than exploiting the rowid column.
...
>
> /Robert
>
>
Regards
--
Vardan Aroustamian
vaar@geocities.com
Sent via Deja.com http://www.deja.com/
Before you buy.