Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut for Queries in SQL Developer

My colleagues using TOAD has a nice feature of a shortcut to queries. For example, they write get_customer_info and the word is replaced by a full joined query. This feature is very nice for productivity. My machine is not licensed to Toad and I use Oracle SQL developer. I wasn't lucky enough to find this feature. I wonder if it has this feature in the first place?

like image 689
mowienay Avatar asked Dec 05 '22 08:12

mowienay


2 Answers

SQLDeveloper has code templates for commonly used statements (see Tools > Preferences > Database > SQL Editor Code templates ). Then there are Snippets ( View > Snippets ) that can be dragged to existing code in the worksheet. It has also some built-in constructs (FOR, IF, etc.) that can be called with CTRL+SPACE if you start typing the statement. You could technically imitate TOADs behavior with the code templates and create templates for statements that you use often. I'm not sure if this even compares to TOADs capabilities, but that's pretty much all you have available in SQLDeveloper.

like image 173
tvm Avatar answered Dec 28 '22 08:12

tvm


You may do this by editing Code Template.xml file in the following location:

C:\Users\username\AppData\Roaming\SQL Developer

Add/Edit the file to write convenient shortcut:

       <row>
            <key>upt</key>
            <value>UPDATE table_name SET col_name='val' WHERE col_name='val';     
            </value>
       </row>

[Please restart your sql developer after edit this file.]

like image 30
Md. Kamruzzaman Avatar answered Dec 28 '22 08:12

Md. Kamruzzaman