As in other DBMS, procedures are widely used in Firebird optimizing processes and improving performance of the database in the execution of more complex commands. Using the following syntax quickly you can create them:

CREATE PROCEDURE [Procedure name]([IN Parameters])

AS

[Variables]

BEGIN

[Command Lines]

END

Note that there is a specific space for the declaration of variables, before the beginning and end of the command block, so if you need to use variables other than those passed as parameter is required to use this space.

As a practical example we will create a simple procedure that returns a query product.

CREATE PROCEDURE sp_Product_Query()

AS

BEGIN

SELECT Cod_Prod, Name

FROM product

END

We will also create a procedure to insert using information passed as parameters.

CREATE PROCEDURE sp_Product_Insert( Namep Varchar(200) )

AS

BEGIN

INSERT INTO product (Name)

VALUES (Namep)

END

In web applications, for example, the use of procedures is very common because most of the interactions with the database are done using them.

firebird

With the popularization of the Firebird development environments is important to understand its functioning, especially in the development of web applications. Discover the advantages of working with Firebird and PHP on our official site and understand better this scenario.

You might also like…

PROCESAMIENTO AJAX EN SCRIPTCASE

Ajax en los formularios de Scriptcase puede usarse para recargar un campo de tipo de select basado e...

IMPORTAR IMAGENES DE LA BASE DE DATOS Y UTILIZAR CLASES DE BOOSTRAP

Como muchas personas ya saben, Bootstrap es una biblioteca de front-end libre y de código abierto p...

TENDENCIAS DE DESARROLLO WEB PARA 2017

Usted verá en este post tendencias para 2017 en Diseño Web, en el medio digital y en el desarrollo...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.