× 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.



I have a stored SQL procedure that normalizes data elements from one file into a temporary table.
For example, non-normalized data looks like this...

Order Number    Shipment Numbers
1                    A    B    C    D    E
2                    A    B
3                    A    B    C
4
5                    Z    Y    X

Would result in normalized data, in the new table in QTEMP.

Order Number    Shipment Number
1                    A
1                    B
1                    C
1                    D
1                    E
2                    A
2                    B
3                    A
3                    B
3                    C
5                    Z
5                    Y
5                    X

Now comes the problem. I want to include this normalized data from QTEMP into an SQL view.
I get SQL7008    FileName in QTEMP not valid for operation
My read of the supporting message description is that you can't use a table in QTEMP as part of a view.

Now I'm wondering if I can use the WITH SQL statement (using a CTE) in the view definition. I've never used CTE but my understanding of it is that the WITH AS is basically informing SQL of a table that will be used in the following compound SQL statement is defined as the WITH AS segment defines it. If that is right, then how/where does my stored procedure come in that actually builds that QTEMP file?

You're probably thinking, why not just create the normalized table as a permanent table in a standard library? The problem there is that the file of non-normalized data can be updated at any time, necessitating a rebuild of the normalized data table. If that normalized table is in use by another user, it would be unable to be rebuilt. At best, it would be inaccurate.

Any ideas/thoughts?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.