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
Implicit Rollbacks Before execute the INSERT, UPDATE, or DELETE statement, the Oracle marks an implicit savepoint . When the statement fails, the Oracle rolls back to the save

How Bulk Binds Improve Performance The assigning of values to the PL/SQL variables in SQL statements is known as binding. The binding of the whole collection at once is know

Expressions   An expression is a randomly complex combination of the constants, variables, literals, operators, & function calls. The simplest expression is the single variabl

Using SAVEPOINT The SAVEPOINT names and marks the present point in the processing of a transaction. Used with the ROLLBACK TO statement, the savepoints undo parts of a transac

Using RENAME in combination with JOIN - SQL Example gives pairs of ids of students having the same name, by joining two renamings of IS_CALLED. Example gives an equivalent ex

THEORY OF SPONTANEOUS GENERATION - ABIOGENESIS OR AUTOGENESIS - According to this theory, the existing living communities have originated from non-living organic matter with

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Updating Objects: To change the attributes of objects in an object table, you can use the UPDATE statement, as the illustration below shows: BEGIN UPDATE persons p SET p

DELETE Command - SQL Loosely speaking, DELETE removes some existing rows from its target table. Suppose the university decides that course C3 is to be withdrawn. Example shows

On occasion, some of Brewbean's customers mistakenly leave an item out of a basket already checked out, so they create a new basket containing the missing items. However, they requ