Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Autopopulation by concatenation
You can use a Before Row Insert trigger to populate the TRACKID column
without
selecting from the table as follows:
:new.trackid := :new.num1||:new.place1 -- assumes datatypes are compatible
Coburn Watson wrote:
>
> I have a relatively basic table which, when insertions are made, I would
> like the last field (trackid) to be generated by concatenating the
> values of the first two fields (num1 & place1). For example, if I
> insert a row into this table with the data (num1, place1)values (4,
> paris), then I would like my trackid field to be "4paris". I attempted
> to perform this action with an AFTER INSERT trigger, but I get the
> "mutating" table error. I take this is since the data which the trigger
> is relying on has just been inserted and is unavaible for selection
> (?!?). Any help would be appreciated.
>
> Coburn Watson
> Information Systems Support - Research
> Scios, Inc.
> cpw_at_slip.net
-- Wes Riding (mailto:wriding_at_shl.com) Associate Systems Engineer SHL Systemhouse, Edmonton, ABReceived on Tue Feb 11 1997 - 00:00:00 CST