Using Notepad++ to Execute Oracle SQL

原文链接:http://www.toadworld.com/products/toad-for-oracle/b/weblog/archive/2013/08/21/using-notepad-to-execute-oracle-sql.aspx

Notepad++是一个很实用的文本编辑工具,用它来执行Oracle SQL也很有意思,虽然不太实用,或许在某些场合会有用吧。

在此复制原文只作记录,原文见如上链接。

原文如下:

Toad for Oracle is the single most robust and powerful IDE (Integrated Development Environment) and DBA tool for all your Oracle database needs. It’s a veritable nuclear powered, Swiss army knife capable of grand accomplishments. However there may well be times where you need a smaller, focused and thus simpler tool for modest tasks – such as opening and running a straightforward SQL script, where you might make minor changes such as setting a different script variable value at the top. Yet you still expect important features such as syntax highlighting for readability. For those specific, lesser needs I often use the popular freeware editor Notepad++. However it requires some manual tweaking in order to have Notepad++ execute SQL via Oracle’s SQL*Plus. In this blog I’ll show you how.

Note: The astute reader might ask “Why not just use Toad’s free QSR utility (i.e. Quest Script Runner -- it ships with every copy of Toad for Oracle) which looks and operates the same way as the Toad Editor, but it only includes a subset of the Editor‘s features?” – shown below in Figure 1.   The answer is simple – people like choices and many people know and prefer Notepad++ as their standard Windows Notepad replacement and editor of choice for most simple needs.

Figure 1: Quest Script Runner Example

So let’s see how to enable Notepad++ to work much like QSR – where Notepad++ is the basic editor and spawns SQL*Plus to run the editor contents. It may not be as well integrated or flexible as QSR, but once again it’s what many people know and prefer for basic editing. Figure 2 shows the same script execution results as Figure 1.

Figure 2: Notepad++ Example

Here are the steps:

  1. Launch Notepad++
  2. Main menu -> Plugins -> Plugin Manager -> Show Plugin Manager
  3. Available Tab, Find and check NppExec plugin (see Figure 3 below)
  4. Press Install button to download & install plugin – restarts Notepad++
  5. Open a SQL script
  6. Press F6 key (NppExec’s default execute keyboard mapping)
  7. Enter the following macro script into the Execute pop-up (see Figure 4 below)   set ORA_USER=bert set ORA_PASS=bert1234 set ORA_SID= ORCL npp_save cmd /c copy /y "$(CURRENT_DIRECTORY)\$(FILE_NAME)" "$(SYS.TEMP)\$(FILE_NAME)" >nul 2>&1 cmd /c echo. >> "$(SYS.TEMP)\$(FILE_NAME)" cmd /c echo exit >> "$(SYS.TEMP)\$(FILE_NAME)" sqlplus -l $(ORA_USER)/$(ORA_PASS)@$(ORA_SID) @"$(SYS.TEMP)\$(FILE_NAME)"
  8. Change the first three variables for your database, username and password
  9. Press the OK button

Figure 3: Notepad++ Plugin Manager – Enable NppExec

Figure 4: Save your SQL*Plus execute macro

时间: 2024-11-01 08:13:31

Using Notepad++ to Execute Oracle SQL的相关文章

实战:ORACLE SQL Performance Analyzer

通过 SPA,您能够依据各种更改类型(如初始化參数更改.优化器统计刷新和数据库升级)播放特定的SQL 或整个 SQL 负载,然后生成比較报告,帮助您评估它们的影响. 在 Oracle Database 11g 之前的版本号中,我必须捕获全部 SQL 语句,通过跟踪执行这些语句,然后得到运行计划 - 这是一项极其耗时又极易出错的任务.新版本号中,我们不须要再那样做了,我改用很easy而有效的 SQL Performance Analyzer. ---使用场景 1.数据库升级2.实施优化建议3.更改

oracle sql - remove a user's all objects

DECLARE TYPE cst_table_list IS TABLE OF VARCHAR2(40); TYPE cst_list IS TABLE OF VARCHAR2(40); TYPE name_list IS TABLE OF VARCHAR2(40); TYPE type_list IS TABLE OF VARCHAR2(20); cst_tab_name cst_table_list:=cst_table_list(); cst_name cst_list:=cst_list

oracle sql 高级编程 历史笔记整理

20130909 周一 oracle sql 开发指南 第7章 高级查询 1.层次化查询select level,ttt.*,sys_connect_by_path(ttt.col1,',') from ttt start with .. Connect by prior -因为先建立树,再进行where过滤的.在where中过滤和在cooonect by中过滤是不一样的. 2.rollup cube高级查询 select grouping(col1) .. From ttt group by

Oracle SQL explain/execution Plan

From http://blog.csdn.net/wujiandao/article/details/6621073 1. Four ways to get execution plan(anytime you want, for specified sql) ? Execute the SQL statement EXPLAIN PLAN, and then query the table where the output was written. ? Query a dynamic per

Oracle Sql Loader的学习使用

最近由于遇到oracle控制文件的使用,虽然不是很复杂,但是从来没有用过,专门花点时间看看.点击 这里 查看详细 1,概述: Sql Loader: 一个批量工具,将文件数据导入到数据库.可以导入一个表或者多个表,甚至可以在导入时修改数据. 2,使用 a,你电脑需要装Oracle,不然你是找不到Sqlldr 这个命令的. 在控制输入台输入 sqlldr: 会列出相关的参数介绍. > sqlldr . . . Usage: SQLLDR keyword=value [,keyword=value,

[Oracle] SQL*Loader 详细使用教程(2)- 命令行参数

sqlldr工具 SQL*Loader的客户端工具是sqlldr,在操作系统的命令行下输入sqlldr,后面不接任何参数,将显示帮助信息如下所示(所有命令行参数的简单描述及其默认值),所以你并不需要对下面的参数死记硬背,当你忘记它们时,可以通过这个方式快速查询. [plain] view plain copy print? Valid Keywords: userid -- ORACLE username/password control -- control file name log -- 

Oracle SQL Trace 和 10046 事件

一. SQL_TRACE 当SQL语句出现性能问题时,我们可以用SQL_TRACE来跟踪SQL的执行情况,通过跟踪,我们可以了解一条SQL或者PL/SQL包的运行情况,SQL_TRACE命令会将SQL执行的整个过程输出到一个trace文件中,我们可以读这个trace 文件来了解在这个SQL执行过程中Oracle 都做了哪些操作. 可以通过sql命令启动SQL_TRACE,或者在初始化参数里面. SQL>alter session set sql_trace=true; 或者 SQL> alte

weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB cannot be cast to oracle.sql.BLOB 解决方法

源程序: SerializableBlob sb = (SerializableBlob)s.getStampimage();Blob wrapblob = sb.getWrappedBlob();oracle.sql.BLOB blob = (oracle.sql.BLOB)wrapblob;OutputStream out = blob.getBinaryOutputStream();out.write(s.getStampimagebyte());out.close(); 异常情况: ja

Oracle SQL语言基础及环境准备_超越OCP精通Oracle视频教程培训26

Oracle SQL语言基础及环境准备_超越OCP精通Oracle视频教程培训26 本课程介绍: Oracle视频教程,风哥本套oracle教程培训是<<Oracle数据库SQL语言实战培训教程>>的第1/5套:SQL语言之基础入门及环境准备.主要学习Oracle数据库SQL语言基础介绍.PL/SQL语言介绍.数据库SQL对象与数据类型介绍.SQL语言实战环境准备等. Oracle SQL语言之基础及环境准备,课程内容详细如下: Oracle数据库SQL语言基础介绍Oracle数据