Executing Scripts


To execute whole script in Script Editor make sure that there's no selection and then use either toolbar button or Editor popup menu item "Execute" or one of the shortcut keys. By default "Execute" assigned to F5 and Ctrl+E . If you want to execute part of the script simple select it and then use the same method as above. To execute text on a current line press Ctrl+Enter.

You can disable whole script execution in Tools->Options->Editor->Disable Whole Script Execution

If you see outline markers you can press Shift+Enter to execute it.

If you want to see results in a new Result Grid hold Shift key down while executing query.

Editor supports outline regions. To start outline region type --#region [Name]. To end type --#endregion [Name].

Name is optional. Region has to start at the beginning of line.


Named Favorite Script Fragments

Named script fragments allow quick access to often used portions of script file. To create script fragment enclose SQL block in special comment section as shown below

--{{ Fragment name
SELECT * FROM TABLE_1
go
SELECT * FROM TABLE_2
--}}

After you select and execute first comment line the combo box will show up on a toolbar and the "Fragment name" will be added to it

To execute fragment just select it in combo box

Fragments will be loaded automatically when script file loaded

Script Fragments can be used to create a user interface to often executed SQL blocks with the help of script variables. Below is the example of script fragment which asks for parameters

$define empname CHAR

--{{ Find Employee
SELECT * FROM SCOTT.EMP WHERE ENAME = $(empname);
$define empname
--}}

Now every time you execute Find Employee script fragment from the toolbar it will ask you for empname

In addition any script command can be used inside the fragment, for example cmd=format to format output.