SQL Developer – Difference Snippet VS Code Template
In principle, Snippet and Code Template serve the same purpose: Previously created code is inserted at the desired location. The only difference between the two tools is the paste option. Snippets require the Snippets window first. This can be dragged to any location in the SQL Developer. In addition, the snippets are divided into different groups (better sortability). If a snippet is selected, it can be dragged to any position with the mouse.
By contrast, code templates can not simply be dragged and dropped into an SQL file. They appear either as a selection or automatically when a particular string is entered. This string (shortcut) can be set by itself. This is usually an abbreviation of the individual code templates.
When code template and when snippet?
Code templates should be used for often (frequently) and regularly used functions, such as abbreviations for WHERE statements, JOIN statements, or classic SELECT statements. Snippets, on the other hand, should be a code template for rarely used functions. This can be example codes, which still have to be adjusted in several places. Efficiency is not an advantage here, but simply remembering and finding templates. Therefore, the rule: Define common code as template with shortcut, put code examples as snippet. This can increase efficiency and quickly develop SQL code.
Keywords: SQL Developer Snippet, SQL Developer Code Template, Snippet VS Code Template