The code window in the upper right area of SQL Scratchpad permits entry of SQL and PL/SQL statements. If the Code Window contains a single SQL statement or a single PL/SQL block, you can use the Execute Query button (a green arrow with a table) that appears on both the toolbar and the context menu. For SELECT statements, a results window will appear. For DML statements, you have the option of seeing a dialog that will ask whether you want to commit, rollback, or continue without committing or rolling back. This option is toggled on or off through the Extras | Settings | SQL Page menu item.
It is important to know that no commit takes place unless you either explicitly execute a Commit statement, press the Commit button near the left end of the Toolbar, or end your session normally. If you end your Hora session by clicking on the X button or by Alt + F4, a commit is issued for you.
If your session ends abnormally (for example, your session is killed, or Hora is ended through the Task Manager), your DML statements will not be committed. You may also press the Rollback button, next to the Commit button, to effect a rollback.
Note that if you explicitly commit or rollback, the Commit and Rollback buttons are both grayed out until another transaction is underway.
You can also enter a series of SQL statements or PL/SQL blocks and execute them using the Execute Script button (a green fast-forward symbol). In this case, no results grid or confirmation dialog will appear. For successful execution, a message will appear in the status line. Error messages will appear in a popup window.
In a SQL script consisting of several SQL statements, you can execute a single statement by placing your cursor on it and and pressing the Execute Query button. Only the highlighted statement will be executed.
Statements containing errors are highlighted in color. You can then correct them and re-execute the contents of the entire editor window, or you can select just a portion of the code and execute that.
The following error message will also appear:
Choosing Yes will start an attempt to execute the rest of the script. The script will halt, however, if further errors are found. Pressing All will cause the script to continue without stopping, even if further errors are encountered.
The choices that are available from the right mouse button's context menu are determined by the SQL editor, and are shown in the discussion of the SQL Editor Component, under Hora's Work Environment.
Another option is to send the contents of the Code Window to a new SQL*Plus session for execution. This session runs independently of Hora and automatically terminates when the code has been executed. All output from SQL*Plus will be shown in the DBMS_OUTPUT window.
Click the SQL*Plus icon on the Toolbar, or choose Query | Execute with SQL*Plus from the context menu to get started.
The integrated editor features syntax highlighting and codefolding for the most commonly used languages, such as SQL, PL/SQL, Java; C++, Pascal , and even HTML und XML. This makes it easier to navigate within a script on the SQL page or the PL/SQL Objects’ Outline window. If you want to edit a specific procedure in the Outline window, you need only click on its name, and the cursor will bring it into the Code window.
When you select a block of code, you see the Sync Range icon appear on the left edge of the window. This button allows simultaneous editing within the selected text. For example, if you want to change the name of a variable within a block of code, just select the desired area and click the Create Sync Range button. As soon as you click on a variable name, all occurrences of the name are highlighted. When you change the variable name in one location, it is changed for all occurrences within the block.