could you help me with the following question?
I would like to deliver a table to a view based on the given query band value for variable "Language":
Is it possible to implement this logic somewhere in Teradata without using Java or c?
I got stuck whith UDFs when reading this: http://stackoverflow.com/questions/19184573/how-do-i-write-a-table-valued-function-in-teradata
Here is the logic I would like to apply (it got lost in the original post):
WHEN GetQueryBandValue(0,'Language') = 'French' THEN SELECT * FROM myTable_French
WHEN GetQueryBandValue(0,'Language') = 'English' THEN SELECT * FROM myTable_English
As far as I know , it cannot be done, query band test and then do a select..... :)
Let us hear from other who may have done this.
In sql udf, only simple test we can do ....I think.
I assume that these tables contain error messages, or some other kind of text that is displayed for the user?
It would be simpler to use a single table, and distinguish each row in the table with a language code. I strongly recommend combining the tables together.
However, if you cannot permanently combine the tables for some reason, you can create a view that simulates the tables being combined. Using a view like this may be lower performance that if the tables were actually combined.
create view myViewAllLanguages(LangCode, c1, c2, c3, ...) as
select 'EN', c1, c2, c3, ... from myTable_English
select 'FR', c1, c2, c3, ... from myTable_French
After you have a combined table or a view that simulates a combined table, then you can easily refer to a query band value in a WHERE clause.
select * from myViewAllLanguages where LangCode = GetQueryBandValue(0, 'Language')