Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-09 : 11:01:50
|
Kuldeep writes "I have table 'batch' with following columns. batch_amt number(10,2) and batch_name varchar(30).1> SQL Query 'select batch_amt from batch' is passed to dbms_sql.parse and then to dbms_sql.describe_column. Then dbms_sql.describe_column returns col_scale as 2 which is right.2> If SQL Query is 'select sum(batch_amt) from batch' is passed to dbms_sql.parse and then to dbms_sql.describe_column. Then dbms_sql.describe_column returns col_scale as 0. Why is this so? Is there any alternate method to get col_scale of sum(batch_amt) as 2." |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-01-09 : 12:30:18
|
Well, we're a SQL Server site, so you should try an Oracle forum in case this suggestion doesn't work.Since you're not passing the exact same expression, it's reasonable to say that you WON'T get the same results. The function can utilize system information to find the scale of a column (and it probably does), but would have to do some fancy thinking to determine the scale of a Sum(). It probably can't make that distinction, and the truth is, why would you need the scale of the Sum() anyway? It would be the same as the column being summed. The only time it would differ is if you were summing an expression of varying scale, like Sum(a+b), where a and b are two different numeric columns. |
|
|
|
|
|