teradata

Create a recursive view that has a “with recursive” statement in Teradata

天大地大妈咪最大 提交于 2019-12-23 08:36:28
问题 I would like to create a recursive view in Teradata (i.e., CREATE RECURSIVE VIEW ) from the following reproducible example: CREATE VOLATILE TABLE vt1 ( foo VARCHAR(10) , counter INTEGER , bar INTEGER ) ON COMMIT PRESERVE ROWS; INSERT INTO vt1 VALUES ('a', 1, '1'); INSERT INTO vt1 VALUES ('a', 2, '2'); INSERT INTO vt1 VALUES ('a', 3, '2'); INSERT INTO vt1 VALUES ('a', 4, '4'); INSERT INTO vt1 VALUES ('a', 5, '1'); INSERT INTO vt1 VALUES ('b', 1, '3'); INSERT INTO vt1 VALUES ('b', 2, '1');

How to group/List all nodes of a undirected graph using teradata sql

限于喜欢 提交于 2019-12-23 05:00:49
问题 I have data for many diff. set of undirected graphs in a table (like adjacent list relationship, one node is connected which all node) and I need to group all individual undirected graphs. Eg: all nodes of the particular undirected graphs will be in a group & group name will be the min. of the node. sel d.adj_node, min(d.adj_node) Over (Partition By a.node) as grp table a left join table b on a.adj_node=b.node left join table c on b.adj_node=c.node ​left join table d ​on c.adj_node=d.node​;

PIVOT implementation in TD

纵然是瞬间 提交于 2019-12-23 04:52:06
问题 I want to pivot my data and i am aware that we have Pivot function in teradata 16. I am not sure how to use it. I am aware of other methods like max(case...) but my data set is large so i can't use that. Can anyone tell me how to use pivot here: SERV_PROVIDER_ID CALL_START_DT cnt1 50003 4/15/2018 25,117 50003 4/16/2018 65,630 50003 4/17/2018 63,880 50003 4/18/2018 40,080 Want data like SERV_PRIDER_ID CALL_START_DT1 CNT1 CALL_START_DT2 CNT2 CALL_START_DT3 CNT3 I am only looking for 4 days data

Implement aggregation in Teradata

爱⌒轻易说出口 提交于 2019-12-23 04:41:33
问题 I want to aggregate 2 fields proct_dt, dw_job_id in ascendinng order My scenario would be clear by using below queries and result. First query :- sel * from scratch.COGIPF_RUNREPORT_test1 order by proct_dt,dw_job_id where dw_job_id =10309 Output :- dw_job_id proct_dt start_ts end_ts time_diff 1 10,309 2018-03-06 00:00:00 2018-03-06 07:04:18 2018-03-06 07:04:22.457000 0 2 10,309 2018-03-06 00:00:00 2018-03-06 06:58:50 2018-03-06 06:58:51.029000 0 3 10,309 2018-03-07 00:00:00 2018-03-07 06:35

Implement aggregation in Teradata

拥有回忆 提交于 2019-12-23 04:41:08
问题 I want to aggregate 2 fields proct_dt, dw_job_id in ascendinng order My scenario would be clear by using below queries and result. First query :- sel * from scratch.COGIPF_RUNREPORT_test1 order by proct_dt,dw_job_id where dw_job_id =10309 Output :- dw_job_id proct_dt start_ts end_ts time_diff 1 10,309 2018-03-06 00:00:00 2018-03-06 07:04:18 2018-03-06 07:04:22.457000 0 2 10,309 2018-03-06 00:00:00 2018-03-06 06:58:50 2018-03-06 06:58:51.029000 0 3 10,309 2018-03-07 00:00:00 2018-03-07 06:35

How can I lock a table for read and write so I can execute SQL and then remove the locks afterward?

我的未来我决定 提交于 2019-12-23 04:00:22
问题 I am just now starting to dig into Teradata's locking features and Google is fairly convoluted with explanations on this. Hopefully, I can get a very simple and streamlined answer from SE. After encountering numerous issues with identity columns in Teradata, I've decided to create a mechanism that mimics Oracle's sequence. To do this, I am creating a table with two fields, one that holds a table name and the other that stores its last-used sequence. I am going to then create a stored

ODBC Teradata Driver HY001 Memory allocation error. What is the meaning?

戏子无情 提交于 2019-12-22 19:12:23
问题 I am using the python script that inserts a batch of data into Teradata using the teradata python module with a script similar to the one below. It uses an ODBC connection and occasionally I get the following error: [HY001][Teradata][ODBC Teradata Driver] Memory allocation error . What does this error mean? And any suggestions on how to fix this? connection.executemany( 'INSERT INTO {}.{} ("{}") VALUES ({})' .format(database, table_name, '","'.join(column_names), ','.join(['?']*len(columns

How to group substrings in Teradata 14?

巧了我就是萌 提交于 2019-12-22 09:26:45
问题 I have the following table in Teradata 14 , I am not allowed to write procedures and functions myself, but i can use strtok , strtok_split_to_table etc id property 1 1234X (Yel), 2225Y (Red), 1234X (Gre), 2 3 1222Y (Pin), 4 1134E (Yel), 4565Y (Whi), 1134E (Red), 2222Y (Red), How can I group the above table so that each object would have all attributes listed in one brackets id property 1 1234X (Yel Gre), 2225Y (Red), 2 3 1222Y (Pin ), 4 1134E (Yel Red), 4565Y (Whi), 2222Y (Red), The property

Teradata Volatile Table Statement is not creating any rows

↘锁芯ラ 提交于 2019-12-21 04:42:32
问题 I want to create table in Teradata. Therefore I am using this syntax: CREATE VOLATILE TABLE a AS ( Select * FROM ... ) WITH DATA PRIMARY INDEX ( ACCOUNT_ID ) ; The inner SELECT statement results in 4 rows. However, when I run the entire query, the resulting data set does not have any rows. Strange, I know - that`s why I'm writing. Please help. Thanks. 回答1: You need to include the ON COMMIT PRESERVE ROWS option with your DDL for the volatile table: CREATE VOLATILE TABLE a AS ( Select * FROM ..

Move data from oracle to HDFS, process and move to Teradata from HDFS

扶醉桌前 提交于 2019-12-21 04:41:07
问题 My requirement is to Move data from Oracle to HDFS Process the data on HDFS Move processed data to Teradata. It is also required to do this entire processing every 15 minutes. The volume of source data may be close to 50 GB and the processed data also may be the same. After searching a lot on the internet, i found that ORAOOP to move data from Oracle to HDFS (Have the code withing the shell script and schedule it to run at the required interval). Do large scale processing either by Custom