QUESTION POSED ON: 20 May 2005
Is there a way to create a SQL view where fields are dynamically obtained each time the View is used. I am trying to do an analogy with the Logical Files ability to handle not mapped fields, and each time the Physical File is modified, the Logical one reflects the change without any DDS change for their structure.
For example:
Step 1 -- I created a table (testtable) with four fields (i.e. field1, field2, field3, field4)
Step 2 --I created two SQL views, using the following SQL statements:
CREATE VIEW library/testview1 AS SELECT field1,field2,field3,field4 FROM library/testtable;
CREATE VIEW library/testview2 AS SELECT * FROM library/testtable
Step 3 -- I added a field (i.e. field5) to the
Step 4 -- I ran a query SELECT from both views, and both of them gave me the same result, in this case only the four fields. When I ran the query for the testview2, I wanted to see the field5 in the given result, however, it appears the structure's view is taken solving the SELECT * statement and remains static forever.
As you can see, a SQL view doesn't have the same behavior as a native OS/400 Logical File, due to the LF offer the ability to reference fields in a static or dynamic way.
|