Re: [GENERAL] variables in ad hoc queries

2009-09-29 Thread Iain Barnett
Sorry, in oversimplifying for clarity I was making it more unclear! Whenever I write a function, I like to write a quick ad hoc test to go with it in the comments. It means I can also test combinations of functions together quickly, without having to build other functions first, and gives a

Re: [GENERAL] variables in ad hoc queries

2009-09-29 Thread Brian Modra
2009/9/29 Iain Barnett : > If I have a function that returns an integer, how can I use the following > code outside of a function block? > > declare > _myint int; > > begin > _myint := myfunction( ); > end; > select myfunction from myfunction(); or, you can use the function in SQLs wherever you'd

Re: [GENERAL] variables in ad hoc queries

2009-09-29 Thread Raymond O'Donnell
On 29/09/2009 13:06, Iain Barnett wrote: > If I have a function that returns an integer, how can I use the > following code outside of a function block? > > declare > _myint int; > > begin > _myint := myfunction( ); > end; You can't use this code outside of a function - this just isn't valid SQL

Re: [GENERAL] variables in ad hoc queries

2009-09-29 Thread Merlin Moncure
On Tue, Sep 29, 2009 at 8:06 AM, Iain Barnett wrote: > If I have a function that returns an integer, how can I use the following > code outside of a function block? > > declare > _myint int; > > begin > _myint := myfunction( ); > end; you can...all postgresql functions can be used in queries: se