最近整理了gbase8s数据库中常见的元数据的查询,包括表、视图、序列、包、类型、触发器、plsql等等,仅供参考。

set environment sqlmode 'oracle';
drop package DBMS_METADATA;
create or replace package DBMS_METADATA is function GET_DDL(objtype varchar2,objname varchar2,users varchar2) return varchar2;function GET_INDEX_DDL(objname varchar2,users varchar2) return varchar2;function GET_TABLE_DDL(objname varchar2,users varchar2) return varchar2;function GET_TABLE_DDL_2_GBASE(objname varchar2,users varchar2) return varchar2;function GET_TABLE_DDL_2_ORACLE(objname varchar2,users varchar2) return varchar2;function GET_VIEW_DDL(objname varchar2,users varchar2) return varchar2;function GET_PROCEDURE_DDL(objname varchar2,users varchar2) return varchar2;function GET_FUNCTION_DDL(objname varchar2,users varchar2) return varchar2;function GET_PACKAGE_DDL(objname varchar2,users varchar2) return varchar2;function GET_PACKAGE_BODY_DDL(objname varchar2,users varchar2) return varchar2;function GET_TRIGGER_DDL(objname varchar2,users varchar2) return varchar2;function GET_TYPE_DDL(objname varchar2,users varchar2) return varchar2;function GET_TYPE_BODY_DDL(objname varchar2,users varchar2) return varchar2;function GET_SEQUENCE_DDL(objname varchar2,users varchar2) return varchar2;function GET_SYNONYM_DDL(objname varchar2,users varchar2) return varchar2;end ;
/CREATE OR REPLACE PACKAGE BODY DBMS_METADATA ISfunction GET_DDL(objtype varchar2,objname varchar2,users varchar2) return varchar2 is 
ret varchar2;
begin if objtype='TABLE' or objtype='table' then 
ret := GET_TABLE_DDL(objname ,users);
elsif objtype='INDEX' or objtype='index' then 
ret:=GET_INDEX_DDL(objname ,users );
elsif objtype='VIEW' or objtype='view' then 
ret := GET_VIEW_DDL(objname ,users);
elsif objtype='PROCEDURE' or objtype='procedure' then 
ret := GET_PROCEDURE_DDL(objname ,users);
elsif objtype='FUNCTION' or objtype='function' then 
ret := GET_FUNCTION_DDL(objname ,users);
elsif objtype='PACKAGE' or objtype='package' then 
ret := GET_PACKAGE_DDL(objname ,users);
elsif objtype='PACKAGE_BODY' or objtype='package_body' then 
ret := GET_PACKAGE_BODY_DDL(objname ,users);
elsif objtype='TRIGGER' or objtype='trigger' then 
ret := GET_TRIGGER_DDL(objname ,users);
elsif objtype='TYPE' or objtype='type' then 
ret := GET_TYPE_DDL(objname ,users);
elsif objtype='TYPE_BODY' or objtype='type_body' then 
ret := GET_TYPE_BODY_DDL(objname ,users);
elsif objtype='SEQUENCE' or objtype='sequence' then 
ret := GET_SEQUENCE_DDL(objname ,users);
elsif objtype='SYNONYM' or objtype='synonym' then 
ret := GET_SYNONYM_DDL(objname ,users);
else 
RAISE_APPLICATION_ERROR(-746, 'object type is not support in gbase database!');
end if;
return ret;
end GET_DDL;function GET_INDEX_DDL(objname varchar2,users varchar2) return varchar2 is 
cnt int;
ret varchar2;
begin 
select count(1) into cnt from sysindexes where idxname=objname and owner=users;if cnt=0 then 
return null;
end if;select  'create '||(case when idxtype ='D'  then null when idxtype ='U' then 'unique ' else null end)||'index '||idxname||' on '||tabname
||'('||colname||') using btree ;' as idxddl into ret
from (
select idxname,owner,tabname,idxtype, wm_concat(colname) as colname from (
select s1.idxname,s1.owner,s3.tabname,s2.colname,s1.idxtype,
CASE WHEN s1.part1 = s2.colno THEN 1WHEN s1.part2 = s2.colno THEN 2WHEN s1.part3 = s2.colno THEN 3WHEN s1.part4 = s2.colno THEN 4WHEN s1.part5 = s2.colno THEN 5WHEN s1.part6 = s2.colno THEN 6WHEN s1.part7 = s2.colno THEN 7WHEN s1.part8 = s2.colno THEN 8WHEN s1.part9 = s2.colno THEN 9WHEN s1.part10 = s2.colno THEN 10WHEN s1.part11 = s2.colno THEN 11WHEN s1.part12 = s2.colno THEN 12WHEN s1.part13 = s2.colno THEN 13WHEN s1.part14 = s2.colno THEN 14WHEN s1.part15 = s2.colno THEN 15WHEN s1.part16 = s2.colno THEN 16ELSE 99
END AS sx
from sysindexes s1 
left join syscolumns s2
on s1.tabid=s2.tabid
join systables s3 on s1.tabid=s3.tabid 
and (s1.part1 = s2.colno OR s1.part2 = s2.colno OR s1.part3 = s2.colno)
where s1.idxname=objname and s1.owner=users
order by sx
) 
group by idxname,owner,tabname,idxtype
);return ret;
end GET_INDEX_DDL;function GET_TABLE_DDL(objname varchar2,users varchar2) return varchar2 is
tabflag int;
tid int;
ret varchar2;begin 
select tabid,flags into tid,tabflag from systables where tabname=objname and tabtype='T' and owner=users;
if tid >0 and tabflag = 16384 then
ret := GET_TABLE_DDL_2_ORACLE(objname,users);
elsif tid >0 and tabflag = 0 then
ret := GET_TABLE_DDL_2_GBASE(objname,users);
else 
return null;
end if;
return ret;
end GET_TABLE_DDL;function GET_TABLE_DDL_2_GBASE(objname varchar2,users varchar2) return varchar2 is
sql_stmt varchar2;
tableid int;
flag int;
begin select flags,tabid into flag,tableid from systables where tabname=objname and tabtype='T' and tabid >999;
if flag=0 then 
sql_stmt :='CREATE TABLE '||objname||' ('||CHR(10);
elsif flag=16 then 
sql_stmt :='CREATE RAW TABLE '||objname||' ('||CHR(10);
else 
return null;
end if;for name in (
select colname||' '||typename||' '||defaultvalue||' '||vmvalue as vddl from (
select  colname ,
case  
when c.extended_id =0 and c.coltype=0 and colattr <> 256 then  'CHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=1 and colattr <> 256 then  'SMALLINT'
when c.extended_id =0 and c.coltype=2 and colattr <> 256 then  'INTEGER'
when c.extended_id =0 and c.coltype=3 and colattr <> 256 then  'FLOAT'
when c.extended_id =0 and c.coltype=4 and colattr <> 256 then  'SMALLFLOAT'
when c.extended_id =0 and c.coltype=5 and colattr <> 256 then  'DECIMAL'
when c.extended_id =0 and c.coltype=6 and colattr <> 256 then  'SERIAL'
when c.extended_id =0 and c.coltype=7 and colattr <> 256 then  'DATE'
when c.extended_id =0 and c.coltype=8 and colattr <> 256 then  'MONEY'
when c.extended_id =0 and c.coltype=9 and colattr <> 256 then  'NULL'
when c.extended_id =0 and c.coltype=10 and colattr <> 256 then  
'DATETIME '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)when c.extended_id =0 and c.coltype=11 and colattr <> 256 then  'BYTE'
when c.extended_id =0 and c.coltype=12 and colattr <> 256 then  'TEXT'
when c.extended_id =0 and c.coltype=13 and colattr <> 256 then  'VARCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=14 and colattr <> 256 then  
'INTERVAL '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then 'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=15 and colattr <> 256 then  'NCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=16 and colattr <> 256 then  'NVARCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=17 and colattr <> 256 then  'INT8'
when c.extended_id =0 and c.coltype=18 and colattr <> 256 then  'SERIAL8'
when c.extended_id =0 and c.coltype=19 and colattr <> 256 then  'SET'
when c.extended_id =0 and c.coltype=20 and colattr <> 256 then  'MULTISET'
when c.extended_id =0 and c.coltype=21 and colattr <> 256 then  'LIST'
when c.extended_id =0 and c.coltype=52 and colattr <> 256 then  'BIGINT'
when c.extended_id =0 and c.coltype=53 and colattr <> 256 then  'BIGSERIAL'
when c.extended_id =0 and c.coltype=63 and colattr <> 256 then  'VARCHAR2('||c.collength||')'
when c.extended_id =0 and c.coltype=64 and colattr <> 256 then  'NVARCHAR2('||c.collength||')'
when c.extended_id =0 and c.coltype=256  and colattr <> 256 then  'CHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=257  and colattr <> 256 then  'SMALLINT'
when c.extended_id =0 and c.coltype=258  and colattr <> 256 then  'INTEGER'
when c.extended_id =0 and c.coltype=259  and colattr <> 256 then  'FLOAT'
when c.extended_id =0 and c.coltype=260  and colattr <> 256 then  'SMALLFLOAT'
when c.extended_id =0 and c.coltype=261  and colattr <> 256 then  'DECIMAL'
when c.extended_id =0 and c.coltype=262  and colattr <> 256 then  'SERIAL'
when c.extended_id =0 and c.coltype=263  and colattr <> 256 then  'DATE'
when c.extended_id =0 and c.coltype=264  and colattr <> 256 then  'MONEY'
when c.extended_id =0 and c.coltype=265  and colattr <> 256 then  'NULL'
when c.extended_id =0 and c.coltype=266 and colattr <> 256 then  
'DATETIME '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=267 and colattr <> 256 then  'BYTE'
when c.extended_id =0 and c.coltype=268 and colattr <> 256 then  'TEXT'
when c.extended_id =0 and c.coltype=269 and colattr <> 256 then  'VARCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=270 and colattr <> 256 then  
'INTERVAL '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then 'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=271 and colattr <> 256 then  'NCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=272 and colattr <> 256 then  'NVARCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=273 and colattr <> 256 then  'INT8'
when c.extended_id =0 and c.coltype=275 and colattr <> 256 then  'SET'
when c.extended_id =0 and c.coltype=276 and colattr <> 256 then  'MULTISET'
when c.extended_id =0 and c.coltype=277 and colattr <> 256 then  'LIST'
when c.extended_id =0 and c.coltype=308 and colattr <> 256 then  'BIGINT'
when c.extended_id =0 and c.coltype=319 and colattr <> 256 then  'VARCHAR2('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=320 and colattr <> 256 then  'NVARCHAR2('||c.collength||') NOT NULL'
when colattr = 256 then 'generated always as '
when c.extended_id <> 0 then 
(select name from sysxtdtypes sx where sx.extended_id=c.extended_id)
end typename,
case when type is null then null 
when type ='E' then 'default '||default2 
when type ='L' and c.coltype in (0,13,15,16,63,64,256,269,271,319,320) then 'default '||"'"||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)||"'"
when type ='C' then 'default sysdate '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when type ='L' and c.coltype in (14,270) then ' default interval('||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)||') '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
else 'default '||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)end as defaultvalue ,
case when colattr=256 then '('||default2 ||') virtual' end vmvalue
from (
select s1.tabid,s1.colname,s1.colno,s1.coltype,s1.extended_id,s1.collength,s1.colattr,s2.type,s2.default default1,replace(wm_concat(s3.default),',','') default2 from syscolumns s1
left join (select tabid,default,colno,type from sysdefaults ) s2 on
s1.tabid=s2.tabid and s1.colno=s2.colno 
left join (select tabid,default,colno from sysdefaultsexpr where type='T') s3 on 
s1.tabid=s3.tabid and s1.colno=s3.colno 
where s1.tabid=tableid
group by s1.tabid,s1.colname,s1.colno,s1.coltype,s1.extended_id,s1.collength,s1.colattr,s2.type,s2.default
order by s1.colno
)c
)
)
loop sql_stmt :=sql_stmt||name.vddl||','||CHR(10);
end loop;--查询check约束for checkname in(
select 'check ' ||checktext||'constraint '||constrname  as checkexpr from (
select s1.constrname ,s2.checktext from sysconstraints s1,syschecks s2 where s1.constrid=s2.constrid 
and s2.type='T' and s1.constrtype='C' and s1.tabid=tableid
)
)
loop 
sql_stmt :=sql_stmt|| checkname.checkexpr||','||CHR(10);
end loop;--查询唯一约束for unique_constrsaints in(
select constrname,constrained_columns from (select constrname,wm_concat(colname)  AS constrained_columns from (
SELECT c.constrname AS constrname,
CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99
END AS sx,
sc.colname
FROM sysconstraints cJOIN sysindexes si ON c.idxname = si.idxnameJOIN syscolumns sc ON c.tabid = sc.tabid
WHERE c.tabid = tableidAND c.constrtype = 'U'AND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colnoOR si.part6 = sc.colno OR si.part7 = sc.colnoOR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colnoOR si.part12 = sc.colno OR si.part13 = sc.colnoOR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)order by sx
)
GROUP BY constrname
ORDER BY constrname)
)loop 
--sql_stmt :=sql_stmt|| 'constraint '||unique_constrsaints.constrname || 'unique('||unique_constrsaints.constrained_columns||'),'||CHR(10) ;
sql_stmt :=sql_stmt||'unique('||unique_constrsaints.constrained_columns||')'||'constraint '||unique_constrsaints.constrname ||','||CHR(10) ;
end loop;--查询主键约束for primary_constrsaints in(
select constrname,constrained_columns from (
select constrname,wm_concat(colname)  AS constrained_columns from (
SELECT c.constrname AS constrname,
CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99
END AS sx,
sc.colname
FROM sysconstraints cJOIN sysindexes si ON c.idxname = si.idxnameJOIN syscolumns sc ON c.tabid = sc.tabid
WHERE c.tabid = tableidAND c.constrtype = 'P'AND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colnoOR si.part6 = sc.colno OR si.part7 = sc.colnoOR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colnoOR si.part12 = sc.colno OR si.part13 = sc.colnoOR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno )order by sx
)
GROUP BY constrname
ORDER BY constrname
)
)loop 
sql_stmt :=sql_stmt||' primary key('||primary_constrsaints.constrained_columns||') '||'constraint '||primary_constrsaints.constrname ||','||CHR(10) ;
end loop;--查询外键约束for foreign_constrsaints in(
SELECT c.constrname AS foreign_key_name,(SELECT wm_concat(DISTINCT colname) FROM (SELECT sc.colname,CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99END AS col_orderFROM sysindexes siJOIN syscolumns sc ON c.tabid = sc.tabidWHERE si.idxname = c.idxnameAND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colno OR si.part6 = sc.colnoOR si.part7 = sc.colno OR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colno OR si.part12 = sc.colnoOR si.part13 = sc.colno OR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)ORDER BY col_order) ordered_cols) AS child_columns,pc.constrname AS parent_constraint_name,(SELECT wm_concat(DISTINCT colname)FROM (SELECT sc.colname,CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99END AS col_orderFROM sysindexes siJOIN syscolumns sc ON pc.tabid = sc.tabidWHERE si.idxname = pc.idxnameAND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colno OR si.part6 = sc.colnoOR si.part7 = sc.colno OR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colno OR si.part12 = sc.colnoOR si.part13 = sc.colno OR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)ORDER BY col_order) ordered_cols) AS parent_columns,pt.tabname AS parent_table
FROM sysconstraints cJOIN sysreferences sr ON c.constrid = sr.constridJOIN sysconstraints pc ON pc.constrid = sr.primaryJOIN systables pt ON pc.tabid = pt.tabid
WHERE c.tabid = tableidAND c.constrtype = 'R'
ORDER BY c.constrname
)loop 
sql_stmt :=sql_stmt||' foreign key('||foreign_constrsaints.child_columns||') references '||foreign_constrsaints.parent_table||'('||foreign_constrsaints.parent_columns||')'||'constraint '||foreign_constrsaints.foreign_key_name || ','||CHR(10) ;
end loop;sql_stmt := sql_stmt||');';
--去除最后的逗号
sql_stmt := REGEXP_REPLACE(sql_stmt, ',\s*\)\s*;\s*$', ');');
--sql_stmt := REGEXP_REPLACE(sql_stmt, '\),\s*\);$', '));');--dbms_output.put_line(sql_stmt);
return sql_stmt;
end GET_TABLE_DDL_2_GBASE;function GET_TABLE_DDL_2_ORACLE(objname varchar2,users varchar2) return varchar2 is
sql_stmt varchar2;
tableid int;
flag int;
begin 
select flags,tabid into flag,tableid from systables where tabname=objname and tabtype='T' and tabid >999;
if flag=16384 then 
sql_stmt :='CREATE TABLE '||objname||' ('||CHR(10);
elsif flag=16400 then 
sql_stmt :='CREATE RAW TABLE '||objname||' ('||CHR(10);
end if;for name in (
select colname||' '||typename||' '||defaultvalue||' '||vmvalue as vddl from (
select  colname ,
case  
when c.extended_id =0 and c.coltype=0 and colattr <> 256 then  'CHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=1 and colattr <> 256 then  'SMALLINT'
when c.extended_id =0 and c.coltype=2 and colattr <> 256 then  'INTEGER'
when c.extended_id =0 and c.coltype=3 and colattr <> 256 then  'FLOAT'
when c.extended_id =0 and c.coltype=4 and colattr <> 256 then  'SMALLFLOAT'
when c.extended_id =0 and c.coltype=5 and colattr <> 256 then  'DECIMAL'
when c.extended_id =0 and c.coltype=6 and colattr <> 256 then  'SERIAL'
when c.extended_id =0 and c.coltype=7 and colattr <> 256 then  'DATE'
when c.extended_id =0 and c.coltype=8 and colattr <> 256 then  'MONEY'
when c.extended_id =0 and c.coltype=9 and colattr <> 256 then  'NULL'
when c.extended_id =0 and c.coltype=10 and colattr <> 256 then  
'DATETIME '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)when c.extended_id =0 and c.coltype=11 and colattr <> 256 then  'BYTE'
when c.extended_id =0 and c.coltype=12 and colattr <> 256 then  'TEXT'
when c.extended_id =0 and c.coltype=13 and colattr <> 256 then  'VARCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=14 and colattr <> 256 then  
'INTERVAL '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then 'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=15 and colattr <> 256 then  'NCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=16 and colattr <> 256 then  'NVARCHAR('||c.collength||')'
when c.extended_id =0 and c.coltype=17 and colattr <> 256 then  'INT8'
when c.extended_id =0 and c.coltype=18 and colattr <> 256 then  'SERIAL8'
when c.extended_id =0 and c.coltype=19 and colattr <> 256 then  'SET'
when c.extended_id =0 and c.coltype=20 and colattr <> 256 then  'MULTISET'
when c.extended_id =0 and c.coltype=21 and colattr <> 256 then  'LIST'
when c.extended_id =0 and c.coltype=52 and colattr <> 256 then  'BIGINT'
when c.extended_id =0 and c.coltype=53 and colattr <> 256 then  'BIGSERIAL'
when c.extended_id =0 and c.coltype=63 and colattr <> 256 then  'VARCHAR2('||c.collength||')'
when c.extended_id =0 and c.coltype=64 and colattr <> 256 then  'NVARCHAR2('||c.collength||')'
when c.extended_id =0 and c.coltype=256  and colattr <> 256 then  'CHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=257  and colattr <> 256 then  'SMALLINT'
when c.extended_id =0 and c.coltype=258  and colattr <> 256 then  'INTEGER'
when c.extended_id =0 and c.coltype=259  and colattr <> 256 then  'FLOAT'
when c.extended_id =0 and c.coltype=260  and colattr <> 256 then  'SMALLFLOAT'
when c.extended_id =0 and c.coltype=261  and colattr <> 256 then  'DECIMAL'
when c.extended_id =0 and c.coltype=262  and colattr <> 256 then  'SERIAL'
when c.extended_id =0 and c.coltype=263  and colattr <> 256 then  'DATE'
when c.extended_id =0 and c.coltype=264  and colattr <> 256 then  'MONEY'
when c.extended_id =0 and c.coltype=265  and colattr <> 256 then  'NULL'
when c.extended_id =0 and c.coltype=266 and colattr <> 256 then  
'DATETIME '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=267 and colattr <> 256 then  'BYTE'
when c.extended_id =0 and c.coltype=268 and colattr <> 256 then  'TEXT'
when c.extended_id =0 and c.coltype=269 and colattr <> 256 then  'VARCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=270 and colattr <> 256 then  
'INTERVAL '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then 'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when c.extended_id =0 and c.coltype=271 and colattr <> 256 then  'NCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=272 and colattr <> 256 then  'NVARCHAR('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=273 and colattr <> 256 then  'INT8'
when c.extended_id =0 and c.coltype=275 and colattr <> 256 then  'SET'
when c.extended_id =0 and c.coltype=276 and colattr <> 256 then  'MULTISET'
when c.extended_id =0 and c.coltype=277 and colattr <> 256 then  'LIST'
when c.extended_id =0 and c.coltype=308 and colattr <> 256 then  'BIGINT'
when c.extended_id =0 and c.coltype=319 and colattr <> 256 then  'VARCHAR2('||c.collength||') NOT NULL'
when c.extended_id =0 and c.coltype=320 and colattr <> 256 then  'NVARCHAR2('||c.collength||') NOT NULL'
when colattr = 256 then 'generated always as '
when c.extended_id <> 0 then 
(select name from sysxtdtypes sx where sx.extended_id=c.extended_id)
end typename,
case when type is null then null 
when type ='E' then 'default '||default2 
when type ='L' and c.coltype in (0,13,15,16,63,64,256,269,271,319,320) then 'default '||"'"||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)||"'"
when type ='C' then 'default sysdate '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
when type ='L' and c.coltype in (14,270) then ' default interval('||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)||') '||(select trim(case 
when bitand(c.collength, 240) / 16 =0 then 'YEAR' 
when bitand(c.collength, 240) / 16 =2 then 'MONTH'
when bitand(c.collength, 240) / 16 =4 then 'DAY'
when bitand(c.collength, 240) / 16 =6 then 'HOUR'
when bitand(c.collength, 240) / 16 =8 then 'MINUTE'
when bitand(c.collength, 240) / 16 =10 then 'SECOND'
when bitand(c.collength, 240) / 16 =11 then 'FRACTION(1)'
when bitand(c.collength, 240) / 16 =12 then 'FRACTION(2)'
when bitand(c.collength, 240) / 16 =13 then 'FRACTION(3)'
when bitand(c.collength, 240) / 16 =14 then 'FRACTION(4)'
when bitand(c.collength, 240) / 16 =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)||' TO '||(
select trim(case 
when bitand(collength, 15) =0 then 'YEAR' 
when bitand(collength, 15) =2 then 'MONTH'
when bitand(collength, 15) =4 then 'DAY'
when bitand(collength, 15) =6 then 'HOUR'
when bitand(collength, 15) =8 then 'MINUTE'
when bitand(collength, 15) =10 then 'SECOND'
when bitand(collength, 15) =11 then 'FRACTION(1)'
when bitand(collength, 15) =12 then 'FRACTION(2)'
when bitand(collength, 15) =13 then 'FRACTION(3)'
when bitand(collength, 15) =14 then  'FRACTION(4)'
when bitand(collength, 15) =15 then 'FRACTION(5)'
end )
from dual
)::varchar(11)
else 'default '||read_defaultstr (c.tabid,c.colno,c.coltype,c.collength,c.extended_id)::varchar(255)end as defaultvalue ,
case when colattr=256 then '('||default2 ||') virtual' end vmvalue
from (
select s1.tabid,s1.colname,s1.colno,s1.coltype,s1.extended_id,s1.collength,s1.colattr,s2.type,s2.default default1,replace(wm_concat(s3.default),',','') default2 from syscolumns s1
left join (select tabid,default,colno,type from sysdefaults ) s2 on
s1.tabid=s2.tabid and s1.colno=s2.colno 
left join (select tabid,default,colno from sysdefaultsexpr where type='T') s3 on 
s1.tabid=s3.tabid and s1.colno=s3.colno 
where s1.tabid=tableid
group by s1.tabid,s1.colname,s1.colno,s1.coltype,s1.extended_id,s1.collength,s1.colattr,s2.type,s2.default
order by s1.colno
)c
)
)
loop 
sql_stmt :=sql_stmt||name.vddl||','||CHR(10);
end loop;--查询check约束for checkname in(
select 'constraint '||constrname ||'check ' ||checktext as checkexpr from (
select s1.constrname ,s2.checktext from sysconstraints s1,syschecks s2 where s1.constrid=s2.constrid 
and s2.type='T' and s1.constrtype='C' and s1.tabid=tableid
)
)
loop 
sql_stmt :=sql_stmt|| checkname.checkexpr||','||CHR(10);
end loop;--查询唯一约束for unique_constrsaints in(
select constrname,constrained_columns from (select constrname,wm_concat(colname)  AS constrained_columns from (
SELECT c.constrname AS constrname,
CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99
END AS sx,
sc.colname
FROM sysconstraints cJOIN sysindexes si ON c.idxname = si.idxnameJOIN syscolumns sc ON c.tabid = sc.tabid
WHERE c.tabid = tableidAND c.constrtype = 'U'AND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colnoOR si.part6 = sc.colno OR si.part7 = sc.colnoOR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colnoOR si.part12 = sc.colno OR si.part13 = sc.colnoOR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)order by sx
)
GROUP BY constrname
ORDER BY constrname)
)loop 
sql_stmt :=sql_stmt|| 'constraint '||unique_constrsaints.constrname || 'unique('||unique_constrsaints.constrained_columns||'),'||CHR(10) ;
end loop;--查询主键约束for primary_constrsaints in(
select constrname,constrained_columns from (
select constrname,wm_concat(colname)  AS constrained_columns from (
SELECT c.constrname AS constrname,CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99END AS sx,
sc.colname
FROM sysconstraints cJOIN sysindexes si ON c.idxname = si.idxnameJOIN syscolumns sc ON c.tabid = sc.tabid
WHERE c.tabid = tableidAND c.constrtype = 'P'AND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colnoOR si.part6 = sc.colno OR si.part7 = sc.colnoOR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colnoOR si.part12 = sc.colno OR si.part13 = sc.colnoOR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)order by sx
)
GROUP BY constrname
ORDER BY constrname
)
)loop 
sql_stmt :=sql_stmt|| 'constraint '||primary_constrsaints.constrname || ' primary key('||primary_constrsaints.constrained_columns||'),'||CHR(10) ;
end loop;--查询外键约束for foreign_constrsaints in(
SELECT c.constrname AS foreign_key_name,(SELECT wm_concat(DISTINCT colname) FROM (SELECT sc.colname,CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99END AS col_orderFROM sysindexes siJOIN syscolumns sc ON c.tabid = sc.tabidWHERE si.idxname = c.idxnameAND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colno OR si.part6 = sc.colnoOR si.part7 = sc.colno OR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colno OR si.part12 = sc.colnoOR si.part13 = sc.colno OR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)ORDER BY col_order) ordered_cols) AS child_columns,pc.constrname AS parent_constraint_name,(SELECT wm_concat(DISTINCT colname)FROM (SELECT sc.colname,CASE WHEN si.part1 = sc.colno THEN 1WHEN si.part2 = sc.colno THEN 2WHEN si.part3 = sc.colno THEN 3WHEN si.part4 = sc.colno THEN 4WHEN si.part5 = sc.colno THEN 5WHEN si.part6 = sc.colno THEN 6WHEN si.part7 = sc.colno THEN 7WHEN si.part8 = sc.colno THEN 8WHEN si.part9 = sc.colno THEN 9WHEN si.part10 = sc.colno THEN 10WHEN si.part11 = sc.colno THEN 11WHEN si.part12 = sc.colno THEN 12WHEN si.part13 = sc.colno THEN 13WHEN si.part14 = sc.colno THEN 14WHEN si.part15 = sc.colno THEN 15WHEN si.part16 = sc.colno THEN 16ELSE 99END AS col_orderFROM sysindexes siJOIN syscolumns sc ON pc.tabid = sc.tabidWHERE si.idxname = pc.idxnameAND (si.part1 = sc.colno OR si.part2 = sc.colno OR si.part3 = sc.colnoOR si.part4 = sc.colno OR si.part5 = sc.colno OR si.part6 = sc.colnoOR si.part7 = sc.colno OR si.part8 = sc.colno OR si.part9 = sc.colnoOR si.part10 = sc.colno OR si.part11 = sc.colno OR si.part12 = sc.colnoOR si.part13 = sc.colno OR si.part14 = sc.colno OR si.part15 = sc.colnoOR si.part16 = sc.colno)ORDER BY col_order) ordered_cols) AS parent_columns,pt.tabname AS parent_table
FROM sysconstraints cJOIN sysreferences sr ON c.constrid = sr.constridJOIN sysconstraints pc ON pc.constrid = sr.primaryJOIN systables pt ON pc.tabid = pt.tabid
WHERE c.tabid = tableidAND c.constrtype = 'R'
ORDER BY c.constrname
)loop 
sql_stmt :=sql_stmt|| 'constraint '||foreign_constrsaints.foreign_key_name || ' foreign key('||foreign_constrsaints.child_columns||') references '||foreign_constrsaints.parent_table||'('||foreign_constrsaints.parent_columns||'),'||CHR(10) ;
end loop;sql_stmt := sql_stmt||');';--去除最后的逗号
sql_stmt := REGEXP_REPLACE(sql_stmt, ',\s*\)\s*;\s*$', ');');--dbms_output.put_line(sql_stmt);
--sql_stmt := REGEXP_REPLACE(sql_stmt, '\),\s*\);$', '));');--dbms_output.put_line(sql_stmt);
return sql_stmt;end GET_TABLE_DDL_2_ORACLE;function GET_VIEW_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
ret varchar2;
begin 
select tabid,flags into tid,flag  from systables where tabname=objname and tabtype='V' and owner=users;if tid <=0 THEN
return null;
end if;if flag=16384 then 
sql_stmt :='set environment sqlmode "oracle";';
elsif flag=0 then 
sql_stmt :='set environment sqlmode "gbase";';
else 
return null;
end if;select replace(viewtext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(viewtextall),'@pinjiefengefu,','') viewtext from (
select seqno,viewtext||'@pinjiefengefu' as viewtextall from sysviews where tabid=tid order by seqno asc
));ret :=sql_stmt|| CHR(10) ||viewtext;
dbms_output.put_line(ret);
return ret;
end GET_VIEW_DDL;function GET_PROCEDURE_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin select count(1) into cnt from sysprocedures where procname=objname and owner=users;if cnt =0 then 
return null;
end if;for procddl in(
select procid,procflags from sysprocedures where procname=objname and mode='O'  and isproc='t' and type=0 and owner=users
)
loop 
if procddl.procflags=4 then 
sql_stmt :='set environment sqlmode "oracle";';
elsif  procddl.procflags=0 then 
sql_stmt :='set environment sqlmode "gbase";';
end if;select replace(viewtext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(proctext),'@pinjiefengefu,','') viewtext from (
select seqno,data::varchar(256) proctext from sysprocbody where procid=procddl.procid and datakey='T' order by seqno asc
));sql_stmt :=sql_stmt|| CHR(10) ||viewtext;
end loop;dbms_output.put_line(sql_stmt);
return sql_stmt;end GET_PROCEDURE_DDL;function GET_FUNCTION_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin select count(1) into cnt from sysprocedures where procname=objname and owner=users;if cnt =0 then 
return null;
end if;for procddl in(
select procid,procflags from sysprocedures where procname=objname and mode='O'  and isproc='f' and type=0 and owner=users
)
loop 
if procddl.procflags=4 then 
sql_stmt :='set environment sqlmode "oracle";';
elsif  procddl.procflags=0 then 
sql_stmt :='set environment sqlmode "gbase";';
end if;select replace(viewtext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(proctext),'@pinjiefengefu,','') viewtext from (
select seqno,data::varchar(256) proctext from sysprocbody where procid=procddl.procid and datakey='T' order by seqno asc
));sql_stmt :=sql_stmt|| CHR(10) ||viewtext;
end loop;--dbms_output.put_line(sql_stmt);
return sql_stmt;
end GET_FUNCTION_DDL;function GET_PACKAGE_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin 
select procid into tid from sysprocedures where mode='O' and isproc='p'  and type = 1 and procname=objname and owner=users;
if tid <=0 or cnt is null then 
return null;
end if;sql_stmt :='set environment sqllmode "oracle";';select replace(viewtext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(proctext),'@pinjiefengefu,','') viewtext from (
select seqno,data::varchar(256) proctext from sysprocbody where procid=tid and datakey='T' order by seqno asc
));sql_stmt :=sql_stmt|| CHR(10) ||viewtext;
return sql_stmt;
end GET_PACKAGE_DDL;function GET_PACKAGE_BODY_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin 
select procid into tid from sysprocedures where mode='O' and isproc='p'  and type = 2 and procname=objname and owner=users;
if tid <=0 or cnt is null then 
return null;
end if;sql_stmt :='set environment sqllmode "oracle";';select replace(viewtext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(proctext),'@pinjiefengefu,','') viewtext from (
select seqno,data::varchar(256) proctext from sysprocbody where procid=tid and datakey='T' order by seqno asc
));sql_stmt :=sql_stmt|| CHR(10) ||viewtext;
return sql_stmt;
end GET_PACKAGE_BODY_DDL;function GET_TRIGGER_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin 
select count(1) into cnt from systriggers where trigname=objname and owner=users;
if cnt=0 then 
return null;
end if;select trigid,mode into tid,flag from systriggers where owner=users;if mode='G' then 
sql_stmt :='set environment sqllmode "gbase";';
select replace(tritext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(tritext),'@pinjiefengefu,','') tritext from (
select seqno,data::varchar(256) tritext from systrigbody where trigid=tid and datakey='D' order by seqno asc
));
sql_stmt :=sql_stmt||chr(10)||viewtext;select replace(tritext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(tritext),'@pinjiefengefu,','') tritext from (
select seqno,data::varchar(256) tritext from systrigbody where trigid=tid and datakey='A' order by seqno asc
));
sql_stmt :=sql_stmt||chr(10)||viewtext;
return sql_stmt;elsif mode='O' then 
sql_stmt :='set environment sqllmode "oracle";';
select replace(tritext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(tritext),'@pinjiefengefu,','') tritext from (
select seqno,data::varchar(256) tritext from systrigbody where trigid=tid and datakey='P' order by seqno asc
));
end if;sql_stmt :=sql_stmt||chr(10)||viewtext;
return sql_stmt;end GET_TRIGGER_DDL;function GET_TYPE_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin 
select extended_id into tid from sysxtdtypes where name=objname and owner=users;
if extended_id <=0 or extended_id is null then 
return null;
end if;sql_stmt :='set environment sqllmode "oracle";';select replace(tritext,'@pinjiefengefu','') into viewtext from (
select replace(wm_concat(tritext),'@pinjiefengefu,','') tritext from (
select seqno,source::varchar(256) tritext from source$ where objid=tid  and datakey=13 order by seqno asc
));
sql_stmt :=sql_stmt||chr(10)||viewtext;return sql_stmt;end GET_TYPE_DDL;function GET_TYPE_BODY_DDL(objname varchar2,users varchar2) return varchar2 is
begin 
return null;
end GET_TYPE_BODY_DDL;function GET_SEQUENCE_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;
begin 
select tabid into tid from systables where tabtype='Q' and owner=users;if tid <=0 or tid is null then 
return null;
end if;select 'create sequence '||'objname'|| ' increment by '||inc_val|| ' start with '||start_val
||' maxvalue '||(case when max_val is null then 9223372036854775807 else max_val end) ||' minvalue '
||min_val||(case when cycle=0 then ' nocycle' else ' cycle' end)||(case when cache <> 0 then ' cache '|| cache  else ' nocache ' end)
||' order;' as seqddl into sql_stmt from syssequences where seqid=tid;return sql_stmt;end GET_SEQUENCE_DDL;function GET_SYNONYM_DDL(objname varchar2,users varchar2) return varchar2 is
tid int;
flag int;
sql_stmt varchar2;
viewtext varchar2;
cnt int;begin 
select tabid into tid from systables where tabname=objname and tabtype='S' and owner=users;if tid <=0 or tid is null then 
return null;
end if;sql_stmt :='set environment sqllmode "gbase";';
--select servername,dbname,owner,tabname,btabid from syssyntable where tabid=tid;
--export locale database 
select 'create public synonym for '||'"'||owner||'".'||tname into viewtext from (
select s1.owner,s1.tabname sname,s2.tabname tname,s2.owner owner from syssyntable s1,systables s2 
where s1.btabid=s2.tabid and s1.btabid is not null and s1.tabid=tid
);sql_stmt :=sql_stmt||chr(10)||viewtext;
--export other database or server
select 'create public synonym for '||dbname||'@'||servername||':"'||owner||'".'||tname into viewtext from (
select s1.servername,s1.dbname,s1.owner,s1.tabname from syssyntable s1
where s1.tabid=tid and btabid is null
);
sql_stmt :=sql_stmt||chr(10)||viewtext;
return sql_stmt;
end GET_SYNONYM_DDL;end;
/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/95079.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/95079.shtml
英文地址,请注明出处:http://en.pswp.cn/diannao/95079.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

常用hook钩子函数

爬虫Hook技术常用字段和勾子函数 目录 Hook技术概述网络请求相关Hook浏览器环境HookJavaScript引擎Hook加密算法Hook反爬虫检测Hook实际应用示例Hook工具和框架 Hook技术概述 Hook&#xff08;钩子&#xff09;技术是一种在程序运行时拦截和修改函数调用的技术。在爬虫中&a…

【解决方法】华为电脑的亮度调节失灵

华为电脑的亮度调节失灵 参考文章&#xff1a; 华为电脑屏幕亮度怎么调不了&#xff1f;华为电脑调节亮度没反应解决教程 亲测&#xff0c;在控制面板中卸载HWOSD&#xff0c;再重装有用。

【软考中级网络工程师】知识点之 DCC 深度剖析

目录一、DCC 是什么1.1 定义阐述1.2 作用讲解二、DCC 工作原理2.1 拨号触发机制2.1.1 感兴趣流量定义2.1.2 触发拨号过程2.2 链路建立流程2.2.1 物理链路连接2.2.2 数据链路层协议协商三、DCC 配置要点3.1 基础配置步骤3.1.1 接口配置3.1.2 拨号映射配置3.2 高级配置参数3.2.1 …

W5500之Socket寄存器区介绍

W5500之Socket寄存器区介绍1)、Socket n模式寄存器(Socket n Mode Register&#xff0c;简写Sn_MR)偏移地址为0x0000&#xff0c;可读写&#xff0c;复位值为0x00&#xff1b;Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0MULTI/MFENBCASTBND/MC/MMBUCASTB/MIP6BP3P2P1P0MULTI/MFEN占用“S…

酉矩阵(Unitary Matrix)和随机矩阵

先讨论酉矩阵&#xff08;Unitary Matrix&#xff09;的性质。1. 酉矩阵定义酉矩阵&#xff08;Unitary Matrix&#xff09;是复数域上的方阵&#xff0c;满足以下条件&#xff1a;其中&#xff1a;是 的共轭转置&#xff08;即 Hermitian 转置&#xff0c; &#xff09;。是单…

「iOS」————单例与代理

iOS学习单例代理代理模式的原理代理的循环引用设计模式单例 优点&#xff1a; 全局访问&#xff1a;单例模式确保一个类只有一个实例&#xff0c;并提供全局访问点&#xff0c;方便在整个应用中共享数据或功能。节省资源&#xff1a;由于只创建一个实例&#xff0c;可以减少内…

Microsoft Dynamics AX 性能优化解决方案

一、方案背景Microsoft Dynamics AX 是功能强大的企业ERP系统&#xff0c;虽然Microsoft 已推出基于云的现代化 ERP 平台 Dynamics 365 Finance and Operations&#xff0c;提供了更高的性能和持续更新&#xff0c;用来替代Dynamics AX。在考虑升级到Dynamics 365之前&#xff…

ARM保留的标准中断处理程序入口和外设中断处理程序入口介绍

在ARM架构中&#xff0c;中断处理是一个关键机制&#xff0c;它允许CPU在执行主程序时能够响应外部或内部的事件。对于ARM MCU&#xff08;微控制器单元&#xff09;而言&#xff0c;中断处理程序入口通常分为两类&#xff1a;ARM保留的标准中断处理程序入口和外设中断处理程序…

防火墙环境下的全网服务器数据自动化备份平台搭建:基于 rsync 的完整实施指南

一、项目总览 1.内容介绍 本文以 3 台 CentOS 7.9 服务器&#xff08;Web 服务器、NFS 服务器、备份服务器&#xff09;为载体&#xff0c;详解如何在全防火墙开启的前提下&#xff0c;搭建一套自动化数据备份平台&#xff1a;每日自动打包 Web 站点、NFS 共享数据及系统关键…

Spring之【Import】

目录 Import注解 源码分析 使用示例 ImportSelector 源码分析 使用示例 DeferredImportSelector 源码分析 使用示例 ImportBeanDefinitionRegistrar 源码分析 使用示例 Import注解 源码分析 处理组件类上的Import注解 将Import引入类对应的BeanDefinition对象添加…

RN项目环境搭建和使用-Mac版本(模拟器启动不起来的排查)

ReactNative&#xff1a; https://github.com/facebook/react-native https://reactnative.cn/docs/getting-started &#xff08;可以先通读一下这个&#xff09; 环境搭建 &#xff08;mac版&#xff09;https://juejin.cn/post/7404860612758765605 搭建之前确认版本&#x…

悬赏任务系统网站兼职赚钱小程序搭建地推抖音视频任务拉新源码功能详解二开

功能详解&#xff08;一&#xff09;登录与注册1、登录&#xff1a;打开系统用户端&#xff0c;输入已注册的手机号&#xff0c;若为首次登录或忘记密码&#xff0c;可通过 “找回密码” 功能&#xff0c;按提示验证身份后重置密码登录。 2、注册&#xff1a;点击 “注册” 按钮…

scikit-learn/sklearn学习|线性回归解读

【1】引言 前序学习进程中&#xff0c;对SVM相关的数学原理进行了探索和推导&#xff0c;相关文章链接包括且不限于&#xff1a; python学智能算法&#xff08;二十六&#xff09;|SVM-拉格朗日函数构造-CSDN博客 python学智能算法&#xff08;二十八&#xff09;|SVM-拉格朗…

音视频学习(五十一):AAC编码器

什么是AAC编码器&#xff1f; 高级音频编码&#xff08;Advanced Audio Coding&#xff0c;简称AAC&#xff09; 是一种有损音频压缩技术&#xff0c;旨在作为MP3的下一代标准而开发。它的主要目标是在比MP3更低的比特率下提供更好的音质&#xff0c;同时具备更强的灵活性和功能…

10-netty基础-手写rpc-定义协议头-02

netty系列文章&#xff1a; 01-netty基础-socket02-netty基础-java四种IO模型03-netty基础-多路复用select、poll、epoll04-netty基础-Reactor三种模型05-netty基础-ByteBuf数据结构06-netty基础-编码解码07-netty基础-自定义编解码器08-netty基础-自定义序列化和反序列化09-n…

计算机毕设缺乏创新点?基于大数据的快手平台用户活跃度分析系统给你思路【程序开发+项目定制】

精彩专栏推荐订阅&#xff1a;在 下方专栏&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb; &#x1f496;&#x1f525;作者主页&#xff1a;计算机毕设木哥&#x1f525; &#x1f496; 文章目录 一、项目介绍二…

01.【面试题】在SpringBoot中如何实现多数据源配置

文章目录 1. 什么是多数据源 1.1 基本概念 1.2 传统单数据源 vs 多数据源 单数据源架构 多数据源架构 2. 为什么需要多数据源 2.1 业务场景需求 2.2 技术优势 3. 多数据源的实现方式 3.1 静态多数据源 3.2 动态多数据源 4. 环境准备 4.1 创建SpringBoot项目 pom.xml依赖配置 4.…

redis主从模型与对象模型

redis淘汰策略 首先我们要明确这里说的淘汰策略是淘汰散列表中的key-value&#xff0c;而不是value中的各个数据结构 过期key中 volatile-lru 从设置了过期时间的键中&#xff0c;移除最近最少使用的键&#xff08;LRU算法&#xff09;。适合需要优先保留高频访问数据的场景…

快速搭建开源网页编辑器(vue+TinyMCE)

文章目录 Tiny MCE 安装方法 1. 安装node.js 2. 创建vue3项目 3. 安装TinyMCE依赖并使用 (1)在component文件夹创建Editor.vue文件 (2)编辑App.vue文件 (3)运行项目 (4)获取并设置API key (5)设置中文菜单 Tiny MCE 安装方法 1. 安装node.js 下载地址:https://nod…

ADK【4】内置前端调用流程

文章目录说明ADK内置前端ADK内置前端开启流程说明 本文学自赋范社区公开课&#xff0c;仅供学习和交流使用&#xff0c;不用作任何商业用途&#xff01; ADK内置前端 ADK作为最新一代Agent开发框架&#xff0c;不仅功能特性非常领先&#xff0c;而且还内置了非常多的工具&am…