views:

60

answers:

1

I see people writing a function 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.

+3  A: 

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.

Jeffrey Kemp
Thanks for the explanation.
sqlgrasshopper5