Subject | Re: [ib-support] declare cursor |
---|---|
Author | Frank Ingermann |
Post date | 2001-04-20T07:31:51Z |
Hi Jordi,
Jordi Gálvez wrote:
<snip>
i assume that dni is the primary key for the table, so you can use a
storedproc like this:
CREATE PROCEDURE PROCEDIM
AS
DECLARE VARIABLE rdno integer;
DECLARE VARIABLE valor integer;
BEGIN
FOR SELECT "dni"
FROM "empleado"
INTO :RDNO
DO BEGIN
VALOR = GEN_ID("GEN_numero",1);
UPDATE "empleado" SET "numero" = :VALOR WHERE dni=:RDNO
END
END
this should do the job. however, there is a much simpler way if all
you want to do is fill the new column with generated values:
UPDATE "empleado" SET "numero" = GEN_ID("GEN_numero",1)
no storedproc needed, and does just the same.
hth,
fingerman
Jordi Gálvez wrote:
<snip>
i assume that dni is the primary key for the table, so you can use a
storedproc like this:
CREATE PROCEDURE PROCEDIM
AS
DECLARE VARIABLE rdno integer;
DECLARE VARIABLE valor integer;
BEGIN
FOR SELECT "dni"
FROM "empleado"
INTO :RDNO
DO BEGIN
VALOR = GEN_ID("GEN_numero",1);
UPDATE "empleado" SET "numero" = :VALOR WHERE dni=:RDNO
END
END
this should do the job. however, there is a much simpler way if all
you want to do is fill the new column with generated values:
UPDATE "empleado" SET "numero" = GEN_ID("GEN_numero",1)
no storedproc needed, and does just the same.
hth,
fingerman