First Step at defining type SID in SQL
CREATE TYPE SID AS ( C VARCHAR(5) ) ;
So-called constructor function, in this case a niladic operator named SID, is generated by the structure definition, such that SID() denotes the value of type SID whose only component is the "default value" for the attribute C, probably NULL. SID selector we need to use the so-called mutator function for the attribute C, which is also invoked using dot notation: SID().C('S1'). The mutator function takes a value of type SID as its left operand and a value of the declared type of C as its right operand (in parentheses). In general, if s is a value of type SID, then s.C('S1') denotes the SID value that is obtained from s by replacing its C component by the string 'S1'. If s had any other components (it doesn't, of course), they would be retained in s.C('S1'). By the way, don't be misled by the term "mutator": an SQL mutator function is a read-only operator.