In this fifth part of a seven-part series on how to use Oracle SQL developer and other tools, you'll learn how to work with the Snippets window and how to handle syntax errors. This article is excerpted from chapter two of the book Murach's Oracle SQL and PL/SQL, written by Joel Murach (Murach; ISBN: 1890774502).
How to work with the Snippets window
Figure 2-9 shows how to use the Snippets window to enter a snippet of code into the SQL Worksheet window. To start, if the Snippets tab isn’t displayed on the right side of the SQL Developer window, you can select the Snippets command from the View menu to display the Snippets window. Otherwise, you can display the Snippets window by clicking on the Snippets tab that’s displayed on the right side of the SQL Developer window. Then, you can use the drop-down list at the top of the Snippets window to select a category of snippets, and you can drag a snippet from the Snippets window into the SQL Worksheet window. At that point, you can edit the snippet code so it’s appropriate for your SQL statement.
In this figure, for example, I dragged the COUNT(*) and SUM(expr) snippets into the SQL Worksheet window. Then, I edited the SUM(expr) snippet to replace the expr placeholder with a valid expression.
For now, don’t worry if you don’t understand the SQL statement presented in this figure. The main point is that you can use the Snippets window to enter a variety of SQL code. As you learn more about SQL statements, you’ll see how useful this can be.
How to use the Snippets window
Description
If the Snippets tab isn’t displayed on the right side of the SQL Developer window, you can display it by selecting the Snippets command from the View menu.
To display the Snippets window, click on the Snippets tab that’s displayed on the right side of the SQL Developer window.
To display another category of snippets, select the category from the drop-down list at the top of the Snippets window. The snippets are organized in 10 categories including: Date Formats, Number Formats, Date/Time Functions, Number Functions, Character Functions, Conversion Functions, and Pseudocolumns.
To enter a snippet into your code, drag the snippet from the Snippets window into the SQL Worksheet window. Then, if necessary, edit the snippet code so it’s appropriate for your SQL statement.
The Snippets window will become more useful as you learn more about formats and functions.
---------------------------------------Figure 2-9 How to use the Snippets window