Skip site navigation (1) Skip section navigation (2)

Function with Array

From: "Smart Softwares - D(dot) & S(dot)" <smartds(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Function with Array
Date: 2007-01-22 19:51:55
Message-ID: 9907c4090701221151x202a390fq4efcc36411b5ed50@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
Hello to all... I am with a problem in a function that I am creating. The
parameters that are function go to receive are an ARRAY and the return also
will be an ARRAY, the entrance parameters will be used in a clause SQL. E
the exit ARRAY will be the result of the SQL. However, I elaborated the
function and independent of the value that played in the ARRAY the result of
the SQL was always null. To make a test I elaborated the function below and
I perceived that my ARRAY had the null values.

CREATE OR REPLACE FUNCTION TB_ADM_CEP_SEL (numeric [])
     RETURNS numeric [] AS
$body$
DECLARE
BEGIN
      --SELECT "TX_CEP" FROM "SMART"."TB_ADM_CEP"
      --WHERE "PK_IN_COD_CEP" = $1[0];
  RETURN $1[0];
END;
$body$
LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER;
Somebody knows what I am making of made a mistake in this function to have
these results? They forgive my English good and not very obliged for the
suggestions.
Thank you...

Responses

pgsql-admin by date

Next:From: Peter KoczanDate: 2007-01-22 20:36:55
Subject: Re: Upgrading to 8.2, changes in user/group management scripts
Previous:From: Ray StellDate: 2007-01-22 18:39:37
Subject: Re: Startup problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group