Using Notepad++ to Execute Oracle SQL

來源:互聯網
上載者:User

標籤:des   style   blog   http   io   os   ar   for   strong   

原文連結: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

 

 

Using Notepad++ to Execute Oracle SQL

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.