CREATE SCHEMA statement
Use the CREATE SCHEMA statement to issue a block of data definition language (DDL) and GRANT statements as a unit.
Use this statement with DB-Access.
Syntax
(explicit id crsc002)
crsc002
(explicit id crsc003)
crsc003
(explicit id crsc004)
crsc004
(explicit id crsc006)
crsc006
(explicit id crsc007)
crsc007
(explicit id crsc008)
crsc008
(explicit id crsc009)
crsc009
(explicit id crsc011)
crsc011
(explicit id crsc012)
crsc012
(explicit id crsc013)
crsc013
(explicit id crsc014)
crsc014
(explicit id crsc015)
crsc015
CREATE SCHEMA AUTHORIZATIONuser
{
|
<CREATE TABLE Statement>[] |
<CREATE
VIEW Statement>[]
|
<GRANT Statement>[]
| { [] |
<CREATE INDEX Statement>[] |
<CREATE
SYNONYM Statement>[]
|
<CREATE TRIGGER Statement>
[]
| {
<CREATE SEQUENCE Statement>
[] |
<CREATE
ROW TYPE Statement>[]
|
<CREATE OPAQUE TYPE Statement>
[] |
<CREATE
DISTINCT TYPE Statement>[]
|
<CREATE CAST Statement>
[] }
}
}
[ ; ]
Element | Description | Restrictions | Syntax |
---|---|---|---|
user | User who owns the database objects that this statement creates | If you have DBA privileges, you can specify the name of any user. Otherwise, you must have the Resource privilege, and you must specify your own user name. | Owner name |
Usage
The CREATE SCHEMA statement allows the DBA to specify an owner for all database objects that the CREATE SCHEMA statement creates. You cannot issue CREATE SCHEMA until you have created the database that stores the objects.
Users with the Resource privilege can create a schema for themselves. In this case, user must be the name of the person with the Resource privilege who is running the CREATE SCHEMA statement. Anyone with the DBA privilege can also create a schema for someone else. In this case, user can specify a user other than the person who is running the CREATE SCHEMA statement.
You can put CREATE and
GRANT statements in any logical order, as the following example shows.
Statements are considered part of the CREATE SCHEMA statement until
a semicolon ( ; ) or an end-of-file symbol is reached.
CREATE SCHEMA AUTHORIZATION sarah
CREATE TABLE mytable (mytime DATE, mytext TEXT)
GRANT SELECT, UPDATE, DELETE ON mytable TO rick
CREATE VIEW myview AS
SELECT * FROM mytable WHERE mytime > '12/31/2004'
CREATE INDEX idxtime ON mytable (mytime);
3 See GRANT statement
4 Informix® extension