-
what's the difference between create function f_name is and create function f_name as
-
Coding convention. Procedure is as, function is is is a general rule of thumb. Either way is acceptable with respect to syntax.
-
-
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?
-
If you're common you use the following syntax:
CREATE PROCEDURE x LIKE WHAT THIS BELOW IS
BEGIN
END;
/
-
Also, "IS NOT" = "AINT"
eg. "... where username aint null"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|