RDB/VMS SQL LSE — VMS RDB_3.1A
VAX Language Sensitive Editor (LSE) is an advanced text editor that is layered on VAXTPU. SQL supports two sets of LSE templates, one for interactive SQL and one for module language. The templates guide you in entering syntactically-correct statements. LSE templates are made up of placeholders representing SQL syntax. You can expand a placeholder or token by positioning the cursor anywhere on it and pressing CTRL/E. When you expand the placeholders, LSE provides the required syntax or indicates optional elements. For more information about LSE, see the VAX Language-Sensitive Editor documentation. For more information about other editors SQL supports, see the online help topic EDIT.
Additional information available:
Invoking LSE
You can invoke LSE in either of the following two ways:
1. To use LSE within interactive SQL, define the logical names
SQL$EDIT and LSE$ENVIRONMENT:
$ DEFINE SQL$EDIT LSE
$ DEFINE LSE$ENVIRONMENT -
_$ SYS$COMMON:[SYSLIB]LSE$SYSTEM_ENVIRONMENT.ENV
Then, when you enter the EDIT command from within SQL, you
automatically invoke LSE with SQL templates.
2. To invoke LSE from DCL level, type LSE followed by the name
of the file you want to edit. The file type determines the
templates that LSE uses. To invoke the templates for
interactive SQL, use the file type of SQL; to invoke the
templates for SQL module language, use the file type of
SQLMOD. For example, you can type the following commands:
$ LSE SAMPLE.SQL
$ LSE SAMPLE.SQLMOD
General SQL terms
You can access online help for any placeholder in the LSE templates for SQL. To obtain this help while you are editing, position your cursor on the placeholder, then press the PF1 and PF2 keys in succession. The templates include some placeholders for low-level syntax. While these topics are essential to SQL, they are so general as to not be applicable at top-level help. This topic, General_SQL_Terms, serves as a location for the low-level help topics that LSE requires.
Additional information available:
check col constraintcol clausecolumn qualifiercolumn namecol definition
file specintegernparameterpath or filepath namequoted string
schema id
check col constraint
col-constraint =
-+-> PRIMARY KEY ----------------------+--+
+-> NOT NULL -------------------------+ |
+-> UNIQUE ---------------------------+ |
+-> CHECK (predicate) ----------------+ |
+-> references-clause ----------------+ |
+-----------------------<----------------+
+-+----------------->-------------+->
+-> CONSTRAINT constraint-name -+
Specifies a predicate that column values inserted into the table
must satisfy.
col clause
A placeholder used in LSE templates for the ALTER TABLE, CREATE TABLE, and DECLARE TABLE syntax. The col-clause placeholder allows the optional expansions of either the col-constraint or sql-and-dtr-clause placeholders. In the following syntax diagram for col-definition, col-clause is represented by the right-most syntax loop that includes col-constraint and the sql-and-dtr-clause. include syntax here for col-definition, per page 4-98. See also the Help topic on col-definition, located at this same level.
column qualifier
A placeholder used in LSE templates as an expansion of the column-name placeholder. The templates use the term column-qualifier to describe leftmost loop in the following syntax diagram for the column-name syntax. include here the column-name syntax, per page 3-13 If you expand column-qualifier in the templates, you will see the optional items of table-name, view-name, and alias.
column name
column-name =
---+----------->-----------+-> name-of-column --->
+-> table-name -+-> . --+
+-> view-name --+
+-> alias ------+
You can name columns in CREATE TABLE and ALTER TABLE statements.
In other SQL statements, the names you give to columns can be
qualified by table name, view names, or aliases.
The only time you must qualify column names is when they are
ambiguous. Joining a table with itself and joining two tables
with common column names are two cases that require qualified
column names.
You always have the option of qualifying column names. In
complex statements, such qualifiers often make the statements
more readable.
col definition
col-definition =
--> column-name -+-> data-type ---+---+-----------------+-+
+-> domain-name -+ +->default-value -+ |
+-------------------------<-----------------------------+
+-+------------------+-+-----------------------+->
+> col-constraint -+ +-> sql-and-dtr-clause -+
+-----------<-----------+
The definition for a column in the table. SQL gives you two
ways to specify column definitions:
o By directly specifying a datatype to associate with a column
name
o By naming a domain that indirectly specifies a data type to
associate with a column name
Either way also allows options of specifying column constraints
and formatting clauses.
FILENAME
FILENAME is a keyword used in SQL syntax that is always followed by a required file specification. See the online help for file_spec, located at this same level, for more information.
file spec
Specifies a valid VMS file specification. A full file specification includes: o Network node name o Device directory o Directory name or list o File name o File type o File version number For example: SPEEDY::YOURDISK:[YOURDIR]APPLICANTS.RDB;81 File specifications are used throughout SQL syntax. For example, when you first create a schema, you give the file specifications for the database system files.
integer
An integer is a whole number. It may be positive or negative, depending on its use, but cannot have a fractional part. SQL uses integers in many situations. For example, you specify an integer to refer to columns by column number.
n
Specifies an integer. For the GRANT statement, the integer specifies the earliest relative position of the entry in the ACL. For the EDIT statement, the integer tells SQL to save the previous n statements.
parameter
Parameters are a type of value expresion. Many SQL clauses that will not accept more general value expressions require parameters. A parameter is a variable declared in a host language program that is associated with an SQL statement. The meaning of parameter encompasses host variables named directly in embedded SQL statements, actual and formal parameters in programs that use SQL module language, and parameter markers in the statement string of a PREPARE statement.
path or file
Path-or-file is a placeholder used in LSE templates as an expansion of the alter-schema-clause and declare-schema-clause placeholders. You can expand the path-or-file placeholder to the syntax FILENAME file-spec and PATHNAME path-name. See the online help for FILENAME and path_name, located at this level, for more information on those topics.
path name
A data dictionary path name can be: o A full path name, such as CDD$TOP.MOLLY.SQL.PERSONNEL o A relative path name o A logical name for a full or relative path name Unless you use the PATHNAME argument in the CREATE SCHEMA statement, SQL does not use the data dictionary to store data definitions. If you specify the PATHNAME argument when you first create a schema, SQL creates a path name that contains copies of data definitions for the schema.
quoted string
A quoted character string literal is a string of printable
characters enclosed in quotation marks. The maximum length of a
character string is 65,536 characters. Use a pair of quotation
marks, either single or doulbe, to enclose a character string
literal. The printable characters consist of:
o Uppercase alphabetic characters:
A - Z
o Lowercast alphabetic characters:
a - z
o Numerals:
0 - 9
o Special characters:
!@#$%^&*()-_=+`~
[]{};:'"|/?><.,
schema id
Schema-id is a placeholder used in LSE templates. Schema-id expands to the placeholders FILENAME file-spec, AUTHORIZATION auth-id, and PATHNAME path-name. See the online help for FILENAME and path_name, located at this level, for more information. See the top-level help on authorization_id for more information on that topic.