This drove me nuts for a few minutes, so I figure you might need help too. That probably explains why you had to Google ‘Block Select’ and wound up here.

Here is what you want:

Block selection, works with the keyboard and mouse in SQL Developer

There’s No Trick, But You Do Have to Enable It

The default behavior is to do a normal ‘wrapping’ selection of text. You can disable this under the Edit menu.

By default your selections will ‘wrap’

Selecting Text In Action

Now you see it, now you don’t!

On a newer version of SQL Developer?

A lot has changed since I first wrote this in 2012. Here’s what it looks like today, and probably since about version 4.1/4.2 time frame.

You can also use ctrl+click to add additional cursors, but I find the shift+select to be easier for most scenarios.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

19 Comments

  1. Maria Halt Reply

    I can block select to copy/cut. I’d like to take it further and block insert like one can in SSMS.

  2. Will there ever be an option to do this pure by keyboard? Like in Notepad++ or even SQL Server Management Studio (lot’s “wrong” there, but they got this covered really well). Why is the implementation so difficult in SQL developer?

    Simply press ALT-SHIFT to do a block selection (and return to normal selection when you release)

    In SQL developer this tedious,
    1) you first need to enable block selection by mouse
    2) After your done and want normal selection behavior again, you need to disabled it again

    I’ve been working with SQL developer since 2.x and keeping notepad++ as its companion for block editing

    • You could use the keyboard to access the menu…

      The underlying editor and ide are coming from JDeveloper.

      Our next sql developer web will have the monaco editor, so you’ll like that I think.

  3. Thanks again Jeff!

    Anyway, it’s not quite user friendly. Should be done easily by ALT+selecting text as in other editors.

    • Right you can already, as you’ve seen. You just need to type to your connection once you’re in the connection drop-down control.

      If you want to get to connection A, and it’s not listed at the top, bc you have 4 other connections already open, just type ‘A’ and the focus will take you to the first connection name with first letter A.

  4. Hi Jeff,

    I came to your site after searching for ‘line wrap in sql developer’ on google but appraently the article is on the ‘wrap selection’ which atleast help me to figure that ‘wrap selection’ is not what I am looking for. πŸ™‚

    Basically what I want is fairly simple but somehow I am not able to turn it on.

    What I am trying to do is that when the query in the sql developer goes beyond the visual area then instead of generating a horizontal scrollbar, it should simply wrap the line to next line.

    Now I thought that this should be possible through some option in “tool->prefrences->code editor” but apparently it is not there. I did a little bit of googling but couldn’t find anything. Any thoughts?

  5. On a related note, if I have three SQL’s in a window (like as per your example), do you know if there is any way of running just one of them … without … having to highlight it ?

    Its fine when the SQL’s are 1 line long, but when they get very long … its a pain.

    Cheers
    Connor

    • Place your cursor in the statement and hit ctrl enter, making sure to use delimiters like a semicolon.

    • PaulStuart

      Jeff, I’ve never been able to get that functionality to work properly.

      I place the cursor inside the statement i want to run. I don’t select the statement. The statement can be either SQL or PL/SQL. The statement ends with a semi-colon. I hit control-enter. Rather than executing that statement, it tries to run the whole worksheet, and then errors out.

      Am I missing something here?

    • try this

      [sql]

      select * from user_tables;

      select * from all_tables;

      select * from dba_tables;

      [/sql]

      Place your cursor on the 2nd statement, and hit ctrl+enter. What happens?

    • Paul Stuart

      Hi Jeff,

      I’ve looked a bit deeper, and the issue i’m describing only happens if there’s more than one anonymous pl/sql block.

      So, for example :

      begin
      dbms_output.put_line(‘test1’);
      end;

      begin
      dbms_output.put_line(‘test2’);
      end;

      If I place the cursor in either block and hit control-enter,
      then i get the following error.

      Error report –
      ORA-06550: line 7, column 1:
      PLS-00103: Encountered the symbol “BEGIN”
      06550. 00000 – “line %s, column %s:\n%s”

      Which is basically because it’s attempted to run the whole worksheet, and errored because it’s found more than one begin.

      Would you consider that a bug or expected behaviour?

      Because, yes, the following code does work :

      begin
      dbms_output.put_line(‘test1’);
      end;
      /

      begin
      dbms_output.put_line(‘test2’);
      end;
      /

      The additional slash at the end of each block apparently delineates them so that sql developer recognises them as a separate block. I’d rather do without the slashes – so sqlplus!
      What are your thoughts?

      Paul Stuart

    • From the Docs

      SQL*Plus treats PL/SQL subprograms in the same manner as SQL commands, except that a semicolon (;) or a blank line does not terminate and execute a block. Terminate PL/SQL subprograms by entering a period (.) by itself on a new line. You can also terminate and execute a PL/SQL subprogram by entering a slash (/) by itself on a new line.

Reply To Robert Cancel Reply