From: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
---|---|
To: | Daniel <daniel(dot)delaluz(at)gmail(dot)com> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Ayuda con Funcion y C++ |
Date: | 2006-11-18 05:25:10 |
Message-ID: | c2d9e70e0611172125r1faf56f9q5e00d2d706bd8121@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
On 11/17/06, Daniel <daniel(dot)delaluz(at)gmail(dot)com> wrote:
>
> CREATE OR REPLACE FUNCTION inserta_valor(int4, int4, int4, int4)
> RETURNS void AS
> $BODY$
> BEGIN
> select * from valores where canal = $1;
> if not found then
> if $4 ISNULL then
> insert into valores values($1,$2,$3);
> else
> insert into valores values($1,$2,$3,$4);
> end if;
otro error aparte del que ya te menciono Alvaro...
si la tabla tiene 4 columnas debes darle un valor a todas, sino deseas
hacerlo debes especificar a que columnas estas asignando valores, algo
asi:
if $4 ISNULL then
insert into valores(campo1, campo2, campo3) values($1,$2,$3);
else
insert into valores values($1,$2,$3,$4);
end if;
aunque no veo para que tanto lio si igual estarias grabando NULL en la
4ta columna
--
Atentamente,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook
From | Date | Subject | |
---|---|---|---|
Next Message | Jaime Casanova | 2006-11-18 05:49:29 | Re: Migrar Cobol Postgresql |
Previous Message | Miguel Santillan | 2006-11-18 04:12:43 | Migrar Cobol Postgresql |