Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 14CE81E4DFD1 for ; Wed, 9 Nov 2011 04:32:22 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 90352-09 for ; Wed, 9 Nov 2011 08:32:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mail.postgresql.org (Postfix) with ESMTP id 84EED1E4DFD0 for ; Wed, 9 Nov 2011 04:32:14 -0400 (AST) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RO3Zs-0005FW-QE for pgsql-sql@postgresql.org; Wed, 09 Nov 2011 00:32:12 -0800 Date: Wed, 9 Nov 2011 00:32:12 -0800 (PST) From: tlund79 To: pgsql-sql@postgresql.org Message-ID: In-Reply-To: <006801cc9e3b$bb177ec0$31467c40$@yahoo.com> References: <1320758213629-4974235.post@n5.nabble.com> <006801cc9e3b$bb177ec0$31467c40$@yahoo.com> Subject: Re: Issue with a variable in a function MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1961_9495521.1320827532806" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.777 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201111/42 X-Sequence-Number: 36015 ------=_Part_1961_9495521.1320827532806 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thank you for your reply. I've tried that and the function runs OK, my issue then is maybe selecting the function? I've tried both select ppr_pf_inn_antall(2011,1,52,[8,3]) and select ppr_pf_inn_antall(2011,1,52,{8,3}) but none of them runs. I've read up about arrays and functions, but guess I'm missing the "functions for dummies" tutorial. :) Please note that since posting this I've have changed some details such as naming etc. From: David Johnston [via PostgreSQL] [mailto:ml-node+s1045698n4975030h80@n5.nabble.com] Sent: 8. november 2011 18:28 To: Lund, Thomas Subject: Re: Issue with a variable in a function -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of tlund79 Sent: Tuesday, November 08, 2011 8:17 AM To: [hidden email] Subject: [SQL] Issue with a variable in a function The issue relates to the variable "prosjektkode" ($4). CREATE OR REPLACE FUNCTION ppr_data(aarstall int, frauke int, tiluke int, prosjektkode int) RETURNS int AS $$ DECLARE antall bigint; -----------/Original Message---------- Read about "ARRAY"s Change your function signature to something like: CREATE OR REPLACE FUNCTION ppr_data(aarstall int, frauke int, tiluke int, prosjektkode int[] ) -- Note the change to int[] from int for prosjektkode David J. -- Sent via pgsql-sql mailing list ([hidden email]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql ________________________________ If you reply to this email, your message will be added to the discussion below: http://postgresql.1045698.n5.nabble.com/Issue-with-a-variable-in-a-function-tp4974235p4975030.html To unsubscribe from Issue with a variable in a function, click here. See how NAML generates this email -- View this message in context: http://postgresql.1045698.n5.nabble.com/Issue-with-a-variable-in-a-function-tp4974235p4977097.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. ------=_Part_1961_9495521.1320827532806 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable

Thank you for your reply.

 

I've tried that and the function= runs OK, my issue then is maybe selecting the function? I've tried both se= lect ppr_pf_inn_antall(2011,1,52,[8,3]) and select ppr_pf_inn_antall(2011,1= ,52,{8,3}) but none of them runs. I've read up about arrays and functions, = but guess I'm missing the "functions for dummies" tutorial. :)

 

Please note that since posting this I've have changed some details su= ch as naming etc.

 

 

From: David Johnston [via PostgreSQL= ] [mailto:[hidden email]]
= Sent: 8. november 2011 18:28
To: Lund, Thomas
Subjec= t: Re: Issue with a variable in a function

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of tlund79
Se= nt: Tuesday, November 08, 2011 8:17 AM
To: [hidden email]
Subject: [SQL] Issue with a var= iable in a function


The issue relates to the variable "pro= sjektkode" ($4).

CREATE OR REPLACE FUNCTION ppr_data(aarstall = int, frauke int, tiluke int,
prosjektkode int) RETURNS int AS $$ DECLAR= E antall bigint;

-----------/Original Message----------

Rea= d about "ARRAY"s

Change your function signature to someth= ing like:

CREATE OR REPLACE FUNCTION ppr_data(aarstall int, frauke = int, tiluke int,
prosjektkode int[] )  -- Note the change to int[]= from int for prosjektkode

David J.



--
Sent via= pgsql-sql mailing list ([= hidden email])
To make changes to your subscription:
click here.
See how NAML generates this email

=09

View this message in context: RE: Issue= with a variable in a function
Sent from the PostgreSQL - sql mailing list archive at Nabble.com= .
------=_Part_1961_9495521.1320827532806--