Teradata. I have been using Oracle for quite a bit. However, when I tried to run the following queries in
Teradata, they simply did not work. How can I translate the following queries into
select Table_name, constraint_name, constraint_type, r_constraint_name, Delete_rule, search_condition from user_constraints order by table_name, constraint_name; select object_name, object_id, Object_type, Created, last_DDL_time, status from user_Objects order by object_name; select table_name, column_name, data_type, data_length, data_precision, nullable, column_id, data_default from user_tab_columns order by table_name, column_name;
preguntado el 09 de septiembre de 13 a las 21:09
For most system views there are several versions, those ending with "X" are similar to Oracle's "user_" views, without "X" it's "all_", p.ej:
dbc.Tables: old version, deprecated since TD12 dbc.TablesX: old version, deprecated since TD12 dbc.TablesV: recommended version, all objects in all databases dbc.TablesVX: recommended version, objects where the submitting user has any access right
The different constraint types are stored in different places in Teradata.
Foreign Keys: dbc.All_ri_childrenV
Table level CHECK: dbc.Table_LevelConstraintsV
Column level CHECK: dbc.ColumnsV.ColumnConstraint
Primary Key: dbc.IndicesV.IndexType = 'K'
Unique: dbc.IndicesV.IndexType = 'U'
Pero, you might notice that not all Primary/Foreign Keys and Unique constraints are implemented in your environment to avoid additional overhead as this is already maintained by the load process (this is the same for Teradata or any other Data Warehouse).
In teradata most metadata information is held in dbc..
objects in oracle might map to dbc.tables.
select * from dbc.tables.
para el último:
SELECT tablename, columnname, columntype, columnformat, columnlength, Nullable, columnid,defaultvalue FROM dbc.columns
I am looking to fulfill the user_constraints,will update once I find something.
Hope the above is helpful.