is it possible to display contents of a table through stored procedure?
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


is it possible to display contents of a table... Expand / Collapse
Author
Message
Posted 5/25/2006 9:21:53 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 1/25/2007 11:21:00 AM
Posts: 25, Visits: 1
Hello everyone,
is it is it possible to display contents of a table through stored procedure?If yes then can some one provide me with the syntax

appreciate your help

Thanks
Regards
Post #4243
Posted 5/25/2006 9:59:45 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 1/25/2007 11:21:00 AM
Posts: 25, Visits: 1
I need to pass the table name as a parameter to the stored procedure
Post #4246
Posted 5/25/2006 10:12:42 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/12/2008 4:01:17 PM
Posts: 91, Visits: 118
No you cannot do this (display the results), but you can create the table in the SP. I've heard V2R7 will have the ability to display the results but I don't know that for sure.

The standard way to do this:

Use the SP to populate a volatile table, then, maintaining the connection, read the table. When the connection closes the volatile table will be dropped.

To create the table using dynamic sql you must be the immediate owner and the creator of the sp (means sp in your own user database). Also, you must have permission to run dynamic SQL.

Hope this helps.


Post #4247
Posted 5/25/2006 10:26:12 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: PAC and SFT Members
Last Login: Today @ 11:39:58 AM
Posts: 328, Visits: 505
If the structure of the "returned" table is always the same, Global Temporary tables are easier to use for this purpose than Volatile tables. If the structure varies,
CREATE VOLATILE TABLE ... AS (SELECT ..) ...
may be useful.

If the tablename is a parameter, you'll need to build the SQL statement as a text string and use dynamic SQL [CALL DBC.SysExecSQL(...)], in which case there are some additional restrictions - notably that the creator of the stored procedure must also be the owner of the procedure; e.g. User1 issues "CREATE PROCEDURE User1.MySP ...".
Post #4248
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 12:09pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 8 queries. Compression Disabled.