Equivalent sentence in Teradata for the Oracle "CONVERT"? - response (2) by david.craig
Getting both Teradata ODBC and Aster ODBC working together with the pyodbc Python adapter - response (5) by dvshekar
I'm also getting
teradata.api.DatabaseError: (0, u'[HY000] [Teradata][ODBC Teradata Driver] Major Status=0x04bd Minor Status=0x20800002-[terasso]Cannot load TDGSS library.')
Any help?
Teradata SQL Assistant going to Not responding state while querying a table - forum topic by MeenakshiM
Hi,
When I am querying a particular table, Teradata SQL assistant is going to not responding state . Table record count is 19K
Table structure :
CREATE SET TABLE <TABLENAME> ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
COL1 VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC,
COL2 DATE FORMAT 'YYYY-MM-DD',
COL3 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL4 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL5 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL6 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL7 VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
COL8 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL9 VARCHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,
COL10 VARCHAR(240) CHARACTER SET LATIN NOT CASESPECIFIC,
COL11 VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC,
COL12 VARCHAR(400) CHARACTER SET LATIN NOT CASESPECIFIC,
COL13 DATE FORMAT 'YYYY-MM-DD',
COL14 DATE FORMAT 'YYYY-MM-DD',
COL15 VARCHAR(4000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL16 NUMBER DEFAULT 0 ,
COL17 VARCHAR(150) CHARACTER SET LATIN NOT CASESPECIFIC,
COL18 VARCHAR(150) CHARACTER SET LATIN NOT CASESPECIFIC,
COL19 VARCHAR(80) CHARACTER SET LATIN NOT CASESPECIFIC,
COL20 VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC,
COL21 VARCHAR(260) CHARACTER SET LATIN NOT CASESPECIFIC,
COL22 VARCHAR(80) CHARACTER SET LATIN NOT CASESPECIFIC,
COL23 VARCHAR(80) CHARACTER SET LATIN NOT CASESPECIFIC,
COL24 VARCHAR(255) CHARACTER SET LATIN NOT CASESPECIFIC,
COL25 VARCHAR(80) CHARACTER SET LATIN NOT CASESPECIFIC,
COL26 VARCHAR(4000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL27 VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL28 VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL29 VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL30 VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL31 VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL32 DATE FORMAT 'YYYY-MM-DD',
COL33 DATE FORMAT 'YYYY-MM-DD',
COL34 DATE FORMAT 'YYYY-MM-DD',
COL35 NUMBER DEFAULT 0 ,
COL36 NUMBER DEFAULT 0 ,
COL37 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL38 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL39 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL40 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL41 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL42 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL43 DATE FORMAT 'YYYY-MM-DD',
COL44 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL45 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL46 VARCHAR(80) CHARACTER SET LATIN NOT CASESPECIFIC,
COL47 VARCHAR(4000) CHARACTER SET LATIN NOT CASESPECIFIC,
COL48 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL49 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
COL50 VARCHAR(40) CHARACTER SET LATIN NOT CASESPECIFIC,
COL51 TIMESTAMP(0) NOT NULL,
COL52 VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
COL53 TIMESTAMP(0) NOT NULL,
COL54 VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
ATTRIBUTE1 VARCHAR(256) CHARACTER SET LATIN NOT CASESPECIFIC TITLE 'ATTRIBUTE1',
ATTRIBUTE2 VARCHAR(256) CHARACTER SET LATIN NOT CASESPECIFIC TITLE 'ATTRIBUTE2')
PRIMARY INDEX ( COL1 );
Please help in finding the issue.
Thanks,
Meenakshi
Find Only Duplicates - response (2) by Sankalp.C
Hi AG,
As not chk had been set while populating the data hence what ever you do can not prevent this senarion to happne in near future. Comming back to your question It have to be a all amp operation in order to find the duplicated in existing table entry, Hence preapare yourself for a BIT CPU use :). Ans is very simle in taht case just do a count using group by having with a greater Than one condition.
- Sankalp
BTEQ: If Else condition - forum topic by SwapSays
BTEQ: If Else condition - response (1) by SwapSays
Hi Guys,
I have the below requirement, can this be implemented in a single BTEQ:
SELECT ....;
.IF ACTIVITY_COUNT=0
THEN
DO an Insert;
EXIT with a return code A;
ELSE
Do a set of Insert, Updates;
EXIT with a return code B;
I am aware that a THEN in a .IF..THEN has to be followed by .EXIT But is there any way by which i can achieve this (may be using .GOTO LABEL)
Note: I have done it by writing a function (Unix, BTEQ mix) and using it in the parent script but i am looking for some alternative ways.
Thanks in advance
Equivalent sentence in Teradata for the Oracle "CONVERT"? - response (4) by juanalfonso
Thanks for the answers.
David, I think you didn't understand what I want to do. I have a text parser in Oracle that clean and translate arrays of characters, and I want to get the same in Teradata cos I'll have to do a migration of code.
So that:
- if my input is 'José se comprò un camiôn', I obtain 'Jose se compro un camion' (as you can see, accents are cleared)
- if my input is 'Gta. Pérez Cidón 1; 3º B', I obtain 'Gta. Perez Cidon 1; 3? B' (and here, bad utf-8 conversions are fixed, appart from the "º", that is translated to a "?")
So my question is if there is something in Teradata that allows to detect bad conversions, code-decode and make supression of accents without ussing a translation letter by letter.
Regards
Question about "regexp_replace" - forum topic by juanalfonso
Hello to everyone,
When I execute this sentence:
- select REGEXP_REPLACE('XXX A1 A2 XXX', '.*( )(A[0-9]).*', '\2', 1, 1, 'i');
I get the second "(A[0-9])" expression, that is, "A2", instead of the first one ("A1").
I would like to know why this is like that and how to get "A1".
Thanks in advance and best regards
Patitioning expression - forum topic by Abhishektd
Which of the following partitioning expression has a better performance while SELECT, INSERT operations ? Consider the table has data around couple of Terabytes.
PARTITION BY RANGE_N(LOAD_TIMESTAMP BETWEEN TIMESTAMP '2015-01-01 00:00:00.000000' AND TIMESTAMP '3499-12-31 23:23:59.999999' EACH INTERVAL '1' DAY );
or
PARTITION BY RANGE_N(CAST(LOAD_TIMESTAMP AS DATE AT LOCAL) BETWEEN DATE '2015-01-01' AND '3499-12-31' EACH INTERVAL '1' DAY );
*** Failure 6760 Invalid timestamp. in bteq import - forum topic by n@new1
Hi All,
While importing data from INDICDATA file I m getting following error :
*** Growing Buffer to 4757
*** Failure 6760 Invalid timestamp.
Statement# 1, Info =0
Export Script :
.EXPORT INDICDATA FILE='data.txt'
.decimaldigits 38
.SET WIDTH 9000
.SET SESSION CHARSET "UTF8"
SELECT CAST(Col1 AS CHAR(20)),
CAST(Col2 AS CHAR(20)),
CAST(Col3 AS CHAR(4)),
CAST(Col4 AS CHAR(100)),
CAST(Col5 AS CHAR(100)),
CAST(Col6 AS CHAR(150)),
CAST(Col7 AS CHAR(19)),
CAST(Col8 AS CHAR(100)),
CAST(Col9 AS CHAR(19)),
CAST(Col10 AS CHAR(100)),
CAST(Col11 AS DECIMAL(38,0)),
CAST(coalesce(Col12,CAST('2014-01-01 00:00:00' AS TIMESTAMP(0))) AS CHAR(19)),
CAST(Col13 AS CHAR(1000)),
CAST(Col14 AS INTEGER),
CAST(Col15 AS INTEGER),
CAST(Col16 AS CHAR(1)),
CAST(Col17 AS CHAR(19)),
CAST(Col18 AS CHAR(19))
FROM status;
.LOGOFF
.QUIT
=========****==============
Table Structure :
CREATE MULTISET TABLE Rc_Test ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
Col1 VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col2 VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col3 CHAR(3) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col4 VARCHAR(100) CHARACTER SET UNICODE NOT CASESPECIFIC NOT NULL,
Col5 VARCHAR(100) CHARACTER SET UNICODE NOT CASESPECIFIC NOT NULL,
Col6 VARCHAR(150) CHARACTER SET UNICODE NOT CASESPECIFIC NOT NULL,
Col7 TIMESTAMP(0) ,
Col8 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col9 TIMESTAMP(0) ,
Col10 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col11 DECIMAL(38,0) NOT NULL,
Col12 TIMESTAMP(0),
Col13 VARCHAR(1000) CHARACTER SET UNICODE NOT CASESPECIFIC ,
Col14 INTEGER NOT NULL,
Col15 INTEGER NOT NULL,
Col16 CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
Col17 TIMESTAMP(0) NOT NULL,
Col18 TIMESTAMP(0) )
PRIMARY INDEX XNUPI_RC_STATUS ( Col1 ,Col2 ,
Col23 );
=========****==============
Import Script :
========
.IMPORT INDICDATA FILE='data.txt'
.decimaldigits 38
.SET SESSION CHARSET "UTF8"
.REPEAT *
USING Col1 (CHAR(20)),
Col2 (CHAR(20)),
Col3 (CHAR(4)),
Col4 (CHAR(100)),
Col5 (CHAR(100)),
Col6 (CHAR(150)),
Col7 (CHAR(19)),
Col8 (CHAR(100)),
Col9 (CHAR(19)),
Col10 (CHAR(100)),
Col11 (DECIMAL(38,0)),
Col12 (CHAR(19)),
Col13 (CHAR(1000)),
Col14 (INTEGER),
Col15 (INTEGER),
Col16 (CHAR(1)),
Col17 (CHAR(19)),
Col18 (CHAR(19))
INSERT INTO status_test
VALUES (TRIM(:Col1),
TRIM(:Col2),
TRIM(:Col3),
TRIM(:Col4),
TRIM(:Col5),
TRIM(:Col6),
CAST(:Col7 AS TIMESTAMP(0)),
TRIM(:Col8),
CAST(:Col9 AS TIMESTAMP(0)),
TRIM(:Col10),
:Col11,
CAST(:Col12 AS TIMESTAMP(0)),
TRIM(:Col13),
:Col14,
:Col15,
TRIM(:Col16),
CAST(:Col17 AS TIMESTAMP(0)),
CAST(:Col18 AS TIMESTAMP(0)));
.LOGOFF
.QUIT
Could anyone please help me with this.
Thanks
Column with keywords found in comments field - response (1) by Ckp
Can you post sample data from your view and output you expect as it will make your requirement more clear.
Also I am not sure about Teradata on this but you can do it with a combination of Bteq inside unix scripts.
1. Generate a list of keyword table
2. Store view definition in a txt file
3. Use a loop that will loop through through the content of keywordTable.list
4. Inside the loop use grep command to match the comments.
5. Store the all the cols alongwith the new Col#4 in a txt file
6. You can later insert this txt file in a table.
How to compare rows among different columns using particular scenario - response (3) by Ckp
Hi Gaurav2512
Make sure one thing your flag can have more values then you expressed in question.
Below query will work for you :
SEL Route_cd,
Event_Actual_Dttm,
Src_Obj_Id,
CASE WHEN Route_cd=Event_Actual_Dttm AND Event_Actual_Dttm=Src_Obj_Id THEN 0
WHEN Route_cd<>Src_Obj_Id AND Event_Actual_Dttm=Src_Obj_Id THEN 1
WHEN Route_cd=Src_Obj_Id AND Event_Actual_Dttm<>Src_Obj_Id THEN 2
ELSE 3
END AS flag
FROM cktmpA A CROSS JOIN cktmpB B
ORDER BY flag
Automate my Teradata queries - response (621) by Ckp
Say if I need to refresh the content of my table at 1:00 AM every friday,
I will use the following btq script (which includes insert query) and unix scheduler like cron:
btq script example :
.logon <teradata serverName>/<UserId>,<Password>;;
drop table DB.<Table>;
create table DB.<Table>
(store_Id smallint);
.IMPORT DATA FILE=/<path to file>/in.dat
.QUIET ON
.REPEAT *
USING storeId (smallint)
insert into DB.<Table>(store_Id) values (:storeId)
;
.logoff;
.quit;
CRON Example :
00 1 * * 5 sh /<path to your script>/Script.sh 1>>/<path to log>/Script.log 2>&1
00- Minutes
1 - Hour
* - Every
5 - 5th day of week (Starting from Monday so in this case Friday)
Spool Space Issue on More Projected Columns Than Lesser Projected Columns - response (5) by Win
Hi Todd,
Thank you very much for your input.
Best regards,
Win
How to define an array of varchars in Stored Procedure Language? - forum topic by juanalfonso
Hello to everybody,
I'm studying a migration from Oracle PL-SQL to Teradata Stored Procedure Language and I'm having problems trying to find a way to declare an array of varchars inside procedures/functions.
Oracle already has a type "dbms_sql.varchar2_table" and I just have to declare an instance and use it, and you don't even have to specify a length. Also I have the alternative of creating my own type "TYPE array_cadena is table of varchar2(252) index by binary_integer" and instance it afterwards as well.
I've seen that a type "SYSUDTLIB.array_strings" exists, but I have problems with it (I can't declare an instance inside the procedure/function; if I do it outside, I have problems of UDTUSAGE access; etc...).
Any help with it?
Thanks and best regards
Any best Training Centres you guys know in Hyderabad?? - response (127) by gymprathap
what is the prerequistes to leran teradata please?
I know core Java ver well.
Alternative to Oracle's packages - forum topic by juanalfonso
Hello to everybody,
I'm starting to carry out a migration from Oracle PL-SQL to Teradata Stored Procedure Language and I can't find how to declare my own packages.
I've already seen a post talking about this where they say that there is not an equivalent to Oracle's packages in Teradata.
So that means that there is not a way of grouping a bunch of procedures/functions under one single entity?
Thanks in advance and best regards
Question about "regexp_replace" - response (1) by yuvaevergreen
REGEXP_REPLACE('XXX A1 A2 XXX', '(.* )(A[0-9])( )(A[0-9]).*', '\2', 1, 1, 'I');
Flyout weirdness - response (2) by KerryMcClain
Awesome, thank you for the info!
issue to install ODBC Driver (64x) -CLIv2 (64x) not recognized - forum topic by perezco
HI,
I am having issue to install ODBC Driver (64x)
The CLIv2 - Suite 15.10.04.00 for Windows (X64) after been installed is not been recognized when I installed the X64 from the ODBC Driver Suite 15.10.04 for Windows.
Any advise is helpfull
Hi Juan,
The data type of character literals is in Teradata is always UNICODE. There is no need to convert/translate them. You can verify the characters are in Latin with the _Latin prefix. The default is _Unicode if it is missing. For example with the UTF8 character set:
-David