Jach/testr — Issue #50: [DDB-25] Create Table from Source Table UDP
Author: Jach
Created: 2011-12-30 00:16:09+00:00
State: open
Labels: UDR Library

[created="Sun, 14 Mar 2010 19:31:18 -0700", resolved="Fri, 9 Apr 2010 06:10:03 -0700"]

Create a UDP that will deduce, and optionally execute the DDL for a table.

call applib.CREATE_TABLE_FROM_SOURCE_TABLE ( source_table_or_view, target_schema, target_table_name, additional columns clause );

required:

source_table_or_view : the name of the source table, as a string. Source Table can also be a fully qualified source table name "server"."schema"."tableNAME" or "sCHemA"."tablE"

target_table_name : the name, case sensitive, of the target table name

optional:

target_schema - the schema to create the new table in. If null use the schema on the calling connection.

additional_columns_clause : a string with any additional column defintions to be present. 'ename VARCHAR(128) NOT NULL, dname VARCHAR(128) NOT NULL' will create the table as originally defined, and with the additional columns

test plan:

test to make sure datatypes, precision match (varchar(128) = varchar(128))

test to make sure it works with tables and views

test to make sure that it works with remote tables

test to make sure errors are thrown when:

Table already exists

additional columns clause is invalid

additional columns clause contains another column already in the table