DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: what's the difference between create function f_name is and create function f_name as

  1. #1
    Join Date
    Dec 2002
    Posts
    2

    what's the difference between create function f_name is and create function f_name as

    thanks in advance.

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    Coding convention. Procedure is as, function is is is a general rule of thumb. Either way is acceptable with respect to syntax.

  3. #3
    Join Date
    Dec 2002
    Posts
    2
    thank you.

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by stecal
    Coding convention. Procedure is as, function is is is a general rule of thumb. Either way is acceptable with respect to syntax.
    Agree, merely a coding convention. I do not agree in the above "general role of thumb", though. IS and AS were both introduced (and allowed) not to distinguish between functions and procedures, but rather for the commands that use them to sound as natural English.

    When you create a standalone function, you use CREATE FUNCTION clause and with this the natural word to be used in English is AS.

    It sunds much more naturaly with AS:
    Code:
    CREATE PROCEDURE/FUNCTION foo AS ....
    than with IS:
    Code:
    CREATE PROCEDURE/FUNCTION foo IS ....
    In other words, in English you "create something AS blahblah", not "create something IS blahblah".

    But on the other hand, inside a package you don't use the word CREATE when specifying functions and procedures, so it is much more naturaly to use IS:
    Code:
    CREATE PACKAGE BODY foo_pack AS
      PROCEDURE foo1 IS ....
      PROCEDURE foo2 IS ....
      ...
    instead of unnatural use of word AS:
    Code:
    CREATE PACKAGE BODY foo_pack AS
      PROCEDURE foo1 AS ....
      PROCEDURE foo2 AS ....
      ...
    In plain English, "something IS blahblah", not "soemthing AS blahblah".

    So a general rule of thumb (IMHO) should be: When you use a reserved word CREATE then use the word AS with it. When you don't use word CREATE (inside packages) you should use the word IS.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #5
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,684
    If you're common you use the following syntax:

    CREATE PROCEDURE x LIKE WHAT THIS BELOW IS
    BEGIN

    END;
    /

    Tim...
    OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
    OCA PL/SQL Developer
    Oracle ACE Director
    My website: oracle-base.com
    My blog: oracle-base.com/blog

  6. #6
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Also, "IS NOT" = "AINT"

    eg. "... where username aint null"
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width