Ver Mensaje Individual
  #2  
Antiguo 06-03-2007
Avatar de movorack
[movorack] movorack is offline
Miguel A. Valero
 
Registrado: feb 2007
Ubicación: Bogotá - Colombia
Posts: 1.346
Reputación: 20
movorack Va camino a la famamovorack Va camino a la fama
Que chevere!!!!

Bueno mi gente... la busqueda en realidad fué extenuante pero lo CONSEGUI!!!!, lo encontre, lo hallé, está conmigo, es inherente a mi.

esta es la solución:

Código SQL [-]
Select public.foo('{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}'::integer[])

para este ejemplo, hice algunas pruebas y cree una función así:

Código SQL [-]
CREATE OR REPLACE FUNCTION "public"."foo" (var1 integer []) RETURNS integer AS
$body$
DECLARE
 i INTEGER;
 var1_size INTEGER;
BEGIN
  var1_size := substring(substring(array_dims(var1), 4), 1,strpos(substring(array_dims(var1), 4), ']')-1)::INTEGER;
  FOR i IN 1..var1_size LOOP
    RAISE NOTICE '% - VALOR: %', i, var1[i];
  END LOOP;
  RETURN NULL;
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

lo que al ejecutar la primera porción de código me devuelve:

NOTICE: 1 - VALOR: 2
NOTICE: 2 - VALOR: 4
NOTICE: 3 - VALOR: 6
NOTICE: 4 - VALOR: 8
NOTICE: 5 - VALOR: 10
NOTICE: 6 - VALOR: 12
NOTICE: 7 - VALOR: 14
NOTICE: 8 - VALOR: 16
NOTICE: 9 - VALOR: 18
NOTICE: 10 - VALOR: 20
NOTICE: 11 - VALOR: 22
NOTICE: 12 - VALOR: 24
NOTICE: 13 - VALOR: 26
NOTICE: 14 - VALOR: 28
NOTICE: 15 - VALOR: 30

comparditos... gracias... la soulción era realizar un TypeCast a la cadena que paso en la consulta y listo.

bueno... muchas gracias y bendiciones a todos.
__________________
Buena caza y buen remar... http://mivaler.blogspot.com
Responder Con Cita