Ver Mensaje Individual
  #6 (permalink)  
Antiguo 03/11/2010, 09:21
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: error en matriz

pruebalo así

Código SQL:
Ver original
  1. CREATE OR REPLACE FUNCTION pa_validaruc(xruc text)
  2. RETURNS INTEGER AS
  3. $BODY$
  4. DECLARE
  5. i INTEGER;
  6. residuo INTEGER;
  7. ultdigito INTEGER;
  8. aruc INTEGER[][] = array[[0,0,0,0,0,0,0,0,0,0,0]];
  9. BEGIN
  10. IF LENGTH(xruc)<>11 THEN
  11. RETURN 0;
  12. END IF;
  13. FOR i IN 1..11 LOOP
  14. aruc[1][i]:=CAST(SUBSTRING(xruc,i+1,1) AS INTEGER);
  15. END LOOP;
  16. RETURN 1;
  17. END;
  18. $BODY$
  19. LANGUAGE 'plpgsql' VOLATILE
  20. COST 100;

inicializando el array
__________________
Without data, You are another person with an opinion.
W. Edwads Deming