Example of wrap operator - sql, PL-SQL Programming

Example of WRAP Operator - SQL

The effect of Example can be obtained in SQL but note that one needs to write down not only the names of the columns being wrapped but also the names and declared types of the columns not being wrapped.

Example: Collecting column values together

SELECT Name, Phone, Email,

CAST (ROW (House, Street, City, Zip) AS

ROW (House VARCHAR (100), Street VARCHAR (100),

City VARCHAR (100), Zip VARCHAR (10)))

AS Address

FROM CONTACT_INFO

As before, we need to use CAST because the result of an invocation of ROW has unnamed fields. The example assumes, therefore, a definition such as the following for the base table CONTACT_INFO:

CREATE TABLE CONTACT_INFO (Name VARCHAR (100) PRIMARY KEY,

Phone VARCHAR (15) NOT NULL,

Email VARCHAR (50) NOT NULL,

House VARCHAR (100) NOT NULL,

Street VARCHAR (100) NOT NULL,

City VARCHAR (100) NOT NULL,

Zip VARCHAR (10) NOT NULL,);

SQL has no shorthand similar neither to WRAP, nor for UNWRAP.

Posted Date: 1/18/2013 7:00:15 AM | Location : United States







Related Discussions:- Example of wrap operator - sql, Assignment Help, Ask Question on Example of wrap operator - sql, Get Answer, Expert's Help, Example of wrap operator - sql Discussions

Write discussion on Example of wrap operator - sql
Your posts are moderated
Related Questions
Example of WHEN or THEN Constraints A concrete example showing how SQL supports WHEN/THEN constraints CREATE TABLE SAL_HISTORY (EmpNo CHAR (6), Salary INTEGER NOT NULL,

FOR-LOOP While the number of iterations through a WHILE loop is unknown till the loop completes, then the number of iterations through a FOR loop is known before the loop is ent

Dynamic Ranges The PL/SQL lets you determine the loop range dynamically at run time, as the example below shows: SELECT COUNT(empno) INTO emp_count FROM emp; FOR i IN 1..emp_cou

OUT Mode An OUT parameter returns values to the caller of a subprogram. Within the subprogram, an OUT parameter act like a variable. That means that you can use an OUT formal

EXIT Statement   You can use the EXIT statement to exit a loop. The EXIT statement has 2 forms: the conditional EXIT WHEN and the unconditional EXIT. With the either form, you

I want someone to write a TSQL function that returns the name of the ODBC DSN. I will use the queries below, to get information about the connection, but none of these return th

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Synonyms You can create the synonyms to provide location transparency for the remote schema objects like tables, views, sequences, stand-alone subprograms, and packages. Though,

Sequential Control Dissimilar to the IF and LOOP statements, the GOTO and NULL statements are not important to the PL/SQL programming. The configuration of PL/SQL is such that th

Using EXISTS The EXISTS(n) returns TRUE if the nth element in a collection exist. Or else, EXISTS(n) returns FALSE. Primarily, you use EXISTS with DELETE to maintain the spars