Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
ALLBASE/SQL Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 10 SQL Statements A - D

BEGIN

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The BEGIN statement is a compound statement and defines a group of statements within a procedure.

Scope

Procedures only

SQL Syntax

  BEGIN [Statement;][...] END;

Parameters

Statement

is the statement or statements between the begin and end of the statement.

Description

  • This statement can be used to improve readability.

Authorization

Anyone can use the BEGIN statement.

Example

   CREATE PROCEDURE PurchDB.DiscountPart(PartNumber CHAR(16)) 
AS BEGIN
DECLARE SalesPrice DECIMAL(6,2);

SELECT SalesPrice INTO :SalesPrice
FROM PurchDB.Parts
WHERE PartNumber = :PartNumber;

IF ::sqlcode = 0 THEN
IF :SalesPrice > 100. THEN
BEGIN
:SalesPrice = :SalesPrice*.80;
INSERT INTO PurchDB.Discounts
VALUES (:PartNumber, :SalesPrice);
END
ENDIF;
ENDIF;
END;
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.