Table of Contents Previous Next


3 The SQL Language : 3.3 SQL Commands : 3.3.33 CREATE TYPE BODY

CREATE TYPE BODY -- define a new object type body
method_spec [...]
where method_spec is:
subprogram_spec
and subprogram_spec is:
{ PROCEDURE proc_name
[, argname [ IN | IN OUT | OUT ] argtype
program_body
FUNCTION func_name
[, argname [ IN | IN OUT | OUT ] argtype
RETURN rettype
program_body
CREATE TYPE BODY defines a new object type body. CREATE OR REPLACE TYPE BODY will either create a new object type body, or replace an existing body.
See Section 8.2.2 for more information on the object type body.
MEMBER
STATIC
Specify MEMBER if the subprogram operates on an object instance. Specify STATIC if the subprogram operates independently of any particular object instance.
For a member method there is an implicit, built-in parameter named SELF whose data type is that of the object type being defined. SELF refers to the object instance that is currently invoking the method. SELF can be explicitly declared as an IN or IN OUT parameter in the parameter list. If explicitly declared, SELF must be the first parameter in the parameter list. If SELF is not explicitly declared, its parameter mode defaults to IN OUT for member procedures and IN for member functions.
Supplies a default value for an input argument if one is not supplied in the method call. DEFAULT may not be specified for arguments with modes IN OUT or OUT.
The declarations and SPL statements that comprise the body of the function or procedure.
The return data type, which may be any of the types listed for argtype. As for argtype, a length must not be specified for rettype.
Create the object type body for object type emp_obj_typ given in the example for the CREATE TYPE command.
Create the object type body for object type dept_obj_typ given in the example for the CREATE TYPE command.

3 The SQL Language : 3.3 SQL Commands : 3.3.33 CREATE TYPE BODY

Table of Contents Previous Next