Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 6AF1A9FA432 for ; Mon, 22 Jan 2007 15:52:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 64361-05 for ; Mon, 22 Jan 2007 15:51:54 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.241]) by postgresql.org (Postfix) with ESMTP id F1FAF9FB2BC for ; Mon, 22 Jan 2007 15:51:56 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c24so463864ana for ; Mon, 22 Jan 2007 11:51:56 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Q37gLXhvuBzHt8im6jSw9sl/Yjyq9APNpdJGfWJMJFhqPkcp5oNrdtVPaxD8NxFJ0+Z8yuWly3D1C0UXAhqf1judS3sbNbZ+IcmhzpM81rS31nvzusqhVvfG0JNVumhTSNDd8ENYMeVN9x54WESXoRT1YWloSnB/gQdWuUGHk6c= Received: by 10.48.48.1 with SMTP id v1mr7314801nfv.1169495515176; Mon, 22 Jan 2007 11:51:55 -0800 (PST) Received: by 10.48.203.4 with HTTP; Mon, 22 Jan 2007 11:51:55 -0800 (PST) Message-ID: <9907c4090701221151x202a390fq4efcc36411b5ed50@mail.gmail.com> Date: Mon, 22 Jan 2007 17:51:55 -0200 From: "Smart Softwares - D. & S." To: pgsql-admin@postgresql.org Subject: Function with Array MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_53465_25121376.1169495515135" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.926 tagged_above=0 required=5 tests=AWL, BAYES_20, HTML_10_20, HTML_MESSAGE, SPF_PASS, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200701/203 X-Sequence-Number: 24359 ------=_Part_53465_25121376.1169495515135 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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... ------=_Part_53465_25121376.1169495515135 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

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...
------=_Part_53465_25121376.1169495515135--