Thread: multiple function declarations

multiple function declarations

From
"Majhi, Akas"
Date:
Hi ,
 
I have a plpgsql function (MainFunc) that intends to reuse a a particular block of code. So, I intend to make that particulat block of code into another function. (say, HelperFunc)
 
My question is
 
1. Can I declare a function (HelperFunc) inside the main function  (MainFunc)
 
2. If yes then how.
 
Thanks in advance
-akas

Re: multiple function declarations

From
Peter Eisentraut
Date:
Majhi, Akas writes:

> 1. Can I declare a function (HelperFunc) inside the main function  (MainFunc)
> 2. If yes then how.

You could do it if you create the CREATE FUNCTION command in a string
variable and then use EXECUTE to run it, but the normal way would be to
declare it outside.  There is usually no reason not to do that.

-- 
Peter Eisentraut   peter_e@gmx.net