|Subject||Re: [IBO] Copying rows with executable procedures|
OK, thanks very much :-)
--- In IBObjects@yahoogroups.com, Paul Vinkenoog <paul@v...> wrote:
> Hi yaedos2000,
> > I'm trying to use an executable procedure to copy a row from one
> > table to another. What's the best way of doing this? I'm currently
> > trying to use a SELECT statement to read the row, then an INSERT
> > add it to the other table.
> > for
> > SELECT DATA FROM TABLE_1 WHERE ID = :SOMETHING
> > do
> > begin
> > INSERT INTO TABLE_2 VALUES (:LOCAL_VARIABLE)
> > end
> > but this isn't working. Is there a better way of doing this, like
> > specific function for copying rows?
> This is actually not an IBO question, but the answer is short:
> insert into table_2 select data from table_1 where id = :something
> will copy all the matching rows. No loop needed.
> Paul Vinkenoog