我已经在oracle中创建了一个存储过程,用于为现有表创建备份表。在执行SP时,我遇到错误。
create or replace PROCEDURE proc_clear_table_for_automation_temp
IS
sql_stmt VARCHAR2(200);
begin
sql_stmt := 'create table transaction_method_' || SYSDATE || ' as (select * from transaction_method)';
execute immediate sql_stmt;
END;
i have created above procedure but while executing it using
exec proc_clear_table_for_automation_temp;
i am getting following error
Error starting at line : 11 in command -
BEGIN proc_clear_table_for_automation_temp; END;
Error report -
ORA-00922: missing or invalid option
ORA-06512: at "REL55.PROC_CLEAR_TABLE_FOR_AUTOMATION_TEMP", line 7
ORA-06512: at line 1
00922. 00000 - "missing or invalid option"
*Cause:
*Action:
Can someone help on this
1条答案
按热度按时间syqv5f0l1#
使用
SYSDATE
到字符串的显式转换例如:
可以避免表名中可能存在的无效空格。