Thread: STORED PROCEDURES

STORED PROCEDURES

From
JORGE MALDONADO
Date:
I will be using stored procedures in order to perform database operations (insertion, deletion and modification) and this is my first time. If I am going to insert a new record for example, and it contains 50 fields then it means that I need to define 50 input arguments in such a store procedure. Is this correct? If so, is it a good idea?
 
Please advice on how to perform database operations using stored procedures.
 
Respectfully,
Jirge Maldonado

Re: STORED PROCEDURES

From
Andreas Wenk
Date:
JORGE MALDONADO schrieb:
> I will be using stored procedures in order to perform database
> operations (insertion, deletion and modification) and this is my first
> time. If I am going to insert a new record for example, and it contains
> 50 fields then it means that I need to define 50 input arguments in such
> a store procedure. Is this correct? If so, is it a good idea?
>
> Please advice on how to perform database operations using stored procedures.

you should have a look to the docu first:

http://www.postgresql.org/docs/8.4/interactive/server-programming.html

And her for using PL/pgSQL (the procedural language for user defined function sin PostgreSQL):

http://www.postgresql.org/docs/8.4/interactive/plpgsql.html

There you will finde several possibilities for the use of UDF.

Regarding your question you should have a look to rowtypes in special:

http://www.postgresql.org/docs/8.4/interactive/plpgsql-declarations.html#PLPGSQL-DECLARATION-ROWTYPES

Cheers

Andy