我必须动态地为单独的表(在我的情况下为Studenti)中的每个条目创建一个新表。我刚刚开始学习Dynamic Sql。我使用了休闲程序:
CREATE or REPLACE PROCEDURE carnet_student IS
CREATE_TABLE_QUERY VARCHAR2(250);
CURSOR table_name is SELECT NR_MATRICOL FROM STUDENTI;
nume CHAR(4);
BEGIN
OPEN table_name;
LOOP
FETCH table_name INTO nume;
EXIT when table_name%NOTFOUND;
CREATE_TABLE_QUERY:='Create TABLE '||nume||'(
column1 varchar2(50),
column2 varchar2(50),
column3 number(2),
column4 DATE
)';
EXECUTE IMMEDIATE CREATE_TABLE_QUERY;
END LOOP;
CLOSE table_name;
END;
/
BEGIN
carnet_student;
END;
我收到错误ORA-00903:表名无效。任何想法如何解决这个问题?