SQL Developer Trick: Renaming Your Worksheets

thatjeffsmith SQL Developer 21 Comments

Tell Others About This Story:

After a VNC session with the always brilliant @bamcgill, I now know how to rename a worksheet.

Worksheet names are based on the connection name they are attached to

So when you open a worksheet, it’s attached to a database connection. The worksheet name is a property, and it defaults to the connection name. So you DO you have a lot of control over the worksheet name. This is the primary reason I advocate using well thought out names for your connections.

But maybe you want to take a screenshot of a worksheet and not show where you’re connected. Or maybe you have 5 worksheets open and you want to be able to give them a logical name for easier navigation.

Just because there’s no ‘Rename’ available in the worksheet tab context menu, doesn’t mean you can’t do it ๐Ÿ™‚

And the Trick Is…

SET worksheetname NAME


And because I know someone will ask, ‘Yes, you can do this too.’

Single and double-quoting your worksheet names will work

Related Posts

Tell Others About This Story:

Comments 21

  1. Another request for it on a context menu please, since I can’t use SET WORKSHEETNAME in otherwise uneditable worksheets!

    Specifically, I’m using subversion, and ending up with names of the style: jdevbrowser.extension
    where the only bit that’s accurate is the extension (.java, .sql etc). Having the actual filenames would be a lot more helpful!

    1. thatjeffsmith Post

      Are you saying you’re opening a file from subversion and it’s not showing the filename by default? If so, that’s a bug. You shouldn’t have to manually re-label the document tab to make it useful.

      1. If I check out or export the files to my PC file system, and then open them in SQL Developer, then my PC gets the file with the correct filename, and this filename becomes the tab name in Developer. Pretty much as you’d expect.

        But if I use the Versions panel to browse the remote repository, and then open the file directly from the panel, it is temporarily downloaded, under a name such as jdevbrowser983263764387083895.sql, and this then becomes the (unchangeable) name shown in the tab. The only part of the name that’s accurate is the extension; in this case, the original file was converis_dump.sql

  2. hello jeff,

    i have an enhanchement request.

    can this be included in the right click menu option on the tab?
    it would be very welcome!

  3. Hi Jeff
    Is there a set command that allows to rename a Worksheet Tab. It would be a cool feature in case in a script with several statements you can set specific Tab name for every SQL output.
    — Kirill

    1. thatjeffsmith Post
  4. Hi,

    The SET WORKSHEETNAME behavior seems to have changed in 4.2. When I for example execute the command SET WORKSHEETNAME TEST;, the worksheet name becomes SET WORKSHEETNAME TEST; as opposed to just TEST (like it used to be in 4.1.3.

    Do I need to do something to get the old behavior back?

    Thanks, Marie

    1. thatjeffsmith Post
      1. I just upgraded to and it works, but not the same as in 4.1.

        Now it is case sensitive and set worksheetname has to be in lower case. Also, you no longer can have the semi colon at the end.

        It works though, so I’m good. Just a little strange that the old syntax doesn’t work any more.

    1. thatjeffsmith Post

      Just to make sure you’re not missing this, if you mouse over a document, it will show you the connection.

      You can color code your connections such that [email protected] is always colored in RED – so you can add a visual indicator.

      If you want a prompt, you’ll need to use SQL*Plus or SQLcl.

  5. Hi Jeff and thanks for this tricks.

    I tried to include “set workshetname” in my login.sql but when i clic in connections for open SQL Worksheet, this SET doesn’t work.

    But, when i write in SQL WorkSheet this commande :
    set worksheetname &_GNAME
    it work ๐Ÿ™ [worksheetname change for “[email protected]”]

    I would like the worksheet name change automaticlly.

    Thank for your help.

    SQLDeveloper Version Build MAIN-19.07

    Here is my login.sql

    set serveroutput on
    define _GNAME=idle
    column global_name new_value _GNAME
    select lower(user) || ‘@’ || substr( global_name, 1, decode( dot, 0, length(global_name), dot-1) ) global_name
    from (select global_name, instr(global_name,’.’) dot from global_name );
    set worksheetname &_GNAME
    set timing on
    set sqlformat ansiconsole

    1. thatjeffsmith Post

      that login script is running before your worksheet opens, and it doesn’t run through the worksheet itself, so you can’t manipulate a worksheet via that mechanism

      1. Thanks you.

        Do you know if exist another mechanism for manipulating a worksheet name?

      2. thatjeffsmith Post
  6. Hello Jeff,

    is it possible to include variables? I would like to set the name dynamically in a script. The best I get is

    COLUMN tabname NEW_VALUE tabname NOPRINT;
    SELECT ””||USER||TO_CHAR(SYSDATE,’ dd.mm’)||’ Bug 23748”’ tabname
    FROM dual;

    But then the tab is named “SET WORKSHEETNAME ‘MYUSER 16.04 Bug 23748′”
    It’s almost what I want, except for the SET WORKSHEET ๐Ÿ™‚



      1. thatjeffsmith Post

Leave a Reply

Your email address will not be published. Required fields are marked *