For structured UDTs only, .ALL specifies that the individual attribute values for a specified table or column name are to be returned.
Syntax Elements
- table_name
- Name of a table for which all the attributes of all its structured UDT columns are to be returned.
- column_name
- Name of a structured UDT column for which all its attributes are to be returned.
- .ALL
- All attributes for the specified UDT column or for all structured UDT columns in the specified table are to be returned in the results of the expression list.
ANSI Compliance
.ALL is a Teradata extension to the ANSI SQL:2011 SQL standard.
.ALL Operator and Structured UDTs
If a column has a structured UDT data type, then the values of its individual attributes are returned when you specify the .ALL option.
- *.ALL
- table_name.*.ALL
If you specify this syntax, but the specified column does not have a structured UDT type, the specification is disregarded:
column_name.ALL
Example: Using the .ALL Operator With Structured UDTs
The following UDT and table definitions are for the *.ALL operator examples below.
CREATE TYPE school_record AS ( school_name VARCHAR(20), GPA FLOAT) INSTANTIABLE … CREATE TYPE college_record AS ( school school_record, major VARCHAR(20), minor VARCHAR(20)) INSTANTIABLE … CREATE TABLE student_record ( student_id INTEGER, Last_name VARCHAR(20), First_name VARCHAR(20), high_school school_record, college college_record);
Example 1a: Using *.ALL to Retrieve All Table Columns, Expanding the Structured Types
This example shows a pair of SELECT statements that return equivalent response sets. The only difference is that one statement uses the *.ALL notation and the other does not.
SELECT *.ALL FROM student_record;
The following equivalent SELECT statement does not use the *.ALL notation:
SELECT student_id, last_name, first_name, high_school.school_name(), high_school.GPA(), college.school().school_name(), college.school().GPA(), college.major(), college.minor() FROM student_record;
Example 1b: Using *.ALL to Retrieve the Expanded Structured Type for a Single UDT Column
Use *.ALL to retrieve all columns of the table student_record where the structured type columns high_school and college are expanded:
SELECT student_record.*.ALL;
The following equivalent SELECT statement does not use the *.ALL notation:
SELECT student_record.student_id, student_record.last_name, student_record.first_name, student_record.high_school.school_name(), student_record.high_school.GPA(), student_record.college.school().school_name(), student_record.college.school().GPA(), student_record.college.major(), student_record.college.minor();
Example 1c: Using *.ALL to Retrieve the Expanded Structure Type for Multiple UDT Columns
Retrieve high school names and grade point averages of all students:
SELECT high_school.ALL FROM student_record;
The following equivalent SELECT statement does not use the .ALL notation:
SELECT high_school.school_name(), high_school.GPA() FROM student_record;
Example 1d: Selecting the Information For Only One Student From a UDT
Retrieve the college name, GPA, major, and minor of student 'Steven Smith':
SELECT s.college.ALL FROM student_record s WHERE s.student.First_name() = 'Steven' AND s.student.Last_name() = 'Smith';
The following equivalent SELECT statement does not use the .ALL notation:
SELECT s.college.school().school_name(), s.college.school().GPA(), s.college.major(), s.college.minor() FROM student_record s WHERE s.student.first_name() = 'Steven' AND s.student.last_name() = 'Smith';