1、desc描述表列名 2、查看所有的表 select table_name from user_tables; 3、查询的时候临时用#去查找表的列名称 有没有过这样的经历? 在sql*plus中敲了很长的命令后, 突然发现想不起某个列的名字了, 如果取消当前的命令,待查询后再重敲, 那太痛苦了. 当然你可以另开一个sql*plus窗口进行查询, 但这里提供的方法更简单. 比如说, 你想查工资大于4000的员工的信息, 输入了下面的语句: SQL> select deptno, empno, ename 2 from emp 3 where 这时, 你发现你想不起来工资的列名是什么了. 这种情况下, 只要在下一行以#开头, 就可以执行一条sql*plus命令, 执行完后, 刚才的语句可以继续输入 SQL>> select deptno, empno, ename 2 from emp 3 where 6 #desc emp 4、执行一个脚本 start file_name 或者 @ file_name, @@用在sql脚本文件中,用来说明用@@执行的sql脚本文件与@@所在的文件在同一目录下,而不用指定要执行sql脚本文件的全路径。一般用在脚本中调用其他脚本。 5、运行结果保存到文件 SPOOL file_name spool D:\a.txt; select * from task_cnml; spool off; 6、PROMPT [text] 将指定的信息或一个空行输出到屏幕上,类似打印日志信息。 7、PAUSE [text] 将执行的过程暂停,等待用户响应(输入enter)后继续执行。 8、RUN或者/ 再次执行刚才执行的sql。主要用于脚本中有begin 和 end;的事物,因为end;回车后并不会执行该sql,只有run或者/之后才行。 help /的结果 Executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer. Use slash (/) at the command prompt or line number prompt in SQL*Plus command line, or use slash (/) in the iSQL*Plus Workspace. The buffer has no command history and does not record SQL*Plus commands. help run的结果 Lists and executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer. The buffer has no command history list and does not record SQL*Plus commands. R[UN] 9、将一个数据库中的一些数据拷贝到另外一个数据库(如将一个表的数据拷贝到另一个数据库) COPY {FROM database | TO database | FROM database TO database} {APPEND|CREATE|INSERT|REPLACE} destination_table [(column, column, column, ...)] USING query 10、显示sql*plus命令的帮助 HELP 如何安装帮助文件: Sql>@ ?\sqlplus\admin\help\hlpbld.sql ?\sqlplus\admin\help\helpus.sql Sql>help index 或者 ? index 将显示所有的sqlplus命令 11、与操作系统命令互切换$ SQL> $dir 驱动器 C 中的卷没有标签。 SQL> |
|