create database argument: Create a database (SQL administration API)

Use the create database argument with the admin() or task() function to create a database.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-EXECUTE FUNCTION--+-admin-+--(--"create database------------->
                     '-task--'                        

>--+-------------------------+--+-------------------------+----->
   '-with--+-log-----------+-'  '-+-nlscase insensitive-+-'   
           +-buffered log--+      '-nlscase sensitive---'     
           '-log mode ansi-'                                  

>--"--,--"database_name"--+-------------------------------+----->
                          '-,--"dbspace"--+-------------+-'   
                                          '-,--"locale"-'     

>--)--;--------------------------------------------------------><

Element Description Key Considerations
database_name The name of the database.  
dbspace The name of the dbspace to store the data for this database. The default is the root dbspace. The dbspace must already exist on the database server.
locale The locale associated with the database. The values for locale are the same as the values for the DB_LOCALE environment variable.

If you omit this property, the locale is set by the value of the DB_LOCALE environment variable. The default locale is US English.

Usage

This function is equivalent to the CREATE DATABASE statement.

You cannot use this function to create a tenant database. You create a tenant database with the tenant create argument.

Examples

The following example creates the database named demodbs with unbuffered logging:
EXECUTE FUNCTION task("create database with log","demodbs");
     
The following example creates a database that is not case-sensitive named demodbs2 with ANSI compliant logging in the dbspace named dataspace1:
EXECUTE FUNCTION task("create database with log mode ansi nlscase insensitive",
"demodbs2","dataspace1");
			
The following example creates a database named demodbs3 with a French-Canadian locale in the dbspace name dataspace1:
EXECUTE FUNCTION task("create database","demodbs3","dataspace1","fr_ca.8859-1");
			

Copyright© 2019 HCL Technologies Limited