[英]PL/SQL Developer: Multiple statements?
I have a script that generates a text file containing several SQL UPDATE statements: 我有一个脚本生成一个包含几个SQL UPDATE语句的文本文件:
UPDATE TableX SET Field1 = 'New value 1' WHERE Field2='1';
UPDATE TableX SET Field1 = 'New value 2' WHERE Field2='2';
UPDATE TableX SET Field1 = 'New value 3' WHERE Field2='3';
etc.
When I paste the above block of text into an SQL Window in PL/SQL Developer, it tells me that the semicolon is an invalid character. 当我将上面的文本块粘贴到PL / SQL Developer中的SQL窗口时,它告诉我分号是无效字符。 When I remove it, it informs me that my first statement was not terminated properly.
当我删除它时,它告诉我我的第一个声明没有正确终止。
How do I run these statements in a single execution? 如何在一次执行中运行这些语句?
I think you're using the Test window. 我想你正在使用Test窗口。 This can only execute a single statement.
这只能执行一个语句。 The SQL Window and the Command Window are able to run multiple statements.
SQL窗口和命令窗口能够运行多个语句。
If you need to run this in a Test window, you can embed it in a begin..end
block to make it a PL/SQL statement block. 如果需要在“测试”窗口中运行它,可以将其嵌入到
begin..end
块中,使其成为PL / SQL语句块。
I also faced this error. 我也遇到了这个错误。 You need to go to tools->preferences.
你需要去工具 - >偏好。 In window types go to SQL window and select "Auto select statement".
在窗口类型中,转到SQL窗口并选择“自动选择语句”。 This should remove the error.
这应该删除错误。
try this way; 试试这种方式;
UPDATE TableX SET Field1 = 'New value 1' WHERE Field2='1'
/
UPDATE TableX SET Field1 = 'New value 2' WHERE Field2='2'
/
UPDATE TableX SET Field1 = 'New value 3' WHERE Field2='3'
/
Hi, 嗨,
you can try this. 你可以试试这个。
Declare
Begin
UPDATE TableX SET Field1 = 'New value 1' WHERE Field2='1';
UPDATE TableX SET Field1 = 'New value 2' WHERE Field2='2';
UPDATE TableX SET Field1 = 'New value 3' WHERE Field2='3';
End;
in sql developer to execute multiple queries you need to create anonymous block. 在sql developer中执行多个查询需要创建匿名块。
hope this make your work easy. 希望这能让你的工作变得轻松。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.