describe命令:
返回中所存储的对象的描述
查看scott用户下的emp表的所有列及属性
sql> desc scott.emp; name type nullable default comments -------- ------------ -------- ------- -------- empno number(4) ename varchar2(10) y job varchar2(9) y mgr number(4) y hiredate date y sal number(7,2) y comm number(7,2) y deptno number(2) y
查看scott用户下的dept表的所有列及属性
sql> desc scott.dept; name type nullable default comments ------ ------------ -------- ------- -------- deptno number(2) dname varchar2(14) y loc varchar2(13) y
查看dbms_output程序包的结构
sql> desc dbms_output; element type --------- --------- enable procedure disable procedure put procedure put_line procedure new_line procedure get_line procedure chararr type get_lines procedure
prompt命令:
向屏幕发送消息
sql> prompt 请输入姓名:; 请输入姓名:
define命令:
创建一个数据类型为char的用户自定义变量
sql> define; define _sqlplus_release = "000000000" (char) define _editor = "plsqldev" (char) define _date = "2018/4/8" (char) define _privilege = "" (char) define _o_version = "" (char) define _o_release = "000000000" (char) define _user = "system" (char) define _connect_identifier = "orcl" (char) sql> define tempno=7369; sql> define tempno; define tempno = "7369" (char) sql> select empno,ename from scott.emp where empno=&tempno; empno ename ----- ---------- 7369 smith
accept命令:
提示用户输入指定的数据
sql> accept tempno number prompt '请输入雇员编号tempno:' hide; sql> select empno,ename from scott.emp where empno=&tempno; empno ename ----- ---------- 7369 smith
替换变量
&替换变量
sql> select ename,sal,job,hiredate from scott.emp where sal > &amount; ename sal job hiredate ---------- --------- --------- ----------- jones 2975.00 manager 1981/4/2 scott 3000.00 analyst 1987/4/19 king 5000.00 president 1981/11/17 ford 3000.00 analyst 1981/12/3 sql> select ename,empno,job,&columnname from scott.emp where sal > 2000 order by &columnname; ename empno job sal ---------- ----- --------- --------- clark 7782 manager 2450.00 blake 7698 manager 2850.00 jones 7566 manager 2975.00 ford 7902 analyst 3000.00 scott 7788 analyst 3000.00 king 7839 president 5000.00 6 rows selected
&&临时替换变量
sql> select ename,empno,job,&&columnname from scott.emp where sal > 2000 order by &columnname; ename empno job sal ---------- ----- --------- --------- clark 7782 manager 2450.00 blake 7698 manager 2850.00 jones 7566 manager 2975.00 ford 7902 analyst 3000.00 scott 7788 analyst 3000.00 king 7839 president 5000.00 6 rows selected
show命令:
显示当前环境系统变量,错误信息,初始化参数,当前用户等信息
sql> show all; sql> show all; sql> show user; user is "system" sql> show release; oracle database 10g enterprise edition release 10.2.0.1.0
save命令:
用来将当前语句缓冲区中的内容保存到文件中,将执行过的语句存档备用
get命令:
将保存后的文件的内容读取到缓冲区进行显示
edit命令:
可以将缓冲区中的内容复制到一个文件,并且默认在记事本中打开该文件,用户可以对其中内容进行编辑并保存
@命令:
用于执行保存在脚本文件中的语句