Función retornar valor mejorada!!

From: José Fermín francisco ferreras <josefermin54(at)hotmail(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Función retornar valor mejorada!!
Date: 2006-04-21 18:03:58
Message-ID: BAY23-F1317C362BA97A2BBEC1760C6BB0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola gente, la función q les hable ayer ya la remodelé y ahora me funciona
bien. Asi q quien quiera utilizarla aqui se la mando y quien quiera
mejorarla la mejore.

Para la gente q busca una alternativa a las secuencias aquí les va esta
función:

CREATE OR REPLACE FUNCTION mifuncion()
RETURNS int4 AS
$BODY$
declare
cod integer;
begin
select into cod max(id)
from tabla;
if cod isnull then
return (1);
else
return (cod + 1);
end if;
end;
$BODY$
LANGUAGE 'plpgsql' STABLE;
ALTER FUNCTION mifuncion() OWNER TO postgres;

Cualquien cosa me avisan.

<html><div>ing. José Fermín Francisco Ferreras <BR>San Francisco de Macorís,
Rep. Dom. <BR></div></html>

_________________________________________________________________
Latinos en EE.UU: noticias y artículos de interés para ti
http://latino.msn.com/noticias/latinoseneeuu

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Espartano 2006-04-21 18:10:20 Re: OT OT Re: Pregunta
Previous Message Juan Martínez 2006-04-21 18:02:03 OT OT Re: Pregunta