打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
sqlplus常用命令
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>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
SQLPLUS命令大全
oracle知识点总结(一)
sqlplus设置命令
sqlplus的含义与解释
oracle基础sql语句
oracle连接异常shared memory realm does not exist
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服