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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:39:19  来源:igfitidea点击:

is versus as pl/sql

oracleplsqlsemantics

提问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, ASis not always allowed where ISis, and ISis not always allowed where ASis :)

因此,AS并不总是允许 where ISis,IS也不总是允许 where ASis :)

Just one of those quirks of the language, I think. Generally, ISis more common, I think, except where ASis 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:

参考:

Oracle SQL Reference 11gR1

Oracle SQL 参考 11gR1

Oracle PL/SQL Reference 11gR1

Oracle PL/SQL 参考 11gR1