What is the difference between “AS” and “IS” in an Oracle stored procedure?

前端 未结 6 513
不思量自难忘°
不思量自难忘° 2020-11-27 12:13

I see Oracle procedures sometimes written with \"AS\", and sometimes with \"IS\" keyword.

CREATE OR REPLACE Procedure TESTUSER.KILLINSTANCE (INSTANCEID inte         


        
相关标签:
6条回答
  • 2020-11-27 12:59

    According to TutorialsPoint

    The AS keyword is used instead of the IS keyword for creating a standalone procedure.

    and considering previous answers,

    I guess

    AS is for stand alone (outside of any block, subprogram, package) entities

    and

    IS is for embedded (within a block, subprogram or package) entities.

    .

    0 讨论(0)
  • 2020-11-27 13:01

    One minor difference...

    They are synonyms for packages and procedures, but not for cursors:

    This works...

    cursor test_cursor
    is
    select * from emp;
    

    ... but this doesn't:

    cursor test_cursor
    as
    select * from emp;
    
    0 讨论(0)
  • 2020-11-27 13:05

    "IS" and "AS" act as a synonym while creating procedures and packages but not for a cursor, table or view.

    0 讨论(0)
  • 2020-11-27 13:09

    Here's another difference (in 10g, at any rate)

    Given a loose object type:

    CREATE TYPE someRecordType AS OBJECT
    (
       SomeCol VARCHAR2(12 BYTE)
    );
    

    You can create a loose Table type of this object type with either AS or IS

    CREATE OR REPLACE TYPE someTableType
            IS {or AS} TABLE OF someRecordType;
    

    However, if you create this same table type within a package, you must use IS:

    CREATE OR REPLACE PACKAGE SomePackage IS
        TYPE packageTableType IS TABLE OF someRecordType;
    END SomePackage;
    

    Use of AS in the package yields the following error:

    Error(2,30): PLS-00103: Encountered the symbol "TABLE" when expecting one of the following: object opaque

    0 讨论(0)
  • 2020-11-27 13:10

    The AS keyword is used instead of the IS keyword for creating a standalone function.

    [ A standalone stored function is a function (a subprogram that returns a single value) that is stored in the database. Note: A standalone stored function that you create with the CREATE FUNCTION statement is different from a function that you declare and define in a PL/SQL block or package. ]

    For more explanation, read this...

    0 讨论(0)
  • 2020-11-27 13:11

    None whatsover. They are synonyms supplied to make your code more readable:

    FUNCTION f IS ...

    CREATE VIEW v AS SELECT ...

    0 讨论(0)
提交回复
热议问题