Типы хранимых процедур System stored procedures User-defined stored procedures Temporary stored procedures
Создание и удаление хранимой процедуры CREATE PROCEDURE ИмяПроцедуры [( [, …])] [RETURNS ( [, ( …])] AS [ ] BEGIN ; [ ;…] END
Объявление переменной DECLARE VARIABLE ;
Условный оператор IF ( ) THEN [ELSE ] Оператор FOR FOR SELECT INTO DO
Операторы WHILE и EXIT WHILE ( ) DO Оператор EXECUTE PROCEDURE EXECUTE PROCEDURE [ [, …]] [RETURING_VALUES: [,: …]];
Пример CREATE PROCEDURE (Nakl INT) RETURNS (Name VARCHAR(150), Quan SMALLINT, Price FLOAT, Summa FLOAT) AS DECLARE VARIABLE Aut VARCHAR(40); DECLARE VARIABLE Pub VARCHAR(40); BEGIN FOR SELECT BName, BAuthor, BPublish, MQuan, MPrice, MQuan*MPrice FROM Books, MoveBook WHERE MNakl:=Nakl AND BookID=MBook ORDER BY BName INTO :Name, :Aut, :Pub, :Quan, :Price, :Summa DO BEGIN Name:=Name || / || Aut || / || Pub; SUSPEND; END
Хранимые процедуры в Visual Basic.Net