specyfikacja.pdf

(2621 KB) Pobierz
Language Reference
InterBase 5
Language
Reference
InterBase ®
SOFTWARE CORPORATION
100 Enterprise Way, Suite B2 Scotts Valley, CA 95066 http://www.interbase.com
 
82052840.001.png
InterBase Software Corp. and INPRISE Corporation may have patents and/or pending patent applications
covering subject matter in this document. The furnishing of this document does not convey any license to these
patents.
Copyright 1998 InterBase Software Corporation. All rights reserved. All InterBase products are trademarks or
registered trademarks of InterBase Software Corporation. All Borland products are trademarks or registered
trademarks of INPRISE Corporation, Borland and Visibroker Products. Other brand and product names are
trademarks or registered trademarks of their respective holders.
1INT0055WW21004 5E4R0898
9899000102-9 8 7 6 5 4 3 2 1
D4
Ta b le o f Co nt e nt s
List of Tables.................. vii
COUNT( ) ....................44
CREATE DATABASE ..............45
CREATE DOMAIN ...............48
CREATE EXCEPTION .............52
CREATE GENERATOR .............53
CREATE INDEX ................54
CREATE PROCEDURE .............55
CREATE ROLE .................63
CREATE SHADOW ...............63
CREATE TABLE ................66
CREATE TRIGGER ...............75
CREATE VIEW .................82
DECLARE CURSOR ..............85
DECLARE CURSOR (BLOB) .........87
DECLARE EXTERNAL FUNCTION ......88
DECLARE FILTER ...............90
DECLARE STATEMENT ............91
DECLARE TABLE ...............92
DELETE .....................93
DESCRIBE ...................95
DISCONNECT .................96
DROP DATABASE ...............97
DROP DOMAIN ................97
DROP EXCEPTION ..............98
DROP EXTERNAL FUNCTION ........99
DROP FILTER ................ 100
DROP INDEX ................ 101
DROP PROCEDURE ............. 102
DROP ROLE ................. 103
Chapter 1 Using the InterBase
Language Reference
Who should use this book ...........9
Topics covered in this book ......... 10
Chapter 2 SQL Statement and
Function Reference
Database object naming conventions .... 12
Statement list ................. 13
Function list .................. 14
Datatypes ................... 15
Error handling ................ 16
Using statement and function definitions .17
ALTER DATABASE .............. 18
ALTER DOMAIN ................ 19
ALTER EXCEPTION .............. 21
ALTER INDEX ................. 22
ALTER PROCEDURE ............. 23
ALTER TABLE ................. 25
ALTER TRIGGER ............... 31
AVG ( ) ..................... 33
BASED ON ................... 34
BEGIN DECLARE SECTION ......... 35
CAST( ) .................... 35
CLOSE ..................... 36
CLOSE (BLOB) ................ 37
COMMIT .................... 38
CONNECT ................... 40
LANGUAGE REFERENCE
iii
DROP SHADOW ...............104
DROP TABLE .................105
DROP TRIGGER ...............106
DROP VIEW ..................107
END DECLARE SECTION ...........107
EVENT INIT ..................108
EVENT WAIT .................109
EXECUTE ...................110
EXECUTE IMMEDIATE ............112
EXECUTE PROCEDURE ...........113
FETCH .....................115
FETCH (BLOB) ................117
GEN_ID( ) ...................118
GRANT .....................119
INSERT ....................123
INSERT CURSOR (BLOB) ..........125
MAX( ) .....................126
MIN( ) .....................127
OPEN ......................128
OPEN (BLOB) .................129
PREPARE ...................130
REVOKE ....................132
ROLLBACK ..................135
SELECT ....................136
SET DATABASE ................143
SET GENERATOR ...............145
SET NAMES ..................146
SET STATISTICS ...............148
SET TRANSACTION ..............149
SUM( ) .....................152
UPDATE ....................153
UPPER( ) ...................155
WHENEVER ..................156
Chapter 3 Procedures and Triggers
Creating triggers and stored procedures . 160
Nomenclature conventions ......... 160
Assignment statement ........... 161
BEGIN … END ................ 162
Comment ................... 163
DECLARE VARIABLE ............ 164
EXCEPTION ................. 164
EXECUTE PROCEDURE ........... 165
EXIT ..................... 167
FOR SELECT…DO .............. 169
IF…THEN … ELSE ............. 170
Input parameters .............. 171
NEW context variables ........... 172
OLD context variables ........... 173
Output parameters ............. 174
POST_EVENT ................ 175
SELECT .................... 176
SUSPEND ................... 177
WHEN … DO ................. 179
Handling exceptions ........... 180
Handling SQL errors ........... 180
Handling InterBase error codes ..... 180
WHILE … DO ................ 182
Chapter 4 Keywords
InterBase keywords ............. 184
Chapter 5 User-Defined Functions
Thread-safe UDFs .............. 190
Declaring UDFs with FREE_IT ...... 190
Writing UDFs ............... 190
UDF library ................. 191
iv
INTERBASE 5
Chapter 6 Error Codes and Messages
Error sources .................199
Error reporting and handling ........200
Trapping errors with WHENEVER ... 200
Checking SQLCODE value directly ... 200
InterBase status array .......... 201
For more information .......... 203
SQLCODE error codes and messages ....204
SQLCODE error messages summary . . 204
SQLCODE codes and messages ..... 204
InterBase status array error codes .....221
RDB$PROCEDURE_PARAMETERS .... 263
RDB$PROCEDURES ............. 264
RDB$REF_CONSTRAINTS ......... 265
RDB$RELATION_CONSTRAINTS ..... 266
RDB$RELATION_FIELDS .......... 267
RDB$RELATIONS .............. 269
RDB$ROLES ................. 270
RDB$SECURITY_CLASSES ......... 271
RDB$TRANSACTIONS ........... 271
RDB$TRIGGER_MESSAGES ........ 272
RDB$TRIGGERS ............... 272
RDB$TYPES ................. 274
RDB$USER_PRIVILEGES .......... 275
RDB$VIEW_RELATIONS .......... 276
System views ................. 276
CHECK_CONSTRAINTS ........... 278
CONSTRAINTS_COLUMN_USAGE ..... 278
REFERENTIAL_CONSTRAINTS ....... 279
TABLE_CONSTRAINTS ........... 279
Chapter 7 System Tables and Views
Overview ...................243
System tables .................244
RDB$CHARACTER_SETS ...........245
RDB$CHECK_CONSTRAINTS ........246
RDB$COLLATIONS ..............246
RDB$DATABASE ...............247
RDB$DEPENDENCIES ............248
RDB$EXCEPTIONS ..............249
RDB$FIELD_DIMENSIONS .........250
RDB$FIELDS .................250
RDB$FILES ..................255
RDB$FILTERS .................256
RDB$FORMATS ................257
RDB$FUNCTION_ARGUMENTS .......257
RDB$FUNCTIONS ..............259
RDB$GENERATORS .............260
RDB$INDEX_SEGMENTS ..........260
RDB$INDICES ................261
RDB$LOG_FILES ...............262
RDB$PAGES ..................262
Chapter 8 Character Sets and
Collation Orders
InterBase character sets and
collation orders ............... 282
Character set storage requirements ... 286
Support for Paradox and dBASE .... 287
Additional character sets and collations 288
Specifying character sets .......... 288
Default character set for a database . . 289
Character set for a column in a table . . 289
Character set for a client attachment . . 290
Collation order for a column ...... 290
Collation order in comparison ..... 291
Collation order in ORDER BY ...... 291
LANGUAGE REFERENCE
v
Zgłoś jeśli naruszono regulamin