Archives of the TeradataForum
Message Posted: Tue, 21 Aug 2007 @ 20:26:55 GMT
I have a requirement where I need to run one SQL the o/p of which is a again a SQL statement. I need to submit the O/p again as a query and pass the reulst to the user. I have to do this using a ODBC connection for a front end application.
For example :-Consider a query of the form
SELECT 'SELECT * FROM MARKETING_DB.'||TRIM(TABLENAME)||';' FROM DBC.TABLES WHERE DATABASE_NAME='MARKETING_DB' And CREATETIMESTAMP=(SELECT MAX(CREATETIMESTAMP) FROM DBC.TABLES WHERE DATABASENAME='MARKETING_DB');
So O/p may be something like
SELECT * FROM MARKETING_DB.ABCDEFG;
SO this O/p needs to be run again and the results needs to be presented to the user.
This is a oversimplified version of my problem which can be easily solved by parameterizing. But for me the o/p of first SQL is a SQL with many unions and where clauses which are created on fly.
Any help on this would be appreciated.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|