Sybase uses a standard syntax for creating procedures as well as other DBMS such as SQL Server and Firebird also use language PLSQL.

 

CREATE PROCEDURE [Procedure Name] ([Parameters])

BEGIN

[Commands]

END

 

In procedures created in Sybase is necessary to indicate the type of each parameter (IN / OUT), and follow the pattern of creation as shown in the syntax. As a practical example we will create two different types of procedures to exemplify the best possible use.

 

CREATE PROCEDURE productList

BEGIN

SELECT Name, Size, Color FROM Product

END

 

CREATE PROCEDURE productByCod ( IN vCod Int )

BEGIN

SELECT Name, Size, Color

FROM Product

WHERE cod_prod = vCod

END

In the first example the procedure returns all rows from the Products table, in second example will be returned only product that matches the user code passed as a parameter.

To perform both procedures is used CALL command, as shown in the example below:

CALL productList

CALL productByCod (1)

sybase

Sybase has become a great option for database and so it is increasingly common to find it in web development environments. Better understand this scenario in our official page about Sybase in PHP projects.

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.