-~ in float(126) column
I have a column defined as float(126) in my oracle8i db table.
Some rows have "-~" value for this column.
Does this value signify something?
I need to select all the rows having this value under the float(126) column. How can I do that?
From the Oracle 8 documentation....
"You can use number format models:
* In the TO_CHAR function to translate a value of NUMBER datatype to VARCHAR2 datatype
* In the TO_NUMBER function to translate a value of CHAR or VARCHAR2 datatype to NUMBER datatype
All number format models cause the number to be rounded to the specified number of significant digits. If a value has more significant digits to the left of the decimal place than are specified in the format, pound signs (#) replace the value. If a positive value is extremely large and cannot be represented in the specified format, then the infinity sign (~) replaces the value. Likewise, if a negative value is extremely small and cannot be represented by the specified format, then the negative infinity sign replaces the value (-~). This event typically occurs when you are using TO_CHAR with a restrictive number format string, causing a rounding operation. "
See: http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a85397/sql_elem.htm
In later versions of the database (not sure when exactly), you can specify "IS INFINITE" in your query to find these values. I am pretty sure this will not work in 8i. Hope this helps a bit...
Greg Pike
http://www.singlequery.com
Similar Messages
-
SQL Server, MySQL and Postgres can all have DOUBLE that is a 64bit floating point number holding the range -1.79E+308 to 1.79E+308. The Oracle docs say to use FLOAT(126) as DOUBLE, but it cannot handle this range, it only seems to cope somewhere around 1E+125
I've tested on both Oracle 10g and Oracle 10g Express.
How can I get the proper range for 64bit floating point numbers? What is the absolute maximum range an Oracle floating point number can handle? I've had the exact same issues with BINARY_DOUBLE not taking more than 1E+125
LyleSub-Types
Here are the STANDARD sub-types defined in Oracle 10g (taken from the STANDARD package):
type NUMBER is NUMBER_BASE;
subtype FLOAT is NUMBER; -- NUMBER(126)
subtype REAL is FLOAT; -- FLOAT(63)
subtype "DOUBLE PRECISION" is FLOAT;
subtype INTEGER is NUMBER(38,0);
subtype INT is INTEGER;
subtype SMALLINT is NUMBER(38,0);
subtype DECIMAL is NUMBER(38,0);
subtype NUMERIC is DECIMAL;
subtype DEC is DECIMAL;
subtype BINARY_INTEGER is INTEGER range '-2147483647'..2147483647;
subtype NATURAL is BINARY_INTEGER range 0..2147483647;
subtype NATURALN is NATURAL not null;
subtype POSITIVE is BINARY_INTEGER range 1..2147483647;
subtype POSITIVEN is POSITIVE not null;
subtype SIGNTYPE is BINARY_INTEGER range '-1'..1; -
When I create a simple table with a FLOAT(126) column and add an ADO.NET Entity Data Model with Code first from the database I get a decimal for the FLOAT column with the following ColumnAttribute: [Column(TypeName = "float")].
When I try to add a controller for this generated Code First class, it fails with the following message:
Error:
There was an error running the selected code generator:
'Unable to retrieve metadata for 'MyNamespace.TEMP_WITHFLOAT'.
Schema specified is not valid. Errors:
(8,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Decimal[Nullable=False,DefaultValie=,Precision=38,Scale=0]' of member 'FLOATCOL' in type 'MyNamespace.TEMP_WITHFLOAT' is not compatible with 'SqlServer.float[Nullable=False,DefaultValue=]' of member 'FLOATCOL' in type 'MySchema.TEMP_WITHFLOAT'.'
It fails with the same error if I specify other values for precision and scale (or remove the lines entirely) in the code invoking HasPrecision in the generated model.
The error message when trying to add a controller for the generated class:
But - if I remove the attribute [Column(TypeName = "float")] from the generated Code First class, the controller is created without errors, and works as it should, returning decimal numbers correctly (it happily ignores that the scale is set to 0 in the generated model).
The generated class with the ColumnAttribute removed:
[Table("MYDBSCHEMA.TEMP_WITHFLOAT")]
public partial class TEMP_WITHFLOAT
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ID { get; set; }
//[Column(TypeName = "float")]
public decimal FLOATCOL { get; set; }
Correct JSON output from working controller:
[ { "ID": 1, "FLOATCOL": 123.0 }, { "ID": 2, "FLOATCOL": 123.456789012345 } ]
It would be very nice if the Code First generated classes worked out of the box, without a required step to manually remove the Column attribute for every FLOAT column.
Is there a workaround or other solution to this problem? The best solution would be if the generated code is mapped correctly between compatible database and C# types.
Simple code to reproduce the issue:
SQL script for the table:
CREATE TABLE "TEMP_WITHFLOAT"
( "ID" NUMBER(10,0) NOT NULL ENABLE,
"FLOATCOL" FLOAT(126) NOT NULL ENABLE
) PCTFREE 10 INITRANS 1 NOCOMPRESS LOGGING;
ALTER TABLE "TEMP_WITHFLOAT" ADD CONSTRAINT "PK_TEMP_WITHFLOAT" PRIMARY KEY ("ID") ENABLE;
The generated class:
[Table("MYDBSCHEMA.TEMP_WITHFLOAT")]
public partial class TEMP_WITHFLOAT
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ID { get; set; }
[Column(TypeName = "float")]
public decimal FLOATCOL { get; set; }
The generated model:
public partial class TempWithFloatModel : DbContext
public TempWithFloatModel()
: base("name=TempWithFloatModel")
public virtual DbSet<TEMP_WITHFLOAT> TEMP_WITHFLOAT { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
modelBuilder.Entity<TEMP_WITHFLOAT>()
.Property(e => e.FLOATCOL)
.HasPrecision(38, 0);The annotation is emitted by the entity designer because it is necessary to preserve type fidelity with the source database column.
If the annotation is removed, the FLOATCOL property in the generated class would map to an Oracle number(38) column. But, of course, that is not what the source column is in this case.
For example, this would be a problem if a database initializer was subsequently used to re-create the database or if a script was generated via migrations using the class without the annotation.
It's interesting that the error message refers to SqlServer.float type.
I'll try to investigate a bit more... -
Oracle UNIX Data Time Issue/Question
I have a project where I need to display some data from a commercial software package. All of the tables except 1 store date values in NUMBER columns as UNIX time. I can convert these no problem, but one table has date values stored in FLOAT(126) columns and I cannot figure out how to convert them to get a valid, and accurate, date from them.
For example, the column contains the value 38513.5775115741 which in the application front end is displayed as Friday, June 10, 2005. Does anyone see a "formula" for this?
Maybe it's obvious and I've been trying too hard or looking at it too long for it to make sense to me....
Thanks in advance.This looks close:
SQL > select to_char(date '1900-01-01' + 38513.5775115741,'fmDay, Month dd, yyyy','nls_date_language=american') from dual
2 /
TO_CHAR(DATE'1900-01-
Sunday, June 12, 2005
1 rij is geselecteerd.So maybe you should use 30-12-1899 or the number was really 38511.5775115741 instead of 38513.5775115741 ?
Regards,
Rob. -
Original post in this series:
http://forum.java.sun.com/thread.jspa?threadID=629958
Issue #2: float(53) (or BINARY_DOUBLE) vs float(126)
The original database design uses float(126) for several floating point type columns. Conversation with one of the database guys involved reveals that this was not a particularly conscious choice, but came when migrating an earlier database which simply used float as the column type.
From my perspective as a Java programmer who needs to work with this data via JDBC, the choice of float(126) as a type is poor as it (a) is probably overkill, storing unneeded precision and thus wasting space (b) is unrepresentable as a Java double type unless truncation error is introduced (c) might be the cause of subtle bugs.
Point (a) needs no further explanation.
For point (b), note that oracle's float(53), not float(126), is the float type that best corresponds with Java's (IEEE 754) double type.
Unfortunately, float(53) is NOT exactly equivalent to Java's double: Oracle internally uses binary coded decimal to represent numbers (float is essentially an oracle number type with added restrictions), which will not be the same bits as Java's double format (for a reference, see http://builder.com.com/5100-6388-5224536.html). This means that there can be conversion and rounding issues even when you use float(53) (see http://www.stanford.edu/dept/itss/docs/oracle/9i/java.920/a96654/oraint.htm#1000888 which states "Performing mathematical manipulations of the data directly in SQL format avoids the loss of precision that occurs in converting between SQL and Java formats").
For point (c), here is an example of how I think that subtle bugs can be introduced. Suppose that you do a query and among the results is some floating point type, internally stored in the db as float(126) but which can only be represented in a normal computer language program by a double type, which is equivalent to a float(53). (No one wants to use a class like Java's BigDecimal if at all possible because it is very awkward to use and is extremely slow as well.) So truncation has to occur. Then suppose that the programmer wishes to use that floating point value, unmodified, as part of a subsequent query, say in an equals condition. But now it may not equal because the value in his program has lost information present in the original, so the query does not work as expected. Of course, for this scenario, one could query based on "approximately equal" instead of exactly equal. But that assumes that the programmer knows to do this, and then even if he does, it is a pain to write, may be a performance hit, and subjectivity is involved (e.g. in how much being off you will tolerate). So, if it is at all possible to reasonably avoid this, yuo want to.
It appears that Oracle 10g now offers the BINARY_DOUBLE type which DOES exactly correspond to Java's double type; see http://builder.com.com/5100-6388-5224536.html
What are people's thoughts on the points that I raise above: is using a float(126) a suboptimal design choice, or are there no significant issues?
Anyone have experience with the new BINARY_DOUBLE type? (Unfortunately, we are currently using Oracle 9i so this may not be an option for us.)Original post in this series:
http://forum.java.sun.com/thread.jspa?threadID=629958
You could have posted it as a reply to that post. :)
It's difficult managing to keep multiple posts close together. -
What's the size limitation on the NUMBER type column, how many digits it can be?
I need to convert the data in the column to a byte array and I need to decide how long the byte array shoud be before hand.
Also, I need the same info for a FLOAT type column.
Can someone help me with it? Thanks.see
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/sql_elem.htm#45443
Excerpt from the document:
NUMBER Datatype
The NUMBER datatype stores zero, positive, and negative fixed and floating-point numbers with magnitudes between 1.0 x 10^-130 and 9.9...9 x 10^125 (38 nines followed by 88 zeroes) with 38 digits of precision. If you specify an arithmetic expression whose value has a magnitude greater than or equal to 1.0 x 10^126, Oracle returns an error. -
How to get the value of column from previous row to current row?
Hi All,
I am facing a critical problem in SQL query (for reporting purpose (COGNOS)). please reply to my query.
REQUIREMENT: i want to retrive value of a column (this is not a table column, this will be calculated based expression) from previous row to current row.
EXAMPLE:
TABLE NAME: i have to join multiple tables. so, i am not mentioning table names here.
DISPLAY COLUMNS in the report: item, loc, sku, beginval (not table column), endval (not table column, this will calculated based on some expressions), etc. Here, first time the value of BEGINVAL will be taken from some x column name of x table. ENDVAL will calculated based on the expression. For the next row onwards, BEGINVAL will become the value of ENDVAL and the value of ENDVAL will be calculated based on the expression and this expression uses the value of BEGINVAL.
my report will look like below.
ITEM LOC SKU BEGINVAL ENDVAL
1 HYD 1-HYD 10 10+1+2 (13)
2 HYD 2-HYD 13 13+1+2 (16)
3 SEC 3-SEC 16 16+1+2 (19)
4 SEC 4-SEC 19 19+1+2 (22)
etc....
in the above output, BEGINVAL and ENDVAL columns are not part of any table. they are alias column names.if you observe intially BEGINVAL will be assigned to some value, but from subsequent rows, BEGINVAL will become the ENDVAL of previous row.
Please help me on how to write this query?Hi, please find the detail description of the problom.
DDL (table scripts)
ITEM
CREATE TABLE ITEM
ITEM VARCHAR2(50 CHAR) NOT NULL,
DESCR VARCHAR2(50 CHAR) DEFAULT ' ' NOT NULL,
UOM VARCHAR2(50 CHAR)
SKU
CREATE TABLE SKU
ITEM VARCHAR2(50 CHAR) NOT NULL,
LOC VARCHAR2(50 CHAR) NOT NULL,
OH float
SKUPROJSTATIC
CREATE TABLE SKUPROJSTATIC
ITEM VARCHAR2(50 CHAR) NOT NULL,
LOC VARCHAR2(50 CHAR) NOT NULL,
STARTDATE DATE
VehicleLoad
CREATE TABLE VEHICLELOAD
LOADID VARCHAR2(50 CHAR) NOT NULL,
DESCR VARCHAR2(50 CHAR) DEFAULT ' ' NOT NULL,
SHIPDATE DATE DEFAULT TO_DATE('01/01/1970','MM/DD/YYYY') NOT NULL,
ARRIVDATE DATE
VEHICLELOADLINE
CREATE TABLE VEHICLELOADLINE
LOADID VARCHAR2(50 CHAR) NOT NULL,
ITEM VARCHAR2(50 CHAR) NOT NULL,
QTY float(126)
DML scripts
I can't provide the the DML scripts, because its very huge data.
Main QUERY is below.
below is the query which i have to write and execute.
select
i.item,
i.descr,
i.unitsperpallet,
sp.loc,
sp.startdate,
'Crucial_IND',
LAG (EndBal,1,0) OVER (ORDER BY STARTDATE) BeginBal,
SP.FCSTCUSTORDERS CustOrders,
SP.COMMITINTRANSOUT,
SP.RECARRIV,
SP.TOTINTRANSIN,
(BeginBal - sp.FCSTCUSTORDERS - sp.COMMITINTRANSOUT + sp.TOTINTRANSIN ) EndBal,
'CuttingQty',
VLL.QTY,
vl.source,
vl.arrivdate,
vl.shipdate,
vl.loadid,
s.oh
from item i, skuprojstatic sp, sku s, VehicleLoad vl, VehicleLoadLine vll
where sp.item = i.item
and s.item=i.item
and sp.item =s.item (+)
and sp.loc = s.loc (+)
and vll.item = s.item
and vll.loadid = vl.loadid
and to_char(sp.startdate ,'mm/dd/yyyy') = to_char(vl.arrivdate,'mm/dd/yyyy')
and sp.loc = vl.dest (+)
order by sp.startdate
problem description: in the above query, BeginBal and EndBal is what i am looking for. when i execute this query, oracle throwing an error saying that alias names can't be used as expressions. For the first row, the BeginBal should be the value sku.OH and for the subsequent rows, this value will be the previous row value of EndBal. -
BUG : FORMS not displaying values stored in FLOAT datatypes.
APEX 2.2.1.
Error occurs on both V9.2.0.4 and V10.2.
I'm working on a "report with form" combination and have been fighting a problem where the data entered into a form will save correctly and show in the report, but when you choose to edit the record to update it, the value will not display in the form at all.
I went round and round, and finally discovered that the problem had to do with the FLOAT datatype being used to store the data.
When creating a default "Report with Edit form" on the following two example tables, the form works correctly with SLA_SCHEDULE2 but not with SLA_SCHEDULE1
CREATE TABLE SLA_SCHEDULE1
ID NUMBER NOT NULL,
NAME VARCHAR2(128 BYTE) NOT NULL,
TRACING_PERCENTAGE FLOAT(126),
RUNS_PER_PERIOD NUMBER,
SECONDS_PER_PERIOD NUMBER,
SCHEDULE_TYPE VARCHAR2(16 BYTE) NOT NULL
CREATE TABLE SLA_SCHEDULE2
ID NUMBER NOT NULL,
NAME VARCHAR2(128 BYTE) NOT NULL,
TRACING_PERCENTAGE NUMBER,
RUNS_PER_PERIOD NUMBER,
SECONDS_PER_PERIOD NUMBER,
SCHEDULE_TYPE VARCHAR2(16 BYTE) NOT NULL
The only workaround I have so far is to change the datatype of the column.
DougBased on the advice Scott gave above, I've created this function...
CREATE OR REPLACE FUNCTION Get_Float_Value
p_table_name VARCHAR2,
p_float_column_name VARCHAR2,
p_key_id_name VARCHAR2,
p_key_id_value VARCHAR2
RETURN FLOAT IS
TYPE FLOAT_CURSOR IS REF CURSOR;
f_cur FLOAT_CURSOR;
FLOAT_VALUE FLOAT(126);
SQL_STMT VARCHAR2(500);
BEGIN
SQL_STMT := 'select :a from :b where :c = :d';
SQL_STMT := REPLACE(SQL_STMT, ':a', p_float_column_name);
SQL_STMT := REPLACE(SQL_STMT, ':b', p_table_name);
SQL_STMT := REPLACE(SQL_STMT, ':c', p_key_id_name);
SQL_STMT := REPLACE(SQL_STMT, ':d', p_key_id_value);
OPEN f_cur FOR SQL_STMT;
LOOP
FETCH f_cur INTO FLOAT_VALUE;
EXIT WHEN f_CUR%NOTFOUND;
RETURN FLOAT_VALUE;
END LOOP;
RETURN NULL;
END Get_Float_Value;
This allows you to call the function ANYWHERE you use a FLOAT, without having to create one function per table/column you might need to use it against.
I know that I could have used a 'USING' statement on the cursor to do the replacements, but I always find it easier to debug replacement values using the REPLACE function.
Doug -
Problem accessing float in stored procedures
I wrote a stored procedure that updates a column in a table whose datatype is of float(126). I declared a global variable in the stored procedure. The value of this variable is computed in the stored procedure and is used to update the table. My problem is an error message denoting my variable declaration to be at fault keeps on showing up even if I tried different datatypes in my declaration. I've tried RANK NUMBER, RANK NUMBER(19),
RANK FLOAT(126) even RANK NUMBER(2,2). Can anyone help?Albert,
I don't know what you mean by a "global" variable in a stored procedure. Is this a java stored procedure, or is it a PL/SQL stored procedure? If it is PL/SQL, perhaps the PL/SQL forum would be more appropriate?
For your information, the following (PL/SQL) stored procedure works fine for me on a Oracle 9.2.0.4 database:
create or replace procedure avi as
fv float(126);
begin
fv := 1.7;
dbms_output.put_line(to_char(fv));
end;Perhaps you would care to provide some more information?
[But I'm not guaranteeing that I will be able to resolve your issue, if you do.]
What database version are you using?
Is this a java stored procedure?
Please post the entire error message (and stack trace?) you are getting.
Please post the code that is causing the error. [Enough code so that I can try and reproduce your situation on my computer.]
Good Luck,
Avi. -
How to reject external table rows with some blank columns
How to reject external table rows with some blank columns
I have an external table and I would like to reject rows when a number of fields are empty. Here are the details.
CREATE TABLE EXTTAB (
ID NUMBER(10),
TSTAMP DATE,
C1 NUMBER(5,0),
C2 DATE,
C3 FLOAT(126)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXT_DAT_DIR
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
LOAD WHEN (NOT (c1 = BLANKS AND c2 = BLANKS AND c3 = BLANKS))
LOGFILE EXT_LOG_DIR:'exttab.log'
BADFILE EXT_BAD_DIR:'exttab.bad'
DISCARDFILE EXT_BAD_DIR:'exttab.dsc'
FIELDS TERMINATED BY "|"
LRTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL
FIELDS (
ID,
TSTAMP DATE 'YYYYMMDDHH24MISS',
C1,
C2 DATE 'YYYYMMDDHH24MISS',
C3
) LOCATION ('dummy.dat')
REJECT LIMIT UNLIMITED
So, as you can see from the LOAD WHEN clause, I'd like to reject rows when C1, C2 and C3 are empty.
The above statement works fine and creates the table. However when I am trying to load data using it, the following error is produced:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "not": expecting one of: "double-quoted-string, identifier, (, number, single-quoted-string"
KUP-01007: at line 1 column 41
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
It seems that external tables driver does not understand the "NOT (...)" condition. Could anyone suggest how I can achieve what I want in a different way?
Thank you.
DenisAnother method would be to simply remove the "LOAD WHEN condition" and create a view on the external table which filters the data.
CREATE EXTTAB_VIEW AS
SELECT * FROM EXTTAB
WHERE not (c1 is null and c2 is null and c3 is null); -
Data Type for a Longitude/Latitude Column in an Oracle dB Table?
Greetings All,
What is the recommended data type for a Longitude(Lon) or Latitude(Lat) Column of an Oracle dB Table? I am creating a signs inventory table in our Oracle database to be used as a data warehouse for our signs inventory. The Lon and Lat fields along with some other data will be populated from a MS access file exported from our Geodatabase. Currently the data type for the Lon and Lat fields of the MS access file is defined as "Double". A couple of Examples of the Lon and Lat data are as follows:
Lat Lon
59.4564555909 -135.3133542922
64.841125 -148.01808
...What data type should these two columns be defined in the new Oracle database table??? Should the data type be defined as FLOAT(126), NUMBER(10, 6), or else? Any suggestions/help on this would be greatly appreciated.
If the data type is defined as NUMBER(10,6), the first example of Lon "-135.3133542922" will be truncated to "-135.313354" or would I receive an error while trying to import the data from an access file to the Oracle dB?
Thanks in advance for any/all the help.Orchid,
Is SDO_GEOMETRY available in Oracle 10g?Yup. I'm still on 10g as well; there's no shame in that.
How do I format my lat/long's into WKT and use the SDO_GEOMETRY constructor?The March 16th example shows the steps, but I take it you're trying to get your data from MS Access into Oracle. Is that right? If so, consider these options:
OPTION 1, When you have < 50k records
Simply write a query that returns INSERT statements that you can run against Oracle.
For example, let's say you have a table in MS Access defined as msaCoords (ID, LongX, LatY).
Let's say, your destination table in Oracle is named oraCoords(ID NUMBER, Geometry MDSYS.SDO_GEOMETRY). Then,
SELECT "INSERT INTO oraCoords (ID, Geometry) VALUES (" & ID & ", SDO_GEOMETRY('POINT (" & LongX & "," & LatY & "'), 8307);" FROM msaCoords;
-- "MS-ACCESS QUERY RESULTS"
INSERT INTO oraCoord (ID, Geometry) VALUES (1, SDO_GEOMETRY('POINT (-135.3133542922,59.4564555909'), 8307);
INSERT INTO oraCoord (ID, Geometry) VALUES (2, SDO_GEOMETRY('POINT (-148.01808,64.841125'), 8307);Save those MS-ACCESS QUERY RESULTS to a text-file (D:\MyPts.sql). Launch SqlPlus and type @D:\MyPts.sql
Once it's done, type Commit into SqlPlus and you're done.
OPTION 2, when you have > 50k records
Use SqlLoader. There's an example posted { here | http://forums.oracle.com/forums/thread.jspa?messageID=9412123� }
Cheers,
Noel -
Sun implementation of WebRowSet fails for FLOAT values
I have been attempting to use the sun reference implementation of WebRowSet class to query a vendor table and serialize the rowset to XML.
Oracle's proprietary RowSet package does not include an implementation of WebRowSet.
For simple tables everything works ok. However, a few of the vendor's more robust tables define numeric columns as FLOAT(126) in the DDL. These columns return thru the Oracle driver as type NUMBER (numeric Type 2) with driver recommended java class java.math.BigDecimal. The Precision is correctly returned as 126.
The problem seems to be that the driver considers these columns to have a Scale of -127 which is nonsensical. When populating the WebRowSet from a ResultSet an exception is thrown which indicates that a negative scale has been encountered.
Since WebRowSet can only be populated from a ResultSet and the scale property is returned by the driver, this means that WebRowSet is effectively unavailable for Oracle databases.
BTW, our Oracle database is v 9.2.0.4.0 and the Oracle JDBC driver is 9.2.0.5. The WebRowSetImpl class was downloaded from javasoft this month - it is version 1.01.
Has anyone else observed FLOAT columns with negative scale ? Is there any way to coerce the driver into returning a more accurate scale ?I have been attempting to use the sun reference implementation of WebRowSet class to query a vendor table and serialize the rowset to XML.
Oracle's proprietary RowSet package does not include an implementation of WebRowSet.
For simple tables everything works ok. However, a few of the vendor's more robust tables define numeric columns as FLOAT(126) in the DDL. These columns return thru the Oracle driver as type NUMBER (numeric Type 2) with driver recommended java class java.math.BigDecimal. The Precision is correctly returned as 126.
The problem seems to be that the driver considers these columns to have a Scale of -127 which is nonsensical. When populating the WebRowSet from a ResultSet an exception is thrown which indicates that a negative scale has been encountered.
Since WebRowSet can only be populated from a ResultSet and the scale property is returned by the driver, this means that WebRowSet is effectively unavailable for Oracle databases.
BTW, our Oracle database is v 9.2.0.4.0 and the Oracle JDBC driver is 9.2.0.5. The WebRowSetImpl class was downloaded from javasoft this month - it is version 1.01.
Has anyone else observed FLOAT columns with negative scale ? Is there any way to coerce the driver into returning a more accurate scale ? -
ORA-01426: numeric overflow, while migrating "float" values
When I try to insert a value of *2.58612749363472E302* (originally a "float" in SQL DB) into an Oracle column of type float(126), I get this error "ORA-01426: numeric overflow"
I tried changing the column type to BINARY_FLOAT, BINARY_DOUBLE, but I still get same error.
I'm using Oracle SQL Developer (2.1.1.64.45) to migrate a SQL Server 2005 Database to Oracle 11g.
Do you have any thoughts on this? Or workarounds?
Thanks in advance.
ArulArul,
I have checked the Migration Workbench documentation where it says for float data -
Oracle® SQL Developer
Supplementary Information for Microsoft SQL Server and
Sybase Adaptive Server Migrations
Release 2.1
Table 2–2 Data Types in Oracle and Microsoft SQL Server or Sybase Adaptive Server
NOTE: If you try to migrate
floating point data greater
than or equal to 1.0E+126
then SQL Developer will fail
to insert this data in the
Oracle database and1 will
return an error.This also
applies to negative values
less than or equal to
-1.0E+126.
So, if I understand it correctly your value of 2.58612749363472E302 is outside this range.
Regards,
Mike -
Getting precision length for float data type
Hi All,
We trying to find the precision length of a float (126) data type. Are there any built in functions in oracle for finding the same? E.g: the function should return 5 for the value 1.23456 .
Also, are there any table level operation to reduce the decimal precision of a float 126 field?
Regards,
Raj.Not sure if this is what you're looking for:
select data_precision from all_tab_columns
where owner = '<your schema name>'
and table_name = '<your table name>'
and column_name = '<name of column in table>';
or are you looking for a particular find_precision_in_number() function...
i can't think of one off the top of my head, but you can always do:
length(substr(<colname>, instr(<colname>, '.')+1)) -
Syntax of DDL options and related (table) column names
Hi,
where can I find something like a mapping between DDL options and related table column names?
For example I do have the table options PCTFREE, FREELISTS and NOCOMPRESS. The related table columns out of user_tables are PCT_FREE, FREELIST and COMPRESS.
PCT(_)FREE wins an Underscore, FREELIST(S) wins an "S" and it is "NOCOMPRESS" if COMPRESS has a value "Y(es)".
Hope somebody can help.So far I didn't find any information that is not in
the DDL script gernerated from
DBMS_METADATA.get_DDL.Alright, I give you an example:
I create a table with the following DDL:
"CREATE TABLE IntBuch (
int_bunr integer NOT NULL,
int_sdat double precision NOT NULL,
int_hblz char(8) NOT NULL,
int_hkto char(7) NOT NULL,
int_hdat double precision NOT NULL,
KtoNr char(7) NOT NULL,
BLZ char(8) NOT NULL,
CONSTRAINT PK_IntBuch PRIMARY KEY (int_bunr)
USING INDEX
PCTFREE 10
STORAGE (
INITIAL 1000
NEXT 500
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 4096
PCTFREE 20
LOGGING
CREATE UNIQUE INDEX intid
ON IntBuch (int_bunr DESC)
CREATE INDEX hkto
ON IntBuch (int_hblz,int_hkto)
COMMENT ON TABLE IntBuch
IS 'Kommentar zu DB-Tabelle InBuch'
COMMENT ON COLUMN IntBuch.int_sdat IS 'Kommentar zu DB-Spalte int_sdat'
ALTER TABLE IntBuch
ADD CONSTRAINT Gutschrift FOREIGN KEY (int_hkto,int_hblz) REFERENCES Konto
ON DELETE CASCADE
ADD FOREIGN KEY (KtoNr,BLZ) REFERENCES Konto
ADD FOREIGN KEY (int_bunr) REFERENCES Buchung
ON DELETE CASCADE
After that I read the DDL with DBMS_METADATA.get_DDL and I get
" CREATE TABLE "UOENDE"."INTBUCH"
( "INT_BUNR" NUMBER(*,0) NOT NULL ENABLE,
"INT_SDAT" FLOAT(126) NOT NULL ENABLE,
"INT_HBLZ" CHAR(8) NOT NULL ENABLE,
"INT_HKTO" CHAR(7) NOT NULL ENABLE,
"INT_HDAT" FLOAT(126) NOT NULL ENABLE,
"KTONR" CHAR(7) NOT NULL ENABLE,
"BLZ" CHAR(8) NOT NULL ENABLE,
CONSTRAINT "PK_INTBUCH" PRIMARY KEY ("INT_BUNR")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "GUTSCHRIFT" FOREIGN KEY ("INT_HKTO", "INT_HBLZ")
REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ON DELETE CASCADE ENABLE,
FOREIGN KEY ("KTONR", "BLZ")
REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ENABLE,
FOREIGN KEY ("INT_BUNR")
REFERENCES "UOENDE"."BUCHUNG" ("BU_NR") ON DELETE CASCADE ENABLE
) PCTFREE 20 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
If there are no more DDLOptions possible than that, it is fine for me. If not, but all kinds of options are to find in only one or two tables of the database ( user_tables for table options, dba_constraints and dba_segments for column options, primary and foreign keys, user_indexes and user_segments for indexes ...), that is fine for me, too. (As long as I get to know which tables are "sufficient" for that.) If it is different than both of that, that's bad.
However if you want to use defaults instead of
absolut values, it is better to remove certain parts,
like the storage clause, from the generated output.I understand this, but I am more interested to have all and not leaving out some of them in order to have the defaults in the database after running the DDL.
A totally different approach could be to
a) create a database link from one DB to another.
b) create table <new_table> as select * from
<old_table@dbLink> where 1=2;I keep that in mind, thanks for that hint.
Maybe you are looking for
-
How to populate a spry menu using microsoft sql server database?
Hi I would like to use dreamweaver cs4 and spry menu to create a dynamically created menu system. My concept is to populate the menu items on the fly using MS sql server as the database technology. Can anyone point me in the right direction? I have g
-
Can't share iBook's internet with new MB
Hi, I want to set up Internet sharing to share my iBook's Airport connection with my new Macbook which can't be brought online until this 5 day Korean holiday ends. My boyfriend is using the iMac (plugged into ethernet) in the next room. But when I s
-
Acrobat V9.0 PDF and Reader V5.0 Compatibility
Hi - I'm having trouble with an Acrobat V9.0 PDF. The file was generated on the PC with WinXP using Acrobat V9.0 Standard Edition. I also have access to an OS9.2 Mac which we use to run Adobe Framemaker. The Mac has Acrobat, Distiller and Reader V5.0
-
White screen of death solved??? HP DV2810ea
I was getting a white screen and a constant beeping from my speekers. I can reflow and reball gpu's ok. However this wasnt the case. I noticed a Burnt out 8 pin chip under fan assembly. was wondering if anyone would know where i could find one or if
-
Several apps available for virtual PC
There are several apps for running windows on the MAC. What are the differences? Is there a web site that shows all available options and reviews all of them? A long time ago I used Virtual PC (it was the only one out there), but I noticed that there