oracle数据库中日期斜杠,在Oracle SQL中,何时需要使用分号和斜杠?

5b229e1b6ae6e16f7360e6855709f1c0.png

慕容森

我知道这是一个老生常谈,但我只是偶然发现,我觉得这一点还没有得到完全解释。在SQL*Plus中,/和一个;因为他们的工作方式不同。这个;结束SQL语句,而/执行当前“缓冲区”中的任何内容。所以当你使用; 和 a /该语句实际上执行了两次。您可以很容易地看到,使用/运行语句之后:SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 18 12:37:20 2012Copyright (c) 1982, 2010, Oracle.  

All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning and OLAP options

SQL> drop table foo;Table dropped.SQL> /drop table foo           *ERROR at line 1:ORA-00942: table or view does not exist在这种情况下,人们实际上注意到了错误。但是,假设有这样的SQL脚本:drop table foo;/这是从SQL*Plus内部运行的,这将非常令人困惑:SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 18 12:38:05 2012Copyright (c) 1982, 2010, Oracle.  

All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning and OLAP options

SQL> @dropTable dropped.drop table foo           *ERROR at line 1:ORA-00942: table or view does not exist这个/主要是为了运行嵌入了;就像CREATE PROCEDURE声明。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值