Re: Issue with a variable in a function - Mailing list pgsql-sql

From tlund79
Subject Re: Issue with a variable in a function
Date
Msg-id B4EB9C9043754B458497ED2C0CD37CF240590F8E29@fixoosr61.findexa.net
Whole thread Raw
In response to Re: Issue with a variable in a function  ("David Johnston" <polobo@yahoo.com>)
Responses Re: Issue with a variable in a function
List 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:[hidden email]]
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:
click here.
See how NAML generates this email



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

pgsql-sql by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: Partitionning + Trigger and Execute not working as expected
Next
From: tlund79
Date:
Subject: Re: Issue with a variable in a function