DROP SEQUENCE stock_increment_num; create SEQUENCE stock_increment_num --创建序列名称 increment by 1 --增长幅度 start with 1 --初始值 maxvalue 1000; --最大值 delete from "FA_SYS_TABLE_COLUMNS" where TABLE_NAME='FA_STOCK_STORE'; insert into "FA_SYS_TABLE_COLUMNS"("ID","TABLE_ID","TABLE_NAME","NAME", "DBDATATYPE_CODE","DBDATATYPE_NAME","IS_DISPLAY","IS_CHECKED","FIXED","DISPLAY_ORDER","COMMENTS","STATUS","ORG_ID") select rawtohex(sys_guid()),t.id,t.name,t.COLUMN_NAME, case when t.DATA_TYPE in ('NVARCHAR2') then 'NVARCHAR2' when t.DATA_TYPE='NCHAR' then 'NCHAR' when t.DATA_TYPE='NUMBER' then 'NUMBER' when t.DATA_TYPE='DATE' then 'DATE' else 'NUMBER' end typeCode, t.DATA_TYPE typeName,'1','0','0',stock_increment_num.nextval,null,'1','0' from (SELECT a.*,f.* from all_tab_columns a,FA_SYS_TABLES f WHERE a.TABLE_NAME='FA_STOCK_STORE' and f.NAME='FA_STOCK_STORE' and a.owner = 'CWY_CLOUD' ) t; delete from "FA_SYS_TABLE_COLUMNS" where TABLE_NAME='FA_STOCK_RACK'; insert into "FA_SYS_TABLE_COLUMNS"("ID","TABLE_ID","TABLE_NAME","NAME", "DBDATATYPE_CODE","DBDATATYPE_NAME","IS_DISPLAY","IS_CHECKED","FIXED","DISPLAY_ORDER","COMMENTS","STATUS","ORG_ID") select rawtohex(sys_guid()),t.id,t.name,t.COLUMN_NAME, case when t.DATA_TYPE in ('NVARCHAR2') then 'NVARCHAR2' when t.DATA_TYPE='NCHAR' then 'NCHAR' when t.DATA_TYPE='NUMBER' then 'NUMBER' when t.DATA_TYPE='DATE' then 'DATE' else 'NUMBER' end typeCode, t.DATA_TYPE typeName,'1','0','0',stock_increment_num.nextval,null,'1','0' from (SELECT a.*,f.* from all_tab_columns a,FA_SYS_TABLES f WHERE a.TABLE_NAME='FA_STOCK_RACK' and f.NAME='FA_STOCK_RACK' and a.owner = 'CWY_CLOUD' ) t;
Oracle查询字段名插入另一种表
最新推荐文章于 2022-04-27 15:00:00 发布