Background: ALL_IND_EXPRESSIONS
has column
COLUMN_EXPRESSION LONG Function-based index expression defining the column
I know that LONG
is deprecated. I need to write something like (or do other text operations):
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: inconsistent datatypes: expected NUMBER got LONG
Remarks:
- it has to be self-contained query
- no intermediate objects(creating table/view is not an option).
- no
PL/SQL block
DBMS_METADATA.GET_DDL
(it is not the case)- WITH FUNCTION clause as last resort
Is it possible to cast/convert/use built-in function from LONG
to VARCHAR2
?
EDIT TL;DR:
SELECT column_expression || 'a' -- convert to working code
FROM all_ind_expressions;