HPlogo ALLBASE/SQL Database Administration Guide: HP 3000 MPE/iX Computer Systems > Appendix G SQLGEN

GENERATE PROCEDURES

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Generates SQL statements to recreate one or more procedures in a DBEnvironment.

Scope

SQLGEN only

SQLGEN Syntax

>> [GENERATE] PROCEDURE[S] Schema File Name or '//' to STOP command >> SchemaFileName Owner Name >> OwnerName Do you wish to specify Procedure Names for each Owner (n/y)? { N [O] Y ES } Procedure Name for Owner OwnerName >> ProcedureName

Parameters

SchemaFileName

is the name of the schema file where SQLGEN places generated commands.

OwnerName

is the name of the owner whose procedures you wish to generate.

NO or YES

respond NO to select all procedures for the owner; respond YES to select certain procedures for the owner.

ProcedureName

is the name of a procedure you wish to generate.

Description

  • GENERATE PROCEDURES builds CREATE PROCEDURE commands to recreate one or more procedures in the DBEnvironment.

Example

   >> gen procedures



   ALLBASE/SQL Command Generator for Procedures



   Schema File Name or '//' to STOP command >> partsch



   Please enter Owner Names.  Type @ for all, ? for a list of

   Owner Names, or RETURN to quit.



   Owner Name >> PurchDB

   Do you wish to specify Procedure Names for each Owner (n/y)? n



   Generating command to CREATE PROCEDURE PURCHDB.DISCOUNTPART

   Generating command to CREATE PROCEDURE PURCHDB.REPORTMONITOR



   Owner Name >> Return



   >>


Schema File Produced

   /* This file was created with a user language environment of */

   /*    NATIVE-3000                                            */





   CREATE PROCEDURE PURCHDB.DISCOUNTPART

    (PARTNUMBER CHAR 16)) AS

    begin declare SalesPrice decimal(10,2); declare Discount

   decimal(10,2); select SalesPrice into :SalesPrice from

   PurchDB.Parts where PartNumber = :PartNumber; if :SalesPrice >

   100. then :Discount = .80*:SalesPrice; insert into

   PurchDB.Discounts values (:PartNumber, :Discount); endif; end;





   CREATE PROCEDURE PURCHDB.REPORTMONITOR

    (NAME CHAR(  20) NOT NULL,

     OWNER CHAR(  20) NOT NULL,

     TYPE CHAR(  10) NOT NULL) AS

    begin insert into PurchDB.ReportMonitor values (:Type,

   CURRENT_DATETIME, USER, :Name, :Owner); end;





   COMMIT WORK;


Feedback to webmaster