易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle的分号和斜杠/ - Oracle / 基础和管理

引用
1. Adding a slash to the end of each statement was a bad choice because sqlplus treats slash as a buffer flush. For procedure/triggers/functions it is a must: because content of if is stored in the buffer and is not executed. However, for all other statements it means executing the same statement twice because such statement is executed immediately and put into buffer and following slash just re-executes the same statement.


我的理解是,对一些block,比如declare, begin end ,create procedure之类的,'/'是必须的,用来run
而一些简单statement,‘/ '会导致运行两次

问题是,直接用一个'/'就会运行两次,还是在分号之后还在下行跟着 / 才会执行两次?

另外,如果要避免重复执行的话,分号和斜杠是不是二选一就可以了,一般选哪个有啥习惯?

引用

1、放在分号后面的 / 会导致两次;sqlplus认为输入“;”表示一个语句结束
2、分号


谢谢。

再问一下
像create procedure,到最后也应该有个分号结束,然后再跟一个斜杠
对这种block的这样没问题吗?




如果是语句的话,;表示结束并且运行
如果是程序块或者pl块,;表示结束不允许,必须/表示运行

楼上的已经说的很清楚了!
;是执行语句必须的
/是执行语句块必须的


相关问答:

请教sql语句。 - Oracle / 开发

我有一个表,结构是这样。
  转出 单位 转入单位 笔数 金额
date(主) outid(主) inid(主) num amt
2009 1 2 1 500 为 1 单位 在2009� ......

[原创] ORACLE 连接字串 - Oracle / 非技术区

假设table01 中有 以下资料
emp_no emp_name
------- ------------
0001 TOM
0002 JOHN
0003 MARY
常用电话 
而我们要得到以下的OUTPUT (或是各种其他的output)
0001,TOM
0002,JOHN ......

Oracle中查看自己创建的表 - Oracle / 高级技术

怎么通过命令查看自己已经创建的表?
select tname from tab;

SQL code:

--1.sys用户登录
select table_name
from dba_indexes
where table_owner = '用户名';
--2.所有用户
select * from tab; ......

用ibatis调用oracle函数的问题 - Java / Web 开发

oracle函数如下:
create or replace function P_WEB_GETCITYID
(
  p_mobileNumber in VARCHAR2,
  p_cityid out NUMBER
) Return NUMBER
IS
  p_areacode varc ......

关于SQL语句OR的问题 - Oracle / 高级技术

通过NAME字段条件查询一个数据表,假设我有100个姓名,有以下两个方法,
方法1:
把100个Name 组成一个SQL语句,比如 Select * from tmp_table where Name='张三' or Name ='李四' Or ...Or Name='第一百个姓名'
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号