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])
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
SELECT Name, Size, Color FROM Product
CREATE PROCEDURE productByCod ( IN vCod Int )
SELECT Name, Size, Color
WHERE cod_prod = vCod
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 productByCod (1)
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.