是否有可以一次执行一个语句的SQL脚本的工具? [英] Are there tools that can execute a SQL script one statement at a time?

查看:53
本文介绍了是否有可以一次执行一个语句的SQL脚本的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我必须运行数据库迁移脚本时,我倾向于产生很大的偏执狂,而一次运行所有脚本,就像 dbcli<migration.sql .相反,我更喜欢一次运行命令.到目前为止,我一直在使用复制/粘贴,这很痛苦.

When I have to run database migration scripts, I tend to exercise a large degree of paranoia and not run the script all at once like dbcli < migration.sql. Instead, I prefer to run the commands one-at-a-time. So far, I've just been using copy/paste which is miserable.

必须有一个可以完成这种事情的工具,但是我很难用Google找到一个工具,关闭,但没有雪茄).

There has to be a tool that can do this kind of thing, but I'm having a hard time finding one using Google, Wikpedia, or StackOverflow (close but no cigar).

这绝对是我可以写的东西我自己,但是只是已经已经存在,不是吗?

This is definitely something I could write myself, but it just has to exist already, doesn't it?

这确实需要可以在命令行中以很小的交互性运行(例如显示将要执行的语句,让您按ENTER键执行它,然后显示输出)是的),因为服务器通常没有可用的GUI.

This really needs to be something that can be run from a command-line with a tiny bit of interactivity (like display the statement that will be executed, let you press e.g. ENTER to execute it, then show you the output if there is any) since servers usually don't have any GUI available.

我特定的数据库目标是MySQL,但是不需要这种工具是特定于数据库的.

My specific db target is MySQL but there's no need for such a tool to be db-specific.

更新

Update

与此同时,我正在用Java编写一个实用程序,该实用程序可以实现我想要的功能.

Meanwhile, I'm writing a utility in Java that will do what I want.

推荐答案

只要以分号结尾,Oracle SQL Developer将一次运行一行.

Oracle SQL Developer will run one line at a time as long as it's ended with a semi-colon.

您可以使用其他驱动程序(http://www.oracle.com/technetwork/products/migration/omwb-getstarted-093461.html )

You can connect to certain 3rd party databases with additional drivers (http://www.oracle.com/technetwork/products/migration/omwb-getstarted-093461.html)

这篇关于是否有可以一次执行一个语句的SQL脚本的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆