On 07-Apr-2014 18:36 -0500, CENTRINO wrote:
>>> <<SNIP>>
>>
>> <<SNIP>> <ed: reinterpreted\re-represented as this faux CREATE:>
>>
>> CREATE VIEW NEWVIEW AS
>> (
>> ( SELECT * FROM TABLE A )
>> UNION ALL
>> ( SELECT * FROM TABLE B )
>> ORDER BY FIELD1
>> )
>>
>> <<SNIP>>
>
> Is it a limitation of DB2 for System I or whatever is called now ?
The concept of an ORDER BY in a VIEW is incongruous to the SQL. The
SQL _query_ defines the collation for a result set. The SQL provides no
conceptual means to "open" and read a VIEW [similar to the Row Level
Access (RLA) or ISAM Indexed\Sequential Access Method], so the order of
the rows is undefined except to the query that references the VIEW as a
table-reference. Instead, the SQL provides a query _result set_ either
via a SQL cursor or a result-table. Intuitively, for a JOIN [or a
UNION, INTERSECT, etc.] defining a SELECT to generate a result-set from
rows requested from multiple VIEWs, any implied ORDER BY in any VIEW
referenced by that query, is meaningless to the query engine.
The DB2 for i, or the DB2 for i SQL, have long been the proper
nomenclature. The OS is the IBM i [for business] although some
documentation may still refer to the i5/OS; e.g.:
<
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/dbp/rbafodb2.htm>
IBM i 7.1 Information Center -> Database -> Programming -> Database
programming -> Database file concepts
_DB2 for i_
"DB2® for i is the integrated relational database manager on the i5/OS®
operating system.
DB2 for i is part of the i5/OS operating system. ...
..."
> I understand that IBM is the creator of relational algebrae and SQL
> ... but "views capable of being ordered by" make life easier
> specially for data warehousing.
>
> Productivity goal is what I mean.
I am not clear how an ordered VIEW can make life any easier for the
SQL.? Per mention of Data Warehouse (DW), have you investigated the
Materialized Query Table (MQT) support for providing the [ordered]
result; i.e. a TABLE as the result-set?
However for use by the /native/ database, the non-SQL integrated
database [the DB2 for i; specifically not the DB2 for i SQL], for which
there is file /open/ support, an ordered result-set provided directly
from a VIEW does make sense. But as noted, the SQL which implements the
VIEW has no such support, so a database feature such as the Open Query
File (OPNQRYF) could manipulate the result-set from the VIEW as an
ordered set... thus accomplishing the desired goal, even while using the
SQL. Or the purely /native/ database file support, the DDS Logical File
(LF) could define the logical view of the data with the capability to
include a key such that indexed\ordered reads are possible.
If using purely SQL then the productivity should be typical of any
SQL development to accomplish the overall goal. And if using some SQL
for Data Definition Language (DDL) but using native\RLA to open files,
adding a query Open Data Path (ODP) is nothing out of the ordinary for
typical coding on the system since the S/38, nor is using the Data
Definition Specifications (DDS) to create the keyed Logical File (LF) to
access the physical data in the desired order.
> Thanks for your answers.
Most welcome... Hopefully they assist [both to better understand the
OS and the integrated database, and to accomplish what is required].
--
Regards, Chuck