| From: | Petru Ghita <petrutz(at)venaver(dot)info> | 
|---|---|
| To: | Gianvito Pio <pio(dot)gianvito(at)gmail(dot)com> | 
| Cc: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: Create functions using a function | 
| Date: | 2010-03-01 22:38:14 | 
| Message-ID: | 4B8C41D6.70201@venaver.info | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Yes, it's possible. Use EXECUTE.
There is one example under "Example 38-9. Porting a Procedure from
PL/SQL to PL/pgSQL"
http://www.postgresql.org/docs/8.4/static/plpgsql-porting.html
Also have look in:
http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html
under "37.6.5. Executing Dynamic Commands"
Petru Ghita
Gianvito Pio wrote:
> Hi all, is there a way to define functions and/or triggers in a
> function?
>
> For example, can I create a function that takes an argument and
> defines a function that has the name passed as argument to the
> first function?
>
> Something like this .....
>
> CREATE FUNCTION test (name varchar) RETURNS VOID AS $$ BEGIN CREATE
>  FUNCTION name ( ) (here "name" should be expanded to the variable
> content) RETURNS .... ...
>
> END $$
>
> Is there a way to do this? Thanks
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iEYEARECAAYFAkuMQdYACgkQt6IL6XzynQSjoQCffcPZ2W69uy3wpGlkhkraQm2a
p0IAnA+8njdC6nAdpdhaTg/M9QEohYVb
=/tvu
-----END PGP SIGNATURE-----
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ray Madigan | 2010-03-02 02:10:47 | Trigger on select :-( | 
| Previous Message | Gianvito Pio | 2010-03-01 21:50:23 | Create functions using a function |