using FUNCTION instead of CREATE FUNCTION oracle pl/sql
I see people writing a fu开发者_Python百科nction with FUNCTION instead "CREATE FUNCTION". When I saw this usage in the web I thought it was a typo or something. But in Oreilly's "Oracle 11g PL/SQL Programming" by Steven Feurenstein, the author had used the same thing. But I get errors when I execute that. Could somebody explain is it legal usage or not?. Thanks.
It depends on the context.
To create a standalone function, you would use CREATE FUNCTION ...
or CREATE OR REPLACE FUNCTION ...
.
To declare a function within a package or type body, you would use FUNCTION ...
.
The CREATE
keyword is a command, FUNCTION
is the type of the object to be created.
Quite often the CREATE
is omitted because a function may be specified in several different ways, and there is no need to enumerate them all.
精彩评论