开发者

is versus as pl/sql [duplicate]

This question already has answers here: What is the difference between "AS" and "IS" in an Oracle stored procedure? (6 answers) Closed 9 years ago.

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.

IS vs AS keywords开发者_StackOverflow社区 for PL/SQL Oracle Function or Procedure Creation

But I found http://www.adp-gmbh.ch/ora/plsql/coll/declaration.html#index_by which 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?.

Thanks.


By example (not all are 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 :)

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.

References:

Oracle SQL Reference 11gR1

Oracle PL/SQL Reference 11gR1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜