using a variable in aster teradata connectors

Aster

using a variable in aster teradata connectors

Hi,

   a>     How can I define a variable?

let’s say if I have a value which needs to be used in multiple load_from_teradata  SQL’s

i.e like variable X= value, 

if I need to run below kind of multiple queries , how can I achieve this?

           CREATE ANALYTIC TABLE ABC AS

SELECT * FROM load_from_teradata (

ON mr_driver

TDPID('dbc')

USERNAME('xxx')

PASSWORD('yyy')

QUERY ('select * from ABC where columnA > X'));

            CREATE ANALYTIC TABLE PQR AS

SELECT * FROM load_from_teradata (

ON mr_driver

TDPID('dbc')

USERNAME('xxx')

PASSWORD('yyy')

QUERY ('select * from PQR where columnA > X'));

 

 

 

b>Related to or extension of above question, can I use the result of an aster SQL inside the load_from_teradata query

In other words can I combine aster and teradata SQL’s in single statement, i..e use the result of aster to pull data from teradata .

i.e in above example let’s say X value has to be queried from the aster table , can we do this?

1 REPLY
Teradata Employee

Re: using a variable in aster teradata connectors

It depends on what app you are using to run your queries.

Most apps have a way to specify a variable.

For example, in SQL Assistant you would use a 'named parameter' such as ?X.

The where clause would be

    where columnA > ?X

or

    where columnA > '?X'

depending on whether the value was numeric or character.

SQLA would ask you for the value (only one time even though it is used twice) whenever you execute the query.