Thursday, 29 January 2015

ALTER Table in Teradata

One interesting thing I have noticed in Teradata. I have an existing table, I want to ADD one new column to it.

I have given below query. I am getting an error.

Resolution for Varchar


Error Query:
       
ALTER TABLE SAMPLES.LOAN_ACCOUNT
ADD MY_NEW VARCHAR2(1);
       

Error: 3706: Syntax error VARCHAR2 does not match defined type.


Correct Query:
       
ALTER TABLE SAMPLES.LOAN_ACCOUNT
ADD MY_NEW1 VARCHAR(1);
       


Comparison Oracle Vs DB2

Teradata ODBC Driver Type Native type for Oracle 9i or 10g staging data sourceData type for Oracle 9i or 10g staging data sourceNative type for DB2 staging data sourceData type for DB2 staging data source
BYTEINTintegerNUMBER(38)integerVARCHAR(3)
SMALLINTintegerINTEGERintegerINTEGER
INTEGERIntegerINTEGERIntegerINTEGER
DECIMALDecimalNUMBER(18)DecimalDECIMAL(18,0)
FLOATFloatFLOAT(126)FloatDOUBLE
CHARVarcharVARCHAR2(n BYTE)VarcharVARCHAR(n BYTE)
VARCHARVarcharVARCHAR2(n BYTE)VarcharVARCHAR(n BYTE)
LONG VARCHARVarcharVARCHAR2(4000 BYTE)VarcharVARCHAR2(4000 BYTE)
NUMERICDecimalNUMBER(18)DecimalDECIMAL(18,0)
REALFloatFLOAT(126)FloatDOUBLE
DATEDateVARCHAR2(25 BYTE)DateVARCHAR(25)
TIMETimeVARCHAR2(25 BYTE)TimeVARCHAR(25)
TIMESTAMPDateTimeVARCHAR2(25 BYTE)DateTimeVARCHAR(25)

No comments:

Post a Comment

5 Top Teradata DATE functions read now

  The following are the list of DATE functions. These are very frequently being used in Teradata. Current DATE The following statem...