First step at defining type sid in sql, PL-SQL Programming

First Step at defining type SID in SQL

CREATE TYPE SID AS ( C VARCHAR(5) ) ;

Explanation:

  1. TYPE SID announces that a type named SID is being defined to the system.
  2. AS ( C VARCHAR(5) ) defines SID as a structured type, whose values are represented as a structure consisting in this case of just a single attribute, named C, of type VARCHAR(5). (The term attribute here is not be confused with its use in relational theory.) The attribute definition C VARCHAR(5) causes an operator to come into existence that takes a value, of type SID and returns the value of the C component of s. The operator, SQL's counterpart of THE_C, is invoked using dot notation: s.C and is termed the observer function for the component C.

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.

Posted Date: 1/18/2013 2:38:32 AM | Location : United States







Related Discussions:- First step at defining type sid in sql, Assignment Help, Ask Question on First step at defining type sid in sql, Get Answer, Expert's Help, First step at defining type sid in sql Discussions

Write discussion on First step at defining type sid in sql
Your posts are moderated
Related Questions
Write an anonymous block that contains a PL/SQL procedure. The procedure takes two input parameter: oldZip and newZip, and it updates the zipcodes table by replacing all oldZip wit

Closing a Cursor Variable The CLOSE statement disables the cursor variable. After that, the related result set is undefined. The syntax for the same is as shown below: CLOS

1. a. Write a trigger that fires when a part's price is updated. The trigger will write a record into a table called PriceUpdates. The record should contain the information of

Exception handling In the PL/SQL, a warning or error condition is known as an exception. The Exceptions can be internally defined (by the run-time system) or user defined. The

Avoid the NOT NULL Constraint In the PL/SQL, using the NOT NULL constraint incur a performance cost. Consider the illustration as shown below: PROCEDURE calc_m IS m NUMB

Parameter and Keyword Description: EXIT: An unconditional EXIT statement (i.e., one without a WHEN clause) exits the present loop instantly. The Execution resumes with th

Great Plains (Microsoft Dynamics) Purchases Report Project Description: I want to build a purchases report that matches the General Ledger. presently, when I join the PM20

Scoping Within the similar scope, all the declared identifiers should be unique. So, even if their datatypes differ, the variables and parameters cannot share the similar name.

Parameter and Keyword Description: label_name: This is an undeclared identifier which optionally labels a loop. When used, the label_name should be enclosed by double ang

What Is a Record  ? A record is a group of related data items that stored in the fields, each with its own name and datatype. Assume that you have different data about an em