【发布时间】:2018-04-10 00:13:01
【问题描述】:
背景:ALL_IND_EXPRESSIONS 有列
COLUMN_EXPRESSION LONG Function-based index expression defining the column
我知道LONG 已被弃用。我需要写类似的东西(或做其他文本操作):
SELECT
REPLACE(REPLACE(REPLACE(
q'{ALTER INDEX "<index_owner>"."<index_name>" ON ... (<column_expression>)}'
,'<index_owner>', index_owner )
,'<index_name>', index_name)
,'<column_expression>', column_expression) AS result
FROM all_ind_expressions;
ORA-00932:数据类型不一致:预期 NUMBER 长
备注:
- 它必须是独立的查询
- 没有中间对象(不能创建表/视图)。
- 没有
PL/SQL block -
DBMS_METADATA.GET_DDL(不是这样的) - WITH FUNCTION clause 作为最后的手段
是否可以从LONG 转换/转换/使用内置函数到VARCHAR2?
编辑 TL;DR:
SELECT column_expression || 'a' -- convert to working code
FROM all_ind_expressions;
【问题讨论】:
-
@CyrilleMODIANO 提到的答案可能会有所帮助。
Converting from long to varchar2 right away using a single statement is not possible, as long has certain restrictions.官方文档有链接吗?