Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 658
  • Last Modified:

Materalized Query Table and {CURRENT DATE}

I'm working in SQL for AS400 iSeries V5R3 .

So, the only kind of Materialized Query Table I can build is one "MAINTAINED BY USER".
Meaning I must manually rebuild my table ...
So I have a scheduled job which starts at 6am and runs every 90 minutes until 6pm.

ONLY PROBLEM IS, I need the MQT built using TODAY's date as a logical threshhold ...
BUT ... MQT's cannot contain SPECIAL REGISTER values ... so CURRENT DATE is not allowed!

Any TRICKS on how I can build (and re-build) an MQT using TODAY's CURRENT DATE as part of the logic criteria?

0
volking
Asked:
volking
  • 2
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
How about inserting the value of CURRENT DATE into a table and building the MQT based on that value?

0
 
volkingAuthor Commented:
@Kent .... yep, I thunk that one up myself, too ... but I had hope someone had a better trick ... that might feel "LESS" like a kludge ... grin ... as a last resort, I'll do that
0
 
Kent OlsenData Warehouse Architect / DBACommented:
It's not that much of a kludge if the script goes something like this:

INSERT INTO myparams (pname, pvalue) values ('CurrentDate', CURRENT DATE);
CREATE TABLE .....
...
WHERE date = date (select pvalue from myparms where pname = 'CurrentDate');

  :)


It will almost look like there has been forethough and flexibility built into your processes.  :) :) :)


Kent

Kent
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now