SQLDeveloper支持执行脚本吗?
今天我试图遵循一些说明,它以注释“
REM In SQLPlus I manually copy in each line and execute it.
That's Nice, I don't have SQLPlus, I have SQLDeveloper”开头。 粘贴的行的类型为:
@\\server\dir\dir\dir\commandfile1.txt;
COMMIT;
...等。
当我在 SQL 窗口中尝试时,它不喜欢它。 我打开并手动粘贴命令,它对此也不满意。 (我有没有提到我对这个应用程序和 Oracle 都不太擅长,但今天其他人都出去了?)那里的文件以这样的代码开头:
rem
set echo on
rem
execute procedure_name ('parameter1', 'parameter2');
一位同事确实有 SQLPlus,我们一起解决了这个问题。 但是,有没有办法让我用 SQLDeveloper 来做到这一点,这样即使他也出去了,我也不会陷入困境?
I was trying to follow some instructions today, and it starts with the comment
REM In SQLPlus I manually copy in each line and execute it.
That's nice, I don't have SQLPlus, I have SQLDeveloper. The lines that were pasted in were of the type:
@\\server\dir\dir\dir\commandfile1.txt;
COMMIT;
...etc.
It didn't like it when I tried that in a SQL window. I opened up and pasted in the commands by hand, and it wasn't happy with that either. (Did I mention that I'm not so good with this application nor Oracle, but that everyone else was out today?) The files there started with code like:
rem
set echo on
rem
execute procedure_name ('parameter1', 'parameter2');
A co-worker did have SQLPlus, and together we got it resolved. But, is there a way for me to do this with SQLDeveloper, so I'm not stuck if he's out too?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
要在 SQL Developer 中运行脚本:(
如果有空格,则只需要引号)
您可以设置默认路径:工具菜单 > 首选项> 数据库> 工作表> 选择默认路径来查找脚本
To run scripts in SQL Developer:
(You only need the quotes if there are any spaces)
You can set a default Path: Tools menu > Preferences > Database > Worksheet > Select default path to look for scripts
我查看了帮助文件,并在 SQL Developer Concepts and Uses->Using the SQL Worksheet->Script Runner 中找到了如何执行此操作。
基本上,您必须在文件名前面加上@。 例如@C:\MyScript\Script.sql。
然后您可以通过这种方式运行一批。 请注意,该命令似乎不喜欢文件路径中的空格。
I was looking through the help files and found how to do it in SQL Developer Concepts and Usage->Using the SQL Worksheet->Script Runner.
Basically, you have to precede the file name with an @. For example @C:\MyScript\Script.sql.
You can then run a batch of them this way. Note that the command doesn't seem to like spaces in the file path.
如今,SQL Developer 附带了另一个名为 sqlcl 的工具。 这有点像 SQLPlus,但实际上使用 SQL Developer 中的一些位来提供兼容的命令行/脚本类型接口。
您将能够使用它来执行 sqlplus 风格的命令,而无需与 SQL Developer 风格 GUI 的额外功能进行斗争,这可能会造成混乱。
在 SQL Developer 所在的位置下查找它。 如果那里没有,您可以下载它并将其部署到您的 sqldeveloper 文件夹中。
SQL Developer these days comes with another tool called sqlcl. This is a bit like SQLPlus but is actually using some bits from SQL Developer to give a compatible command line/scripting type interface.
You would be able to use it to execute sqlplus style commands without fighting the extras of the SQL Developer style GUI which can get confusing.
Look for it under wherever SQL Developer is sitting. If you don't have it there, you can download it and deploy it into your sqldeveloper folder.
您可以使用 sqlcl 执行此操作,就像使用 SQL PLUS 执行此操作一样,从命令行:
文件应位于 sqlcl 所在的同一目录中。
如果您尝试在 sql 文件上执行大量指令,此解决方案是最佳选择。
you can do it using sqlcl in the same way how you would do it using SQL PLUS, from command line:
file should be in the same directory where sqlcl is.
This solution is the best option if you are trying to execute a lot of instruction on sql file.
对于需要运行的每个文件,找到它并将其放入 SQLDeveloper 中。 运行脚本 (F5),然后提交 (F11)。 这适用于某些脚本,但不是全部。
For each file you need to run, find it and drop it into SQLDeveloper. Run the script (F5) and then commit (F11). This will work for some scripts, but not all.
这样就可以做到:
This would do it: