oracle is 与 as pl/sql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2855087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
is versus as pl/sql
提问by sqlgrasshopper5
I thought that oracle treats both "is" and "as" same for functions and procedures.I tried googling with "pl/sql is vs as" and got the following link which says both are the same.
我认为 oracle 将“is”和“as”都视为函数和过程。我尝试使用“pl/sql is vs as”进行谷歌搜索,并得到以下链接,上面说两者是相同的。
IS vs AS keywords for PL/SQL Oracle Function or Procedure Creation
PL/SQL Oracle 函数或过程创建的 IS 与 AS 关键字
But I found http://www.adp-gmbh.ch/ora/plsql/coll/declaration.html#index_bywhich seems to indicate there is a difference. Could somebody (list/point me to a link) the other contexts where using "is/as" makes a difference?.
但我发现http://www.adp-gmbh.ch/ora/plsql/coll/declaration.html#index_by这似乎表明存在差异。有人可以(列出/指向我的链接)使用“is/as”会有所不同的其他上下文吗?。
Thanks.
谢谢。
回答by Jeffrey Kemp
By example (not all are PL/SQL):
举个例子(不是所有的都是 PL/SQL):
[CREATE] PROCEDURE x IS|AS ...
[CREATE] FUNCTION x IS|AS ...
CREATE PACKAGE [BODY] x IS|AS ...
CREATE TYPE [BODY] x IS|AS ...
CURSOR x IS ...
TYPE x IS ...
SUBTYPE x IS ...
CREATE TABLE x AS subquery
SELECT x AS "y" FROM z AS "w"
WITH x AS (SELECT ...
Therefore, AS
is not always allowed where IS
is, and IS
is not always allowed where AS
is :)
因此,AS
并不总是允许 where IS
is,IS
也不总是允许 where AS
is :)
Just one of those quirks of the language, I think. Generally, IS
is more common, I think, except where AS
is the only option (as in the SQL examples above). Most of the examples in the Oracle docs seem to use IS
, and personally that's my preference as it fits better semantically, in my opinion.
我认为这只是语言的那些怪癖之一。一般来说,IS
我认为更常见,除了 whereAS
是唯一的选项(如上面的 SQL 示例)。Oracle 文档中的大多数示例似乎都使用IS
,我个人认为这是我的偏好,因为它在语义上更适合。
References:
参考: