2.3.19 CREATE DIRECTORY

Table of Contents Previous Next


2 The SQL Language : 2.3 SQL Commands : 2.3.19 CREATE DIRECTORY

CREATE DIRECTORY -- create an alias for a file system directory path
CREATE DIRECTORY name AS 'pathname'
The CREATE DIRECTORY command creates an alias for a file system directory pathname. You must be a database superuser to use this command.
When the alias is specified as the appropriate parameter to the programs of the UTL_FILE package, the operating system files are created in, or accessed from the directory corresponding to the given alias.
The fully-qualified directory path represented by the alias name. The CREATE DIRECTORY command does not create the operating system directory. The physical directory must be created independently using the appropriate operating system commands.
The operating system user id, enterprisedb, must have the appropriate read and/or write privileges on the directory if the UTL_FILE package is to be used to create and/or read files using the directory.
The directory alias is stored in the pg_catalog.edb_dir system catalog table. Note that edb_dir is not a table compatible with Oracle databases.
The directory alias can also be viewed from the Oracle catalog views SYS.ALL_DIRECTORIES and SYS.DBA_DIRECTORIES, which are compatible with Oracle databases.
Use the DROP DIRECTORY command to delete the directory alias. When a directory alias is deleted, the corresponding physical file system directory is not affected. The file system directory must be deleted using the appropriate operating system commands.
Create an alias named empdir for directory /tmp/empdir on Linux:
Create an alias named empdir for directory C:\TEMP\EMPDIR on Windows:

2 The SQL Language : 2.3 SQL Commands : 2.3.19 CREATE DIRECTORY

Table of Contents Previous Next