× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Buck take a look at the CREATE VIEW statement itself...

If SQL names were specified, the view will be created in the schema
specified by the implicit or explicit qualifier.

If system names were specified, the view will be created in the schema that
is specified by the qualifier. If not qualified and there is no default
schema, the view name will be created in the same schema as the first table
specified on the first FROM clause (including FROM clauses in any common
table expressions or nested table expression). If no tables are referenced
in the fullselect, the view will be created in the same schema as the first
user defined table function. If no table or user defined table function is
referenced in the fullselect, the current library (*CURLIB) will be used.

I think you're running into differences because you've got SQL & System
names intermixed.

table_master --> SQL name
view_zero --> valid system name
table_child2 --> SQL name
view_two_subselect --> SQL name

Charles

On Fri, May 20, 2016 at 3:33 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

I have a situation on 7.2 where I want to create a view without
qualifying the name. That is, I want to use the library list. I've
read the documentation at

http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/db2/rbafzqualun1.htm
which says 'For system naming, the default schema is the job library
list (*LIBL).'

I don't know what that means.

cl: chglibl (libsql1 libsql2);

-- this goes into QGPL
create table table_master
(id int,
text char(25));

-- this goes into LIBSQL1
create view view_zero
(id, text)
as (select id, text from table_master);

-- make a child table in a different library in *LIBL
create table libsql2.table_child2
(id int,
text char(25));

-- this goes into LIBSQL2
create view view_two_subselect
(m_id, m_text, c_id, c_text)
as (select m.id, m.text, m.foreign_key, (select text from table_child2)
from table_master m);

Three separate CREATE statements, three separate destinations. Is there
a reference for what is supposed to happen?

This came up because a colleague is convinced that CREATE VIEW with an
unqualified view name will put the new view into the first library in
the library list. He determined this empirically some years ago, and
got surprised today that his script put a new view farther down in the
*LIBL.

Full example script at http://code.midrange.com/c28c3aef48.html

--
--buck

Visit wiki.midrange.com and register for an account. Edit a page that
helps you, and because it's public, you'll help someone else, too!

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.