我想通过向其添加SYSDATE
来更改表名称。例如,我想将表EXAMPLE_TABLE
更改为EXAMPLE_TABLE_05_01_2015
,但我想从SYSDATE
获取日期。使用sysdate更改表名称
我准备以下,但它不工作:
ALTER TABLE "MYDB"."EXAMPLE_TABLE" rename to (SELECT 'EXAMPLE_TABLE' || TO_CHAR(SYSDATE, '_dd_MM_yyyy') FROM DUAL);
我怎样才能使它发挥作用?
以下是错误:
SQL Error: ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations
14047. 00000 - "ALTER TABLE|INDEX RENAME may not be combined with other operations"
*Cause: ALTER TABLE or ALTER INDEX statement attempted to combine
a RENAME operation with some other operation which is illegal
*Action: Ensure that RENAME operation is the sole operation specified in
ALTER TABLE or ALTER INDEX statement;
回报你什么错误? – rtome
你可以在'SQL * Plus'中使用'变量替换'。看到我的答案。 –