|
|
Archives of the TeradataForum
Message Posted: Thu, 18 Aug 2016 @ 23:02:07 GMT
Subj: | | Re: Create table problem |
|
From: | | Frydryszak, Marek |
replace PROCEDURE create_from_a
(
TbName varchar(128)
)
begin
DECLARE cret varchar(4096); --or more
set cret='create table ' || TbName || '( ID integer';
FOR rbf AS
SELECT trim(variable) || ' ' || trim(datatype) vartp FROM A
WHERE tablename=TbName /* order by ?? */
DO
set cret=cret || ', ' || rbf.vartp;
END FOR;
set cret=cret || ') primary index(ID)';
CALL DBC.SysExecSQL(cret);
end;
call create_from_a('ABU');
| |