GENERATE_DDL_FOR_SERVER

Returns a create statement for a named server.

Syntax

[SYS_BOOT.MGMT.]generate_ddl_for_server(server_name);

where server_name is the name of the server. Since 6.0.1 it is not necessary to include SYS_BOOT.MGMT when calling this function.

Example

In a case when a server was created with the following code:

CREATE OR REPLACE SERVER FileReaderServer
FOREIGN DATA WRAPPER ECDA
OPTIONS (classname 'com.sqlstream.aspen.namespace.common.FileSetColumnSet',
parser 'CSV',
character_encoding 'UTF-8',
separator ',',
skip_header 'false',
directory '/tmp',
filename_pattern 'buses\.log');

Executing:

SELECT * FROM TABLE(generate_ddl_for_server('FileReaderServer'));

Returns:

'STATEMENT'
'CREATE OR REPLACE SERVER "FileReaderServer"'
'FOREIGN DATA WRAPPER ECDA'
'OPTIONS ('
'  CHARACTER_ENCODING 'UTF-8','
'  CLASSNAME 'com.sqlstream.aspen.namespace.common.FileSetColumnSet','
'  DIRECTORY '/tmp','
'  FILENAME_PATTERN 'buses\.log','
'  PARSER 'CSV','
'  SEPARATOR ',','
'  SKIP_HEADER 'false''
');'