How to generate object DDL, like the CLI “show” command does

teradata

When we run the show command, e.g. show table db.tablename; show view db.viewname, it lists the object definition. I believe it will query the dictionary tables and rebuild .

Could you help us to understand how it queries the internal tables?

Best Answer

For a SHOW TABLE the parser actually creates the CREATE TABLE based on the current definition.

But for SHOW VIEW, etc. it's retrieving the CREATE from dbc.TablesV.RequestText. If the source code is larger than 12.5 KB RequestTxtOverFlow is set and the remainder is found in one or more 32 KB chunks in dbc.TextTbl.

For SHOW PROCEDURE it's different, this returns the internally stored sorce code (unless the SP is created with the NOSPL option), there's no way to access this info using a Select.

Related Question