Re: cursors and function question

2018-02-13 Thread armand pirvu
> On Feb 13, 2018, at 4:37 PM, David G. Johnston > wrote: > > On Tue, Feb 13, 2018 at 3:31 PM, Adrian Klaver > wrote: > 2) By global table do you mean a temporary table? If so not sure that is > going to work as I am pretty sure it will disappear after the fu

Re: cursors and function question

2018-02-13 Thread David G. Johnston
On Tue, Feb 13, 2018 at 3:31 PM, Adrian Klaver wrote: > 2) By global table do you mean a temporary table? If so not sure that is > going to work as I am pretty sure it will disappear after the function is > run. ​Temporary tables can survive until either session or transaction end - neither of

Re: cursors and function question

2018-02-13 Thread Adrian Klaver
On 02/13/2018 01:25 PM, armand pirvu wrote: On Feb 13, 2018, at 1:22 PM, Adrian Klaver > wrote: Not a trigger , but the idea is we will do some batch processing from said table let’s name it testtbl 1 - we get the records using  select for update with a

Re: cursors and function question

2018-02-13 Thread armand pirvu
> On Feb 13, 2018, at 1:22 PM, Adrian Klaver wrote: > > On 02/13/2018 11:17 AM, armand pirvu wrote: >>> On Feb 13, 2018, at 12:54 PM, Adrian Klaver >> >> >> wrote: >>> >>> On 02/13/2018 10:22

Re: cursors and function question

2018-02-13 Thread Adrian Klaver
On 02/13/2018 11:17 AM, armand pirvu wrote: On Feb 13, 2018, at 12:54 PM, Adrian Klaver > wrote: On 02/13/2018 10:22 AM, armand pirvu wrote: Hi Is there any elegant way not a two steps way I can output the cursor value at each step? testtbl table has this c

Re: cursors and function question

2018-02-13 Thread armand pirvu
> On Feb 13, 2018, at 12:54 PM, Adrian Klaver wrote: > > On 02/13/2018 10:22 AM, armand pirvu wrote: >> Hi >> Is there any elegant way not a two steps way I can output the cursor value >> at each step? >> testtbl table has this content >> col1|col2| col3 >> +

Re: cursors and function question

2018-02-13 Thread David G. Johnston
On Tue, Feb 13, 2018 at 12:03 PM, armand pirvu wrote: > > ERROR: RETURN cannot have a parameter in function returning set > LINE 10: return var2; > HINT: Use RETURN NEXT or RETURN QUERY. > > > and it just sits there > > Any hints ? > > https://www.postgresql.org/docs/10/static/plpgsql

Re: cursors and function question

2018-02-13 Thread armand pirvu
> On Feb 13, 2018, at 12:26 PM, David G. Johnston > wrote: > > On Tuesday, February 13, 2018, armand pirvu > wrote: > > CREATE OR REPLACE FUNCTION foofunc() >RETURNS text AS $$ > > select foofunc(); > foofunc > --- >

Re: cursors and function question

2018-02-13 Thread Adrian Klaver
On 02/13/2018 10:22 AM, armand pirvu wrote: Hi Is there any elegant way not a two steps way I can output the cursor value at each step? testtbl table has this content col1|col2| col3 ++-- E1 | CAT1 |0 E1 | CAT2

Re: cursors and function question

2018-02-13 Thread David G. Johnston
On Tuesday, February 13, 2018, armand pirvu wrote: > > CREATE OR REPLACE FUNCTION foofunc() >RETURNS text AS $$ > > select foofunc(); > foofunc > --- > ("E1","CAT1 ",0) > > But I am looking to get > > foofunc >

cursors and function question

2018-02-13 Thread armand pirvu
Hi Is there any elegant way not a two steps way I can output the cursor value at each step? testtbl table has this content col1|col2| col3 ++-- E1 | CAT1 |0 E1 | CAT2 |0 E1 | CAT3 |0 E4