我想在这里使用PLSQL动态创建表,但它不起作用,它显示了此错误
CREATE OR REPLACE PROCEDURE DYNAMIC_TABLE_CREATE(D_NAME in VARCHAR2, D_TABLE_SPECS in VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE' || D_NAME || '(' || D_TABLE_SPECS || ')' ;
结尾;

CREATE OR REPLACE PROCEDURE DYNAMIC_TABLE_CREATE(D_NAME in VARCHAR2, D_TABLE_SPECS in VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE' || D_NAME || '(' || D_TABLE_SPECS || ')' ;
END;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
动态SQL是...好吧,如果需要的话,应该使用的选项。我建议您不要动态创建表。
需要
如果 尝试运行此语句:
表
和表名称之间缺少空间。因此,请修复它,然后uncomment立即执行
:现在起作用。
Dynamic SQL is ... well, option you should use if you must. I'd suggest you not to dynamically create tables.
If you must, then it is a good habit to compose the statement first (into a local variable) and display its contents so that you could check whether it is OK:
As you can see, your code is trying to run this statement:
There's a space missing between
table
and table name. So, fix it, and then uncommentexecute immediate
:Now it works.