Share this page 

Create a table from PowerScriptTag(s): Database


Use EXECUTE IMMEDIATE. Set Autocommit to true because DDL SQL has to be executed outside of transaction.
SQLCA.AutoCommit = True
ls_sql = "create table #tmp (abc varchar(255))"

EXECUTE IMMEDIATE :LS_SQL USING SQLCA;
To alter a table, use the same idea:
ls_sql = 'ALTER TABLE dba.tbl_name ADD col_name'
EXECUTE IMMEDIATE :LS_SQL USING SQLCA;