Numeric overflow occurred during computation? - response (2) by dnoeth
Numeric overflow occurred during computation? - response (3) by paulxia39
Dieter:
decimal(38,8) is bigger than decimal(18,2),why it overflow?
How to deal with SQL validation error -5940 (Excessively complex expression)? - forum topic by eliot
Hi,
I'm composing a query to concatenate all columns into a string from a very wide table. My SQL looks like
SELECT T0.C0 || '-' || T0.C1 || '-' || ... T0.CN AS CONCATENATED_STR FROM (SELECT T0.C0, T0.C1, ..., T0.CN FROM WIDE_TABLE T0) T0
However the database complains this SQL statement during validation. The error message is:
"HY000-5940 [ODBC Teradata Driver] Excessively complex expression."
According to Teradata's document this error happened within RES modules during expression resolution, and it is adviced to "correct the condition and resubmit". However this seems doesn't fit to my situation so I have no idea how to improve the statement.
If I try to shorten the statement by concatenating only part of the columns, sometimes I got error:
"HY001-3710 [ODBC Teradata Driver] Insufficient memory to parse this request, during Optimizer phase."
My question are:
(1) How can I rewrite the SQL statement such that Teradata is happen to parse and execute?
(2) What is the limit for concatenating string in SQL? What is the limit for submiting such query to the database? Is it configurable or depends on hardware configuration?
Many thanks!
Eliot
Numeric overflow occurred during computation? - response (4) by paulxia39
dieter:
when i excute sql as bellow:
sel type(400.000000000 * 100000000),
result is decimal(18,9).
thks
Numeric overflow occurred during computation? - response (5) by dnoeth
You multiply first, this exceeds the dec(18,9) and thus fails before the CAST.
So CAST one of the operands before the multiplication.
Dieter
Numeric overflow occurred during computation? - response (6) by paulxia39
dieter:
When cast to deciaml(18,2),it's ok?
I'm so puzzle with this....
Revoke User - response (1) by dins2k2
Even I have the same question. Where to check whether a user is revoked or not? Any views or tables are there? Please help.
Numeric overflow occurred during computation? - response (7) by dnoeth
Of course it's ok, simply try it.
Base the definition on your actual datatypes/data/requirements.
Dieter
show table dbc source - response (3) by Shelley
It gets the information from internal data structures and in particular , for partitioning, it gets it from the table headers.
--Shelley
Behaviour of a query - forum topic by eejimkos
Hello,
I would like your help for the next issue.It is a real problem,but i will presente you like an example.
I have a view which is composed as below
viewa =
sel * from
(
calendar_dim
inner join
(
sel * from table_a
inner join table_b
union all
sel * from table_c
inner join table_D
)
on...
)
All the tables , table_a table_b table_c table_d have the same pi and partition columns(the 1st partition level is at the date) , stats are up to date .
My question is the following,
If i will try to do a qurey such as
sel *
from viewa
where cal_Date = '2013-05-31'
-->> the explain plan works perfect. It takes only one partiiton from each table and produce the result.
The same happens with multiple date , /......where cal_Date in ('2013-05-31','','',.......)
(it takes the correct number of partitions ).
BUT , if i will try to inner join this view with a table , which contain 10 distinct dates , i was waiting to have 10 partitions from each table of the view inner join this spool with the external table.
sel a.*
from viewa a
inner join table_e b
on a.cal_Date = b.cal_Date
, it does an all amp retreive from each table of the view and then duplicates the external table ,The issue is that the 4 tables inside the view are very big,about 1 billion rows.
Solution on this?
**
I tried to make a volatile table (with one column = date ) which contains only the distinct date that i am expected but nothing.Still the same behaviour.
Thank you very much for your time.
First connection teradata 14 after installation - response (2) by Shelley
Did you make sure you ran the DIP step when creating your new database?
Are you using DBC to logon to both BTEQ and through Teradata Administrator?
--Shelley
Row Number and Select Distinct Query - forum topic by SR_Stage
Good morning TD community,
I've been working on a writing a distinct query that returns as a single concatenated string (it has to be fed into a system that is expecting fixed-length field based on position) and I have a requirement to number the rows. I've attempted several methods of row numbers but I continue to get the result of all the rows being numbered before the distinct condition of the select is applied. So I am expecting 13 rows, but I get 91 because if you don't use the distinct condition, that's how many rows there are. I need number off the rows 1-13.
Is there a way to apply a row number to the distinctly selected rows?
Is there any way to handle single digit's in date? - forum topic by barani_sachin
Hi All,
I have a date "Mar 1 2013" which i want to load it into a table with date format as 'MMMBDDBYYYY' is there any way i can load this without adding a "0" before the 1 in the given date?
i am using TD14.
Is there any way to handle single digit's in date? - response (1) by dnoeth
In TD14 there's Oracle's TO_CHAR, which is a bit more flexible than TD's FORMAT :-)
to_date('Mar 1 2013', 'mon dd yyyy')
Dieter
Row Number and Select Distinct Query - response (1) by dnoeth
DISTINCT is processed after ROW_NUMBER which creates unique values :-)
You need to move the DISTINCT into a Derived Table:
SELECT ROW_NUMBER(....), dt.* FROM ( SELECT DISTINCT ... FROM ...) AS dt
Dieter
Revoke User - response (2) by dins2k2
Hi wambli, DBC.LogonRules view has a column named LogonStatus which contains the flag whether user is granted (G) or revoked (R) logon access.
This view uses information from real table DBC.LogonRuleTbl.
aliased column is ambiguous in where clause - forum topic by matt.h
Is there a way to reference an aliased column so it doesn't throw a column is ambiguous error (without renaming the alias)? Example:
Select coalesce(a.dob, b.birth_date) as dob
From db.table1 a
Join db.table2 b (on a.field1 = b.field1)
Where dob = '1900-01-01' <--- throws an error because it doesn't know if dob is coming from db.table1 or the aliased field that I want to alias dob.
This is my silly work around but wondered if there is a better solution:
Select q.dob2 as dob
From(
Select coalesce(a.dob, b.birth_date) as dob2
From db.table1 a
Join db.table2 b (on a.field1 = b.field1)
Where dob2 = '1900-01-01'
) q
Numeric overflow occurred during computation? - response (8) by paulxia39
Dieter:
I do know this is ok and I have test it.But why?
When cast to decimal(38,8),you say cast should be excuted after the multiplication.
So, when cast to decimal(18,2), I think that multiplication should be excuted first.
Why it is ok?
aliased column is ambiguous in where clause - response (1) by Harpreet Singh
one other way:
Select coalesce(a.dob, b.birth_date) as dob
From db.table1 a
Join db.table2 b (on a.field1 = b.field1)
Where coalesce(a.dob, b.birth_date) = '1900-01-01'
Teradata - forum topic by HenryMiguel
We have migrated our system from netezza to teradata. But our queries taking very long time in executing
The default maximum number of decimal digits for an expression is based on dbscontrol General field 13: MaxDecimal
When you submit a
sel type(400.000000000 * 100000000)
you'll probably get dec(15,9) or dec(18,9).
The best solution would be changing MaxDecimal to 38, but this has do be done by your DBA after checking for possible side-effects for existing applications (and it requires a restart). On the other hand this is usually safe, when a query/application encountered this error it's already doing a workaround:
sel cast(400.000000000 as decimal(38,8)) * 100000000;
Dieter