plsql使用一个立即执行命令插入多行
有没有一种方法可以在一个EXECUTE IMMEDIATE
中插入多行?而不是为每个插入编写 EXECUTE IMMEDIATE
...
Is there a way to insert multiple rows in one EXECUTE IMMEDIATE
? Rather than writing EXECUTE IMMEDIATE
for each insert...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
很难说出你正在插入什么。您可以使用 EXECUTE IMMEDIATE 轻松地执行 INSERT...SELECT ,但我怀疑这不是您想要的,并且可能您不仅仅是想要围绕 EXECUTE IMMEDIATE 进行循环。
如果多表插入不是您想要的,您可以在 PL/SQL 块上和/或在 FORALL 中使用 EXECUTE IMMEDIATE
Hard to tell what you are inserting. You can use EXECUTE IMMEDIATE to do an INSERT...SELECT easily enough, but I suspect that isn't what you are after, and probably you're not simply wanting a loop around the EXECUTE IMMEDIATE.
If the multi-table insert isn't what you are looking for, you can use EXECUTE IMMEDIATE on a PL/SQL block and/or within a FORALL
玛丽亚,
为什么首先使用动态sql?
大多数时候,使用动态 SQL 并不能完全提高可伸缩性。
对于可读性也是如此。
调试比较困难....
在许多情况下,还存在奇怪的安全问题......
我不知道为什么使用动态 sql,但如果这是生产应用程序的一部分,我会重新考虑使用它。
罗纳德.
Mariya,
why use dynamic sql in the first place?
Most of the times scalability is not exactly improved using dynamic sql.
The same is for readability.
Debugging is harder ....
In many cases there are also weird security issues....
I don't know why you use dynamic sql but if this is part of a production application I would reconsider using it.
Ronald.
@玛丽亚
第一帧选择查询为您提供了您要插入的多行...
您选择stament应按照您要插入表中的数据顺序给出数据
然后使用..
插入Table1(col1,col2,col3)(从tabl2中选择姓名,地址,电话)
犯罪;
@maria
First frame select quesry which gives u multiple row wich u are going to insert...
You select stament shoud give data in order of data u want to insert in table
Then use..
Insert into Tabl1 (col1,col2,col3)(select name,address,phone from tabl2)
commit;
当然,您可以批量插入...
Sure, you can go for batch insert...