SQLDeveloper: execute current line without highlighting

后端 未结 4 669
春和景丽
春和景丽 2021-02-13 20:42

In Toad one can easily execute current line without highlighting it. Let say, you have a worksheet like this:

select * from item -- cursor here


select * from p         


        
相关标签:
4条回答
  • 2021-02-13 20:50

    For those who also wonder about the same thing, here is what you gotta do. End each statement with ; and it works.

    select * from item
    ;
    
    select * from product;
    
    0 讨论(0)
  • 2021-02-13 20:58

    If you have a block (anonymous or such) of code before your sql statement, make sure to end with forward slash, for the CTRL+enter to work.

    CTRL+Enter on the select sysdate statement below works in second example below, but not on the first example.

    Example 1:

    begin
    NULL;
    end;
    
    select sysdate from dual; -- press CTRL+Enter on this statement
    

    Example 2:

    begin
    NULL;
    end;
    /
    
    select sysdate from dual; -- press CTRL+Enter on this statement
    
    0 讨论(0)
  • 2021-02-13 21:06

    I also ran into a similar situation where Ctrl+Enter shortcut stopped working for executing any statement and had to highlight the entire statement for executing it.

    How it worked: (i) By removing/commenting out all the comments in the worksheet i.e. just have only the Sql statements in the worksheet, if at all you have put any statements/comments in the worksheet for your understanding, just disable those and then Ctrl+Enter starts working.

    PS: I didn't do any other changes apart from this to make this shortcut work.

    Cheers

    0 讨论(0)
  • 2021-02-13 21:13

    Actually the best option is mentioned here : http://forums.allroundautomations.com/ubb/ubbthreads.php?ubb=showflat&Number=46683

    1) Press Ctrl-F8 when the cursor is on the statement. Now only the current statement is executed. You can assign a different key through the preferences (Tools > Preferences > Key Configuration > "SQL Window: Execute current statement").

    2) Enable the "AutoSelect statement" preference (Tools > Preferences > SQL Window). Now the standard execute function will automatically select the current statement under the cursor and execute it. To execute multiple statements you now have to explicitly select them first in the editor, or use Ctrl-F8.

    0 讨论(0)
提交回复
热议问题