SQL Engine Reference
Total Page:16
File Type:pdf, Size:1020Kb
Pervasive.SQL 2000i SQL Engine Reference Reference for Using SQL with Pervasive.SQL 2000 Service Pack 3 Pervasive Software, Inc. 12365 Riata Trace Parkway Building II Austin, TX 78727 USA Telephone: +1 512 231 6000 or 800 287 4383 Fax: +1 512 231 6010 E-Mail: [email protected] Web: http://www.pervasive.com disclaimer PERVASIVE SOFTWARE INC. LICENSES THE SOFTWARE AND DOCUMENTATION PRODUCT TO YOU OR YOUR COMPANY SOLELY ON AN “AS IS” BASIS AND SOLELY IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE ACCOMPANYING LICENSE AGREEMENT. PERVASIVE SOFTWARE INC. MAKES NO OTHER WARRANTIES WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE SOFTWARE OR THE CONTENT OF THE DOCUMENTATION; PERVASIVE SOFTWARE INC. HEREBY EXPRESSLY STATES AND YOU OR YOUR COMPANY ACKNOWLEDGES THAT PERVASIVE SOFTWARE INC. DOES NOT MAKE ANY WARRANTIES, INCLUDING, FOR EXAMPLE, WITH RESPECT TO MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE OR ARISING FROM COURSE OF DEALING OR USAGE OF TRADE, AMONG OTHERS. trademarks Btrieve, Tango, Client/Server in a Box, and the Pervasive Software logo are registered trademarks of Pervasive Software Inc. Built on Pervasive, Built on Pervasive Software, Extranet in a Box, Pervasive.SQL, Jtrieve, Plug n’ Play Databases, SmartScout, Solution Network, Ultra-light Z-DBA, Z-DBA, ZDBA, UltraLight, MicroKernel Database Engine, and MicroKernel Database Architecture are trademarks of Pervasive Software Inc. Microsoft, MS-DOS, Windows, Windows NT, Win32, Win32s, and Visual Basic are registered trademarks of Microsoft Corporation. Windows 95 is a trademark of Microsoft Corporation. NetWare and Novell are registered trademarks of Novell, Inc. NetWare Loadable Module, NLM, Novell DOS, Transaction Tracking System, and TTS are trademarks of Novell, Inc. All other company and product names are the trademarks or registered trademarks of their respective companies. Copyright 2001 Pervasive Software Inc. All rights reserved. Reproduction, photocopying, or transmittal of this publication, or portions of this publication, is prohibited without the express prior written consent of the publisher. This product includes software developed by Powerdog Industries. Copyright 1994 Powerdog Industries. All rights reserved. The ODBC Driver Manager for NetWare (ODBC.NLM) included in this product is based on the GNU iODBC software Copyright 1995 by Ke Jin <[email protected]> and was modified by Simba Technologies Inc. in June 1999. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is included in your installation of Pervasive.SQL 2000 at \pvsw\doc\lesser.htm. If you cannot find this license, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- 1307 USA. You may contact Pervasive Software Inc. using the contact information on the back cover of this manual. SQL Engine Reference March 2001 100-003673-004 Contents About This Manual . xi Who Should Read this Manual . xii Manual Organization . xiii Conventions . xiv For More Information . xv 1 SQL Overview . 1-1 An Overview of the Structured Query Language (SQL) Data Definition Statements . 1-3 Creating, Modifying, and Deleting Tables . 1-3 Creating and Deleting Indexes . 1-4 Creating and Deleting Triggers . 1-4 Creating and Deleting Stored Procedures . 1-5 Data Manipulation Statements . 1-6 Retrieving Data. 1-6 Modifying Data. 1-7 Defining Transactions . 1-7 Creating and Deleting Views . 1-8 Executing Stored Procedures . 1-8 Executing Triggers . 1-8 Data Control Statements . 1-9 Enabling and Disabling Security . 1-9 Creating and Deleting Users and Groups . 1-10 Granting and Revoking Rights . 1-10 Database Names. 1-11 2 ODBC Engine Reference. 2-1 A Reference to Pervasive.SQL Supported Syntax Pervasive ODBC Engine Interface Limits . 2-2 Data Source Name Connection String Keywords . 2-3 ODBC API Conformance . 2-5 Exceptions to ODBC API Conformance . 2-7 SQL Grammar Conformance . 2-11 Delimited Identifiers in SQL Statements . 2-13 Global Variables . 2-13 SQL Grammar Elements . 2-16 ADD . 2-17 ALL . 2-18 ALTER TABLE . 2-19 ANY . 2-30 iii Contents AS . 2-31 BEGIN [ATOMIC] . 2-32 CALL . 2-33 CASCADE . 2-34 CASE . 2-35 CLOSE . 2-36 COMMIT . 2-37 CREATE GROUP . 2-39 CREATE INDEX . 2-40 CREATE PROCEDURE . 2-42 CREATE TABLE . 2-50 CREATE TRIGGER . 2-59 CREATE VIEW . 2-62 DECLARE . 2-64 DECLARE CURSOR . 2-65 DELETE (positioned) . 2-66 DELETE . 2-67 DISTINCT . 2-68 DROP GROUP . 2-69 DROP INDEX . 2-70 DROP PROCEDURE . 2-71 DROP TABLE . 2-72 DROP TRIGGER . 2-73 DROP VIEW . 2-74 END . 2-75 EXISTS . 2-76 FETCH . 2-77 FOREIGN KEY . 2-78 GRANT . 2-80 GROUP BY. 2-85 HAVING . 2-87 IF . 2-88 IN . 2-89 INSERT . 2-90 JOIN . 2-94 LEAVE . 2-101 LOOP. 2-102 NOT . 2-103 OPEN. 2-104 PRIMARY KEY . 2-105 PUBLIC . 2-107 PRINT . 2-108 RELEASE SAVEPOINT . 2-109 RESTRICT . 2-111 REVOKE . 2-112 iv Contents ROLLBACK . 2-114 SAVEPOINT . 2-115 SELECT (with into) . 2-117 SELECT . 2-118 SET SECURITY . 2-129 SET TRUENULLCREATE . 2-130 SET VARIABLE . 2-131 SIGNAL . 2-132 SQLSTATE . 2-133 START TRANSACTION . ..