执行这条SQL语句的时候报错:ORA-01489: 字符串连接的结果过长,请怎么解决 是增加字符串链接么 5
语句:WITHDM_TBLSAS(SELECTDECODE(T.DATA_TYPE,'CHAR','''''''''||'||T.COLUMN_NAME||'||''''...
语句:
WITH DM_TBLS AS
(SELECT DECODE(T.DATA_TYPE,
'CHAR',
'''''''''||' || T.COLUMN_NAME || '||''''''''',
'VARCHAR2',
'''''''''||' || T.COLUMN_NAME || '||''''''''',
'DATE',
'''TO_DATE(''''''||to_char(' || T.COLUMN_NAME ||
',''YYYY-MM-DD HH24:MI:SS'')||'''''',''''YYYY-MM-DD HH24:MI:SS'''')''',
T.COLUMN_NAME) COLUMN_NAME,
T.COLUMN_ID,
T.TABLE_NAME,
T.OWNER,
T.COLUMN_NAME COL1,
LAG(COLUMN_ID) OVER(PARTITION BY T.TABLE_NAME ORDER BY T.COLUMN_ID) RN
FROM DBA_TAB_COLUMNS T
WHERE T.OWNER = UPPER('&V_OWNER'))
SELECT --T.TABLE_NAME,T.OWNER,
'SELECT ''INSERT INTO '||T.OWNER||'.'||T.TABLE_NAME||' (''||' ||
REPLACE(SUBSTRB(MAX(CHR(64 + LEVEL) || SYS_CONNECT_BY_PATH(T.COLUMN_NAME, '#')),
3),
'#',
'||'',''||') || '||'');'' TEXT FROM ' || T.OWNER || '.' || T.TABLE_NAME || ';' MYSQL
FROM DM_TBLS T
START WITH RN IS NULL
CONNECT BY RN = PRIOR COLUMN_ID
AND TABLE_NAME = PRIOR TABLE_NAME
GROUP BY T.OWNER,
T.TABLE_NAME; 展开
WITH DM_TBLS AS
(SELECT DECODE(T.DATA_TYPE,
'CHAR',
'''''''''||' || T.COLUMN_NAME || '||''''''''',
'VARCHAR2',
'''''''''||' || T.COLUMN_NAME || '||''''''''',
'DATE',
'''TO_DATE(''''''||to_char(' || T.COLUMN_NAME ||
',''YYYY-MM-DD HH24:MI:SS'')||'''''',''''YYYY-MM-DD HH24:MI:SS'''')''',
T.COLUMN_NAME) COLUMN_NAME,
T.COLUMN_ID,
T.TABLE_NAME,
T.OWNER,
T.COLUMN_NAME COL1,
LAG(COLUMN_ID) OVER(PARTITION BY T.TABLE_NAME ORDER BY T.COLUMN_ID) RN
FROM DBA_TAB_COLUMNS T
WHERE T.OWNER = UPPER('&V_OWNER'))
SELECT --T.TABLE_NAME,T.OWNER,
'SELECT ''INSERT INTO '||T.OWNER||'.'||T.TABLE_NAME||' (''||' ||
REPLACE(SUBSTRB(MAX(CHR(64 + LEVEL) || SYS_CONNECT_BY_PATH(T.COLUMN_NAME, '#')),
3),
'#',
'||'',''||') || '||'');'' TEXT FROM ' || T.OWNER || '.' || T.TABLE_NAME || ';' MYSQL
FROM DM_TBLS T
START WITH RN IS NULL
CONNECT BY RN = PRIOR COLUMN_ID
AND TABLE_NAME = PRIOR TABLE_NAME
GROUP BY T.OWNER,
T.TABLE_NAME; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询