Online Eiffel Documentation
EiffelStudio

Stored Procedures

When sending requests to the database, the request is first parsed then executed. Instead of parsing many times the same requests, i.e. with only changes in expression values, most of RDBMS enable toprecompile requests. These requests can then be executed as routines and are identified by a name and a signature.

EiffelStore lets you use stored procedures with DB_PROC class to:

Executing a stored procedure

To execute a stored procedure:

Creating a stored procedure

DB_PROC also enables you to create or drop stored procedures:

The following example shows how to overwrite a procedure in the database:

	procedure: DB_PROC

	...
	create procedure.make ("NEW_PROCEDURE")
	procedure.load
	if procedure.exists then
		procedure.drop
	end
	procedure.load
	if not procedure.exists then
		procedure.set_arguments (<<"one_arg">>, <<"">>)
		procedure.store ("update contacts set firstname = one_arg where contactid = 1")
	end

See Also
Performing a database selection.
Coupling database data and Eiffel objects.