views:

88

answers:

1

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.

http://stackoverflow.com/questions/2338408/is-vs-as-keywords-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.

+3  A: 

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

Jeffrey Kemp
+1 for the confusing explanation ;-)
Robert Merkwürdigeliebe
Thanks again!. :-)
sqlgrasshopper5
Or as Bill Clinton once observed, "it depends on what the meaning of the word 'is' is" : http://www.youtube.com/watch?v=j4XT-l-_3y0
APC