plsql usage skills

1. SQL PLUS-like window: File->New->Command Window, this is similar to oracle's client tool sql plus, but it is much easier to use.

2. Set the keyword to automatically capitalize: Tools->Preferences->Editor, select the Keyword case as Uppercase. In this way, when you enter a sql statement in the window, the keywords will be automatically capitalized, while others are lowercase. In this way, it is easier to read the code and maintain a good coding style. Similarly, in Tools->Preferences->Code Assistant (assistant), you can set the code prompt delay time, prompt when entering a few characters, and uppercase and lowercase database objects. capitalization, etc.;

3. View the execution plan: Select the SQL statement to be analyzed, and then click the Explain plan button (that is, the execution plan) on the toolbar, or press F5 directly; this is mainly used to analyze the execution efficiency of the SQL statement, analyze the structure of the table, and is convenient for sql Provide an intuitive basis for tuning;

4. Automatic replacement: Quickly enter SQL statements, such as input s, press space, and automatically replace with SELECT; for another example, enter sf, press space, and automatically replace with SELECT * FROM, which is very convenient and saves a lot of time to write Duplicate SQL statements.

Setting method: menu Tools–>Preferences–>Editor–>AutoReplace (automatic replacement)–>Edit

1), create a text file shortcuts.txt, and write the following content:
s=SELECT
copy the code and save it to the ~/PlugIns directory under the installation path of PL/SQL Developer
2), Tools–>Preferences–>User Interface– >Editor->AutoReplace, select the Enable checkbox, then browse the file to select the shortcuts.txt created earlier, and click Apply.
3) Restart PL/SQL Developer, enter s+space in the sql window, and sc+space to test.
Note: shortcuts.txt cannot be deleted, otherwise the shortcut keys cannot be used

Some rules are defined below for reference
i=INSERT
u=UPDATE
s=SELECT
f=FROM
w=WHERE
o=ORDER BY
d=DELETE
df=DELETE FROM
sf=SELECT * FROM
sc=SELECT COUNT(*) FROM
sfu=SELECT * FROM FOR UPDATE
cor=CREATE OR REPLACE
p=PROCEDURE
fn=FUNCTION
t=TIGGER
v=VIEW
sso=SET serveroutput ON;

设置快捷键(设置方法:菜单Tools–>Preferences–>用户界面–>键配置)
新建sql窗口:ctrl+shift+s
新建命令窗口:ctrl+shift+c
新建测试窗口:ctrl+shift+t
PL/SQL Developer美化器:ctrl+shift+f
重做:ctrl+shift+z
撤销:ctrl+z
清除:ctrl+d(慎用,不可恢复,俺是禁用哦O(∩_∩)O~)
选中所有:ctrl+a
缩进:tab
取消缩进:shift+tab
大写:ctrl+shift+x
小写:ctrl+shift+y
注释:ctrl+h
取消注释:ctrl+m
查找:ctrl+f
显示表结构:ctrl+鼠标悬停在表名上
模板列表:shift+alt+r
窗口列表:ctrl+w

5、执行单条SQL语句:按F8键

6、TNS Names:菜单Help->Support Info(支持信息)->TNS Names,可以查看Oracle的tnsnames.ora;

7、调试存储过程
在使用PL/SQL Developer操作Oracle时,有时候调用某些存储过程,或者调试存储过程;
调用存储过程的方法:
1)、首先,在PL/SQL Developer左边的Browser中选择Procedures,查找需要调用的存储过程;
2)、然后,选中调试的存储过程,点击右键,选择Test,在弹出来的Test scrīpt窗口中,对于定义为in类型的参数,需要给该参数的Value输入值;最后点击上面的条数按钮:Start debugger或者按F9;
3)、最后点击:RUN 或者Ctrl+R 。

调试快捷键
切换断点:ctrl+b
开始:f9
运行:ctrl+r
单步进入:ctrl+n
单步跳过:ctrl+o
单步退出:ctrl+t
运行到异常:ctrl+y

8、模板快捷键

9、登录后默认自动选中My Objects  

默认情况下,PLSQL Developer登录后,Brower里会选择All objects,如果你登录的用户是dba,要展开tables目录,正常情况都需要Wait几秒钟,而选择My Objects后响应速率则是以毫秒计算的。

设置方法:
Tools菜单–>Brower Filters,会打开Brower Folders的定单窗口,把“My Objects”设为默认即可。
Tools菜单–>Brower Folders中把你经常点的几个目录(比如:Tables Views Seq Functions Procedures)移得靠上一点,并加上颜色区分,这样你的平均寻表时间会大大缩短,试试看。

优先级,从左往右

Tables–>Tablespaces–>Procedures–>Users–>Roles

转载:http://www.cnblogs.com/linjiqin/archive/2013/06/24/3152538.html


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325901759&siteId=291194637