mfl conversion for exponential data - osb

In OSB, We are facing issue in mfl conversion from double exponential data to unsigned zoned decimal. It is failing because of exponential data(0E -7).
Input : 000000 in binary format --> mfl transforms it to 0E-7 --> again we try to convert this 0E-7 to binary ( But here mfl transformation fails). It occurs only when 0 comes as a value but if it is some other value, it works fine. Has anybody seen this before?
Peace & Cheers.

It was bug in OSB, its been rectified in the latest update patch from oracle. :)!

Related

Does Snowflake has some issue with Double Precision, Float, Real Data Type

Recently I migrated data from netezza to Snowflake. The problem I am facing is with double precision data type.
In netezza DB double precision field has value of .34757853258953 but when I query same in Snowflake UI I see it as .3475785326.
Anyone has any idea why so and how to deal with it.
This is a UI limitation, not a Snowflake limitation. The value stored is correct, but the UI display only shows 9 digits past the decimal point. You can verify like this:
SELECT 0.34757853258953::DOUBLE, 0.34757853258953::DOUBLE * 100000;

Unable to find a numerical type in sql to store this large of value

I am having some issues with getting this data into my sql database. It keeps giving me errors stating it can not accept the data. I have used decimal which seems to fail. The only type I have got to work was varchar. However, I need to be able to be able to do math equations on the data which doesn't work with varchar.
The value is:
4.453099999999999881
ERROR: data conversion error (truncation)
Have you tried some FLOAT or DOUBLE?
try DOUBLE PRECISION(52,30)
or FLOAT(53) (https://msdn.microsoft.com/en-us/library/ms173773.aspx)
http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html
http://dev.mysql.com/doc/refman/5.1/en/problems-with-float.html

Newbie - Errors when using CAST() and CONVERT()

I am very new to programming. I am learning SQL and am using SS2008 as a starting point. Firstly,thank you for your help! It makes the process of learning for someone like myself a lot easier.
I have read other threads but their code seems a lot more complicated.
I am going to keep this as simple as possible: I am querying a database wanting to perform a sum function on a particular column.
At present, the meta data of the column is of type varchar. I understand, to be able to use the sum function, the column in question needs to be of int.
To convert the column accordingly, I thought I could use either the cast/convert functions but incur errors when doing so:
/**
CAST:Charge_Pct FROM VARCHAR -> INT
**/
SELECT CAST(Charge_Pct AS NUMERIC(7,7))
FROM [Main].[Share_Class_Charges]
WHERE CHARGE_PCT <> 'None'
-- Arithmetic overflow error converting varchar to data type numeric.
/**
CONVERT: Charge_Pct FROM VARCHAR -> INT
**/
SELECT CONVERT(NUMERIC(7,7),Charge_Pct)
FROM [Main].[Share_Class_Charges]
WHERE CHARGE_PCT <> 'None'
-- Error converting data type varchar to numeric.
I am confused by where I am going wrong and what the error messages are saying. Please could someone help me by explaining what the error messages means and what needs to be done to correct the code?
Many thanks,
Al.
The NUMERIC(7,7) type describes a number with 0 digits before the decimal and 7 after. This means that if you try to cast a VARCHAR as small as 10.12 you will get an overflow error.
Try this query instead:
SELECT CAST(Charge_Pct AS NUMERIC(5,2))
FROM [Main].[Share_Class_Charges]
WHERE CHARGE_PCT <> 'None'
This will attempt to convert the Charge_Pct column (which I assume holds percentages) into a NUMERIC type consisting of 5 total numbers with 2 coming after the decimal place.

How to set default numeric format to avoid showing exponential value?

I have a problem in ASE isql that it can't stop the execution when a negative exponential value is displayed.
select -1.2218952178955078e-006
Does anyone know how I can avoid exponential value by default? Is there a setting available in session or I can do it by changing my locale? Thanks.
Regards,
Jason

Why am I getting 'Error converting data type varchar to numeric' on a floating point number in Perl?

We are inserting values into a SQL Server 2005 database column of type NUMERIC(19,5) from Perl. As long as the absolute values are .0001 or greater, it is working. However, when the values go to the 5th decimal place, Perl starts storing them in exponential format (-9e-05 instead of -0.00009), and then we get the error "Error converting data type varchar to numeric" from SQL Server. How do we prevent that and cause it to properly insert small numeric values?
We are using perl v5.8.5, DBI 1.56, DBD::Sybase 1.07, and SQL Server 2005.
The code is roughly the following, but I have removed the extraneous fields:
$invoice->{IL_UNITPRICE} = 0.09; # Actually comes from another database
$invoice->{IL_PRICEUNITCONV} = 0.001; # Actually comes from another database
$unitprice = $invoice->{IL_UNITPRICE} * -1 * $invoice->{IL_PRICEUNITCONV};
#$unitprice equals -9e-05 at this point.
$sth = $dbh->prepare('INSERT INTO foo ( bar ) VALUES ( ? )');
$sth->execute($unitprice);
The above line fails with error: DBD::Sybase::st execute failed: Server message number=8114 severity=16 state=5 line=2 server=baz text=Error converting data type varchar to numeric.
Try
$sth->execute(sprintf("%.6f",$unitprice));
To expand a bit -- When you pass a native float/double through the DBi interface it gets converted to a string, which, if you don't specify otherwise, uses Perl's default formatting conventions (imposed by the C compiler). The default is 6 digits precision, and if the number has more than that it's rendered in scientific notation.
To get fixed-point format you have to ask for it explicitly, using sprintf.
Actually I think using Math::Bigint and its associated Math::BigFloat would also solve this problem. Whenever I use floats or numbers of a sufficiently large size I use these modules so I don't have to throw sprintf's all over the place except when I really want to control the formatting.

Resources