pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tlund79 <thomas.lund@eniro.no>
To: pgsql-sql@postgresql.org
Subject: Re: Issue with a variable in a function
Date: Wed, 9 Nov 2011 00:32:12 -0800 (PST)
Message-ID: <B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net> (raw)
In-Reply-To: <006801cc9e3b$bb177ec0$31467c40$@yahoo.com>
References: <1320758213629-4974235.post@n5.nabble.com>
	<006801cc9e3b$bb177ec0$31467c40$@yahoo.com>

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]</user/SendEmail.jtp?type=node&node=4975030&i=0> [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4975030&i=1>]
On Behalf Of tlund79
Sent: Tuesday, November 08, 2011 8:17 AM
To: [hidden email]</user/SendEmail.jtp?type=node&node=4975030&i=2>
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]</user/SendEmail.jtp?type=node&node=4975030&i=3>)
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<http://postgresql.1045698.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=...;.
See how NAML generates this email<http://postgresql.1045698.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_h...;


--
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.

view thread (4+ messages)  latest in thread

Message-ID: <B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net>
Permalink:  ../B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net/
Also on:    postgresql.org/message-id/B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: thomas.lund@eniro.no
  Subject: Re: Issue with a variable in a function
  In-Reply-To: <B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox