T321, Basic SQL-invoked routines


The specification states the following:

 Subclause 11.60, "<SQL-invoked routine>":
 NOTE — "Routine" is the collective term for functions, methods, and procedures. This feature requires a conforming SQL-implementation to support both user-defined functions and user-defined procedures. An SQL-implementation that conforms to Core SQL shall support at least one language for writing routines; that language may be SQL. If the language is SQL, then the basic specification capability in Core SQL is the ability to specify a one-statement routine. Support for overloaded functions and procedures is not part of Core SQL.
 <SQL-invoked routine> ::=
 <schema routine>
 <schema routine> ::=
 <schema procedure>
 | <schema function>
 <schema procedure> ::=
 CREATE <SQL-invoked procedure>
 <schema function> ::=
 CREATE <SQL-invoked function>
 <SQL-invoked procedure> ::=
 PROCEDURE <schema qualified routine name> <SQL parameter declaration list>
 <routine characteristics>
 <routine body>
 <SQL parameter declaration list> ::=
 <left paren> [ <SQL parameter declaration>
 [ { <comma> <SQL parameter declaration> }... ] ] <right paren>
 <SQL parameter declaration> ::=
 [ <parameter mode> ] [ <SQL parameter name> ] <parameter type> [ RESULT ]
 <parameter mode> ::=
 | OUT
 Subclause 11.62, "<drop routine statement>" — If Feature T041, "Basic LOB data type support", is supported, then the <locator indication> clause shall also be supported
 <drop routine statement> ::=
 DROP <specific routine designator> <drop behavior>

Microsoft SQL Server 2008 R2 and Microsoft SQL Server 2012 vary as follows:

Transact-SQL partially supports this feature. The Transact-SQL CREATE FUNCTION and CREATE PROCEDURE statements do not support the IN, INOUT, or LANGUAGE keywords.