Typed views
CREATE TABLE emp
( name VARCHAR(30),
age INTEGER,
salary INTEGER);
CREATE ROW TYPE name_age_t
( name VARCHAR(20),
age INTEGER);
CREATE VIEW name_age OF TYPE name_age_t AS
SELECT name, age FROM emp;
CREATE ROW TYPE name_salary_t
( name VARCHAR(20),
salary INTEGER);
CREATE VIEW name_salary OF TYPE name_salary_t AS
SELECT name, salary FROM emp
When you create a typed view, the data that the view displays is of a named row type. For example, the name_age and name_salary views contain VARCHAR and INTEGER data. Because the views are typed, a query against the name_age view returns a column view of type name_age whereas a query against the name_salary view returns a column view of type name_salary. Consequently, the database server is able to distinguish between rows that the name_age and name_salary views return.
CREATE FUNCTION myfunc(aa name_age_t) ......;
CREATE FUNCTION myfunc(aa name_salary_t) .....;
SELECT myfunc(name_age) FROM name_age;
SELECT myfunc(name_salary) FROM name_salary;
SELECT myfunc(p) FROM name_age p;
SELECT myfunc(p) FROM name_salary p;
If two views that contain the same data types are not created as typed views, the database server cannot distinguish between the rows that the two views display. For more information about function overloading, see IBM® Informix® User-Defined Routines and Data Types Developer's Guide.