Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Variable declaration

$
0
0
Is it possible to declare all this part in a variable declaration ?
TIMESTAMP(current date, TIME('00.00.00')) - 15 MONTHS + 1 DAYS

I have many delete statements in my script and I want to reuse it in a variable.
For ex:
CREATE VARIABLE D_TIME TIME;

SET D_TIME = TIMESTAMP(current date, TIME('00.00.00')) - 15 MONTHS + 1DAYS;

DELETE from U_ContactAttr where (EnvelopeID,ContainerID) in
(select EnvelopeID,ContainerID from U_Envelope where ContactDateTime < DTIME);

DELETE from U_Contact where (EnvelopeID,ContainerID) in
(select EnvelopeID,ContainerID from U_Envelope where ContactDateTime < DTIME);

DROP VARIABLE D_TIME;

COMMIT;

Viewing all articles
Browse latest Browse all 13329

Trending Articles