Programming Guide
Total Page:16
File Type:pdf, Size:1020Kb
Ingres OpenROAD® 2006 Programming Guide OR-2006-PR-02 This documentation and related computer software program (hereinafter referred to as the "Documentation") is for the end user's informational purposes only and is subject to change or withdrawal by Ingres Corporation ("Ingres") at any time. This Documentation may not be copied, transferred, reproduced, disclosed or duplicated, in whole or in part, without the prior written consent of Ingres. This Documentation is proprietary information of Ingres and protected by the copyright laws of the United States and international treaties. Notwithstanding the foregoing, licensed users may print a reasonable number of copies of this Documentation for their own internal use, provided that all Ingres copyright notices and legends are affixed to each reproduced copy. Only authorized employees, consultants, or agents of the user who are bound by the confidentiality provisions of the license for the software are permitted to have access to such copies. This right to print copies is limited to the period during which the license for the product remains in full force and effect. The user consents to Ingres obtaining injunctive relief precluding any unauthorized use of the Documentation. Should the license terminate for any reason, it shall be the user's responsibility to return to Ingres the reproduced copies or to certify to Ingres that same have been destroyed. To the extent permitted by applicable law, INGRES PROVIDES THIS DOCUMENTATION "AS IS" WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. IN NO EVENT WILL INGRES BE LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR INDIRECT, FROM THE USER OF THIS DOCUMENTATION, INCLUDING WITHOUT LIMITATION, LOST PROFITS, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF INGRES IS EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE. The use of any product referenced in this Documentation and this Documentation is governed by the end user's applicable license agreement. The manufacturer of this Documentation is Ingres Corporation. For government users, the Documentation is delivered with "Restricted Rights" as set forth in 48 C.F.R. Section 12.212, 48 C.F.R. Sections 52.227-19(c)(1) and (2) or DFARS Section 252.227-7013 or applicable successor provisions. Copyright © 2008 Ingres Corporation. All Rights Reserved. Ingres, OpenROAD, and EDBC are registered trademarks of Ingres Corporation. All other trademarks, trade names, service marks, and logos referenced herein belong to their respective companies. Contents Chapter 1: Introduction 13 In This Guide ...................................................................................................................... 13 Intended Audience .............................................................................................................. 14 Database-related Examples ............................................................................................. 14 Conventions ....................................................................................................................... 15 Documentation ................................................................................................................... 16 Your Support Options........................................................................................................... 17 Chapter 2: Language Elements 19 OpenROAD Names............................................................................................................... 19 Dynamic Names ............................................................................................................ 20 Name Resolution............................................................................................................ 21 Variables............................................................................................................................ 25 Simple Variables ............................................................................................................ 26 Reference Variables........................................................................................................ 28 Dynamic Array Variables ................................................................................................. 31 Field and Menu Item Variables ......................................................................................... 33 How You Can Initialize Variables ...................................................................................... 34 Data Types......................................................................................................................... 35 Nulls ................................................................................................................................. 35 Expressions ........................................................................................................................ 36 Literals......................................................................................................................... 37 Named Constants .......................................................................................................... 38 System Variables ........................................................................................................... 39 Operators ..................................................................................................................... 40 Variables in Expressions.................................................................................................. 47 Procedures in Expressions ............................................................................................... 47 Methods in Expressions................................................................................................... 48 Nulls in Expressions ....................................................................................................... 49 Expressions in SQL Statements........................................................................................ 50 System-defined Functions..................................................................................................... 50 Scalar Functions ............................................................................................................ 51 Aggregate Functions....................................................................................................... 61 The Ifnull Function ......................................................................................................... 63 Dbmsinfo Function ......................................................................................................... 64 Field Function................................................................................................................ 65 Comments ......................................................................................................................... 65 Contents iii Chapter 3: Writing Scripts and Procedures 67 Scripts............................................................................................................................... 67 Frame Scripts................................................................................................................ 67 Field and Menu Item Scripts ............................................................................................ 71 User Class Scripts .......................................................................................................... 73 Statements in Scripts ..................................................................................................... 74 Procedures ......................................................................................................................... 74 How You Can Create Procedures in OpenROAD................................................................... 75 Global Procedures .......................................................................................................... 76 Local Procedures............................................................................................................ 78 Database Procedures...................................................................................................... 79 3GL Procedures ............................................................................................................. 80 Calling Procedures ............................................................................................................... 83 How You Can Call 4GL Procedures .................................................................................... 84 How You Can Call Database Procedures............................................................................. 85 How You Can Call Procedures in Expressions...................................................................... 86 How Procedure Handles Work (ProcHandle Objects).................................................................. 87 How You Can Create a ProcHandle Object.......................................................................... 87 How You Can Execute a ProcHandle Object ........................................................................ 88 Restrictions to Using the Call Method ................................................................................ 89 Global Procedures Available in the Core Library .................................................................