Community Manager
Community Manager

Background

Most Database Browsers include the ability to generate DDL for a database object (or multiple). For example, the instructions to do this in DBVisualizer are found here and for DBeaver here. The below script will also create DDL for a single table when one of those other options are not available. 

Explanation

The attached file provides a Lua script to do the same.

Example call:

execute script my_create_table_ddl('SOURCE_SCHEMA', 'SOURCE_TABLE', 'TARGET_SCHEMA', 'TARGET_TABLE', true) ;

If the last parameter is 'true', the script will add the "OR REPLACE" option