Archives of the TeradataForum
Message Posted: Mon, 06 Dec 2004 @ 15:37:18 GMT
Subj: | | Re: Variable Declarations in Queryman |
|
From: | | Brian.Jones |
Allan -
To use my own vars I've created a table that contains all my variables and I refer to it in my queries. For example, the queries below first
build a table with a column named "start_date". Then, a date is inserted into the table. The final query uses that date in the where
statement.
See what you think. - Brian
CREATE TABLE QMTBLS.BKJ_VARS
,FALLBACK
,NO BEFORE JOURNAL
,NO AFTER JOURNAL
(
START_DATE DATE FORMAT 'YYYY/MM/DD'
)
PRIMARY INDEX(START_DATE);
INSERT INTO QMTBLS.BKJ_VARS
(START_DATE)
VALUES ('2004-11-01');
SELECT * FROM QMTBLS.BKJ_VARS;
SELECT
*
FROM
CUSTOMER_TABLE
WHERE
ACTIVATION_DATE > (SELECT START_DATE FROM QMTBLS.BKJ_VARS);
|