Subject | Re: Copy row to row in stored procedure |
---|---|
Author | paul.mercea |
Post date | 2009-03-23T13:17:29Z |
Hi
try something like this:
for select pk_field, field1,field2...origin,fieldn from tableA
where your_contition
into :pk, :f1, :f2, ... :origin,fn
do
begin
insert into tableA (field1,field2...origin,fieldn)
values (:f1,:f2,.....:pk, :fn);
end
Presuming your primarykey is integer an you have a generator for this and one triger for next sequence of generator.
Regards,
Paul
try something like this:
for select pk_field, field1,field2...origin,fieldn from tableA
where your_contition
into :pk, :f1, :f2, ... :origin,fn
do
begin
insert into tableA (field1,field2...origin,fieldn)
values (:f1,:f2,.....:pk, :fn);
end
Presuming your primarykey is integer an you have a generator for this and one triger for next sequence of generator.
Regards,
Paul
--- In firebird-support@yahoogroups.com, Valeri Mytinski <valeri.mytinski@...> wrote:
>
> I have to copy one (existing) row to another (new) row in the same
> table within stored procedure.
> 3 steps needed as I see:
>
> 1. Fetch whole row into "record-like" variable or something else.
> 2. Change PK in "variable".
> 3. Insert new row with values from "variable".
>
> Do you know easy way(s) for this? Or may be special tools for this exists in FB?
>