Re: Issue with a variable in a function

From: tlund79 <thomas(dot)lund(at)eniro(dot)no>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Issue with a variable in a function
Date: 2011-11-09 08:32:12
Message-ID: B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)n5(dot)nabble(dot)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=4974235&code=dGhvbWFzLmx1bmRAZW5pcm8ubm98NDk3NDIzNXwtMjE0NTgyMTQ1Mw==>.
See how NAML generates this email<http://postgresql.1045698.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message tlund79 2011-11-09 10:41:39 Re: Issue with a variable in a function
Previous Message Josh Kupershmidt 2011-11-09 00:35:31 Re: Partitionning + Trigger and Execute not working as expected