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 product
When I click on CTRL+Enter I want only the line where the cursor is to be executed. In SQLDeveloper, if there is no second line, CTRL+Enter works as I want. Basically, I want to do the same as described here, but for some reason, I can't find the Tools -> Preferences -> Window Types -> SQL Window and check "AutoSelect statement" in the version of the SQLDeveloper I am using: 4.0.0.13, build Build MAIN: 13.80.
Seems like, this functionality is taken out in the 4.x of Oracle SQLDeveloper?
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
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;
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.
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
Related
In Oracle, I can separate blocks of PL/SQL code with the / character, and Oracle SQL Developer knows that when I run code with Ctrl+Enter, it's supposed to run all the code it finds until finding a /. Is there anything similar for SQL Server Management Studio (or T-SQL)?
As I note in the comment, one method is to highlight the SQL you want to execute, and then press the Execute Button (or F5) and only the SQL you have selected will be run.
This works in other Microsoft based IDEs too, such as Azure Data Studio:
Note, however, that when using such techniques that only variables defined in the highlighted SQL will be accessible. Take, the following statement for example:
DECLARE #MyString nvarchar(50) = N'This is my string';
SELECT #MyString;
SELECT CONCAT(#MyString, N' again');
If you highlight the last row only, you will get an error stating that the variable #MyString has not be declared:
I am looking for a shortcut in eclipse to select which I have already used in IAR Embedded Workbench but I didn't find it in Eclipse.
briefly shortcut explained in Iar's doc and looks like in the gif below:
To select text, press Shift and the corresponding command for moving
the insertion point. In addition, this command is available:
A column-based block: Shift + Alt + Arrow key
Use Alt-Shift-A to start block selection. Then use Shift+arrows to select an aligned column as in your example. Once you use Alt-Shift-A again, the selection mode goes back to normal.
create or replace procedure customer_p (in cids int)
language sql
DYNAMIC RESULT SETS 1
p1:begin
declare cursor1 cursor with return for
select * from customer
where cid > cids;
open cursor1;
end p1
There is more than one way...
One Simple way is to use Ctrl-F5 to invoke the CALL statement .
For example: highlight CALL customer_p(100) (for example) and when selected use Ctrl-F5 to run it.
This is same as "Run script output as a script" (you can see this button in the lower pane).
If the stored procedure completes without error, and returns a non-empty result-set then you will see the result-set in the lower pane "Script Output".
I should change the my DB into SyBase sql
as I Know double click select the variable
and then I copy the variable and paste
It takes a lot of time
I can't use replace all because there is so many various thing
what is the
Shortcut to select variable in eclipse
Click on the variable name you wish to rename and press Ctrl+R (Cmd+R for Apple devices), then rename it.
I have a huge code and now for testing purpose I have to add that whole script into an infinite while loop is there any short way (without pressing space for each row) to add a space for indentation so the whole code is consider part of the one while loop ? Such as for example when we press ctrl +r it comments out the line
Ctrl-I/Cmd-I will automatically indent the file. Other wse you just select multiple row and use Tab/Shift-Tab to move them backwards and forwards.
For indentation is a must, however Matlab as a language does not care so it is not really a must to indent it. Additionally, you can just execute the code from the command line, say that you script or function is called Umar, then from the command line you just type while 1, Umar; end.
You can copy the code into notepad++.
Activate Column mode selection holding alt+shift and use the mouse to select the column of all the text you want to insert a space/tabulation/etc. and just insert it.
Final step is to copy back the code to matlab.
Matlab does not currently support column selection.
MATLAB has the option to select all your code, then press the right click and select smart indent button.
If you like to use shortcuts, just type the combination of Ctrl+A (select all) followed by Ctrl+I (smart indent)