Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSQL Blocks

Status
Not open for further replies.

JayHack

Programmer
Nov 10, 2002
5
US
Does Teradata support native DSQL? If I want to execute only one of say, seven different SELECT statements, nested in an if-then-else type structure, and pick this by a parameter at runtime, how do I do this? Can this be done easier with a Macro? a Command Object? some kinda native dynamic SQL in stored procedures? I also need to pass a parameter to the SELECT statement to dynamically specify the tablename in the FROM clause, like table_2003_10_20, where a date has been entered into the table name.

Thanks in advance,

jayhack
 
"If I want to execute only one of say, seven different SELECT statements, nested in an if-then-else type structure, and pick this by a parameter at runtime, how do I do this?"

There's no way to do it with SQL, but you could use BTEQ within a shell script.Just look at the next thread: Passing Parameters to TD SQL script

"some kinda native dynamic SQL in stored procedures?"

No, because you can't use SELECT within dynamic SQL.

"I also need to pass a parameter to the SELECT statement to dynamically specify the tablename in the FROM clause, like table_2003_10_20, where a date has been entered into the table name."

Can't be done with macros
see Q1

Or solve it within your application

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top