Hello -
2 questions please:
(1) How do I declare and use a variable? In the code below, I'm looking to declare a variable and use it in a WHERE statement..
DECLARE vsor_id CHAR(7);
SET vsor_id = 'V','I';
SELECT
count(*)
FROM
bkj_churn_def
WHERE
sor_id in vsor_id);
/* The actual code is*/
SELECT
count(*)
FROM
bkj_churn_def
WHERE
sor_id in ('V','I');
However, I'm getting a syntax error: 3706: syntax error: expected something between the beginning of the request and the 'DECLARE' keyword.
How can I resolve?
(2) What terdata reference books would you recommend besides "Teradata SQL Unleash the Power" by Larkins & Coffing?
Thank you.
2 questions please:
(1) How do I declare and use a variable? In the code below, I'm looking to declare a variable and use it in a WHERE statement..
DECLARE vsor_id CHAR(7);
SET vsor_id = 'V','I';
SELECT
count(*)
FROM
bkj_churn_def
WHERE
sor_id in vsor_id);
/* The actual code is*/
SELECT
count(*)
FROM
bkj_churn_def
WHERE
sor_id in ('V','I');
However, I'm getting a syntax error: 3706: syntax error: expected something between the beginning of the request and the 'DECLARE' keyword.
How can I resolve?
(2) What terdata reference books would you recommend besides "Teradata SQL Unleash the Power" by Larkins & Coffing?
Thank you.