Migrate SqlServer BigInt DataType to Ora Number data type - customizable ?
Hello,
i'm trying to migrate a sql-server 2005 db to oracle 10 using Sql-Developer v 1.2.0.
Every column having datatype bigint is converted to a Number(10,0) column.
Is it possible to customize this convertion cause i would like to have a Number(19,0) column ?
Thanks in adavance !
SQL> desc emp_test;
Name Null? Type
EMPNO NUMBER(6)
ENAME VARCHAR2(20)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
Similar Messages
-
Ho to Comapre with Number Data Type
hi
My reqt is to do validation in ValidateEntity Method.
How to compare the with Number Data type:
For ex: Number a = gatAbc();
If(a>10)
throw new oaExcption...
But while comapring i got compiler Error
Error(218,17): method >(oracle.jbo.domain.Number, int) not found in class abc.oracle.apps.per.irc.pqr.schema.server.XxabcEOImpl
So plz tell me how to compare the integer value with Number data type
ThanxCheck with float. It will work definitely.
float number = Float.parseFloat(HrsPerDay); //HrsPerDay is a String and I am converting it to float
if(( number <= 0) || (number >= 21))
throw new OAAttrValException(OAAttrValException.TYP_VIEW_OBJECT,
"xxCopyResourceVO1",
rowi.getKey(),
"NoOfCopies",
rowi.getAttribute("NoOfCopies"),
"PA",
"xx_xx_COPY_POSITIVE_NUM");
}Here in this code i am also checking that the Hours cannot be less then 0 and greater than 20.
Thanks
--Anil -
Hi All,
I have few issues with "Number" data type
1) trying to convert string "0.0000007" to Number i am getting value with exponential (1e-7). This is only when we have more than 5 0's after decimal.
2) If i try to do below calculation, i am not getting exact value:
ex: 999999.999999+999999999999=1000000999999-999999999999 = 1000000(expected should be:999999.999999)
0.3*6=1.79999998 (exact value: 1.8)
Please let me know what might be the issue......
Thanks in advance to all....That's standard behavior for floating point. If you search the forum for
past discussions of floating point and Number you'll see explanations why.
To get displayable strings, use toPrecision or toFixed -
Data_length of number data type
when I checked for the columns with data type as number in dba_tab_cols it is showing 22 for all the columns irrespective of the precision and scale. why is it so?
also can you tell what data length exactly means?
Edited by: user12288160 on May 19, 2010 3:04 AMHi tom,
I am doing database sizeing. I am expecting that one of my table will have 50,000,000 records in
future(say within 6 month). That table has composite primary key(5 columns). All the columns are
NUMBER data type. In All_tab_column I could see the data length is always 22. So I tried to
decrease the length( Number(10)). Then also its saying data length is 22. But I Know that I can't
enter data in this field more than 10 digits. So In this case it should be 12. But why its showing
22(Data_length field in All_tab_columns).
My question is, for my sizeing calculation, should I take this length 12 or 22?.
Thanks
Followup August 12, 2004 - 9am Central time zone:
that is the max length -- numbers are stored as varying length character strings.
Source: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1619552483055
REgards
Asif Kabir -
NUMBER Data type's Negative Scale
This is what I read in the 1z0-051 Study Guide:
The NUMBER data type may optionally be qualified with a precision and a scale. The precision sets the maximum number of digits in the number, and the scale is how many of those digits are to the right of the decimal point. If the scale is negative, this has the effect of replacing the last digits of any number inserted with zeros, which do not count toward the number of digits specified for the precision. If the number of digits exceeds the precision, there will be an error; if it is within the precision but outside the scale, the number will be rounded (up or down) to the nearest value within the scale. I am not sure if I understood this paragraph the correct way or not and hence this query:
I created this table t1
create table t1
(col1 number,
col2 number(4),
col3 number(4,2),
col4 number(4,-2));
INSERT INTO T1 (COL4) VALUES (1234); = 1200 is inserted
INSERT INTO T1 (COL4) VALUES (12.34); = 0 is inserted
INSERT INTO T1 (COL4) VALUES (12345.34); = 12300 is inserted. Should is not throw an error as the whole value should be of length 4 (including the precision).
However, INSERT INTO T1 (COL4) VALUES (123456789.34); throws error.How is this working? Please help!
Edited by: TuX4EvA on Sep 29, 2009 4:12 AMPlease, observe the following example:
CREATE TABLE test1
col1 NUMBER (6, 2),
col2 NUMBER (6, -1),
col3 NUMBER (6, -2),
col4 NUMBER (6, -3)
INSERT INTO test1 (col1, col2, col3, col4) VALUES (1234.89, 1234.89, 1234.89, 1234.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (1000.89, 1000.89, 1000.89, 1000.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (2020.02, 2020.02, 2020.02, 2020.02);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (56, 56, 56, 56);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (56.89, 56.89, 56.89, 56.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (20.89, 20.89, 20.89, 20.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (49.89, 49.89, 49.89, 49.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (50.89, 50.89, 50.89, 50.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (501.89, 501.89, 501.89, 501.89);
INSERT INTO test1 (col1, col2, col3, col4) VALUES (158.23, 158.23, 158.23, 158.23);
COMMIT;
SELECT * FROM test1;When you select from the table, you will receive:
col1 col2 col3 col4
1234,89 1230 1200 1000
1000,89 1000 1000 1000
2020,02 2020 2000 2000
56 60 100 0
56,89 60 100 0
20,89 20 0 0
49,89 50 0 0
50,89 50 100 0
501,89 500 500 1000
158,23 160 200 0From this example and according to the oracle documentation SQL Reference one could see that scale equal to -1 means to round the precision to the tens, -2 means to the hundreds, -3 - to the thousands and so on. But I cannot say it as well as it is said on page 44 from [Oracle Database SQL Reference|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200.pdf].
Hope it was useful :) -
What is the size of number data type.
what is the size of number data type (in term of memory storage ;byte ).
Does it make different in size if mention number(38,0)?
Thanks all in advance...:)
Edited by: user10648897 on Jan 7, 2009 6:43 AMNUMBER (p,s)
Number having precision p and scale s. The precision p can range from 1 to 38. The scale s can range from -84 to 127.number(38,0) = number(38)
http://download.oracle.com/docs/cd/B19306_01/server.102/b14196/schema002.htm#sthref472 -
Number data type and schematool kodo2.3.3
Hi!
I have a class that has a data member of type 'Number' (java.lang.Number).
When I run the 'schematool' to generate the tables in the datastore, it
seems to ignore this Number field. If i change the type to Integer or
Float, and then run schematool, a corresponding column is correctly
created in the table in the database. Is there anything special that needs
to be indicated in the metadata file for Number data types?
Thanks
VijayI have a class that has a data member of type 'Number' (java.lang.Number).
When I run the 'schematool' to generate the tables in the datastore, it
seems to ignore this Number field.It's pretty strnage, but the Number type isn't mentioned as a supported
persistent type in the JDO specification, and so Kodo doesn't yet support
it. I say it's strange because as you pointed out, all concrete subclasses
of Number are supported: Integer, Float, Double, BigDecimal, BigInteger,
etc.
We recently realized this oversite ourselves, and so supporting Number fields
is on our to-do list. For the time being, however, you're stuck with
declaring the field to be some conrete type. -
Table Functions, Direct Database Requests, and NUMBER data types
Hello. I call a number of table functions from our BI Enterprise server, and I've elected to do so using Direct Database Requests (I believe you can also call table functions in the physical layer of the repository, but that's not what I'm doing). The problem is that whenever I return any number from the table function that is not a whole number (1.23, for example), BI assigns the INTEGER datatype to the field instead of the DOUBLE datatype, thereby rounding my number to the nearest integer. Here's a concise example:
Create these 3 database objects:
CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER);
CREATE OR REPLACE TYPE my_tab AS TABLE OF my_row;
CREATE OR REPLACE FUNCTION my_table_function RETURN my_tab
PIPELINED IS
BEGIN
PIPE ROW(my_row(1.23));
END;
Then make this your query in your Direct Database Request:
SELECT my_num FROM table(my_table_function);
That query correctly returns "1.23" when it's called from the database. In BI, on the other hand, it returns "1" (and labels the field an INTEGER instead of DOUBLE data type). If in the Direct Database Request you change the Column Properties ->Data Format -> Decimal Places from 0 to 2, it then not surprisingly displays "1.00". I then tried changing MY_ROW.MY_NUM's datatype by explicitly specifying precision, and no luck. BI still labels this field as an INTEGER. Then I started trying to trick BI by massaging the SQL statement itself. None of the following worked:
SELECT to_number(my_num) as my_num2 FROM table(my_table_function);
SELECT my_num2 + 0.01 as my_num3 FROM (SELECT my_num - 0.01 AS my_num2 FROM table(my_table_function));
SELECT to_number(to_char(my_num)) as my_num2 FROM table(my_table_function);
SELECT to_number(substr(to_char('x'||my_num),2)) as my_num2 FROM table(my_table_function);
Now I did find a solution, but I'm surprised that I have to resort to this:
SELECT * FROM (SELECT /*+ NO_MERGE */ my_num FROM table(my_table_function));
Does anyone out there know of a better way to do this? The above is a hack in my opinion. :)
Thanks in advance for any input.
-JimYes, it's really amazing.
But I got it.
CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER(10,2));and in your SQL :
SELECT cast(my_num as double precision) as my_num2 FROM table(my_table_function);I have the good result and I see the numbers after the comma.
Very tricky !
Edited by: gerardnico on Jul 7, 2009 2:55 PM change number(10,2) by double precision ......... pfffff -
How to handle NUMBER data type of SQL
Hello All,
I have to call an Oracle store procedure developed by 3rd party, it has once of the input parameter as NUMBER.
Since NUMBER SQL data type is not support by PI 7.0 (http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm),
when I am execute this scenario, it through an error for - Unsupported parameter type 'NUMBER'.
I cannot change the store procedure or any thing in Oracle.
I gone through some thread but did not find any help. NUMBER type for Oracle SP
Please let me know if there any work around.
Thanks in Advance.
PradeepThanks for your reply.
I cannot customize the stored procedure parameter to NUMERIC, as this is standard SP is from a product.
Below is the final XML generated with error on PALC and PREL parameter for NUMBER, ideally it should be
<PALC isInput="true" type="NUMBER"/>
<PREL isInput="true" type="NUMBER"/>
<Statement xmlns="">
<LSA_REL_DM action="EXECUTE">
<table>ACQDR.lsa_rel_dm</table>
<PPROJECTID isInput="true" type="VARCHAR">85LJ24210</PPROJECTID>
<PDMC isInput="true" type="VARCHAR">LJ200-A-J00-00-00-00-00AAA-00K-AA</PDMC>
<PLCN isInput="true" type="VARCHAR"/>
<PALC isInput="true"/>
<PTYPE isInput="true" type="CHAR"/>
<PSOURCE_CODE isInput="true" type="VARCHAR"/>
<PREL isInput="true"/>
<PRFU isInput="true" type="VARCHAR"/>
<POBJECT isInput="true" type="BLOB"><dmodule xsi:noNamespaceSchemaLocation="C:/Projects/S1000D/Document/schema/TIR_Parts_Vendors.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><identAndStatusSection><dmAddress><dmIdent><dmCode modelIdentCode="LJ200" systemDiffCode="A" systemCode="J00" subSystemCode="00" subSubSystemCode="00" assyCode="00" disassyCode="00" disassyCodeVariant="AAA" infoCode="00K" infoCodeVariant="A" itemLocationCode="A"/><language languageIsoCode="US" countryIsoCode="sx"/><issueInfo issueNumber="0" inWork="1"/></dmIdent><dmAddressItems><issueDate year="20111107" month="20111107" day="20111107"/><dmTitle><techName>General</techName><infoName>Organizations technical information repository</infoName></dmTitle></dmAddressItems></dmAddress><dmStatus><security securityClassification="01"/><responsiblePartnerCompany enterpriseCode="24210"><enterpriseName>Learjet</enterpriseName></responsiblePartnerCompany><originator enterpriseCode="24210"><enterpriseName>Learjet</enterpriseName></originator><applicCrossRefTableRef><dmRef><dmRefIdent><dmCode modelIdentCode="LJ200" systemDiffCode="A" systemCode="J00" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="00W" infoCodeVariant="A" itemLocationCode="A"/></dmRefIdent></dmRef></applicCrossRefTableRef><brexDmRef><dmRef><dmRefIdent><dmCode modelIdentCode="LJ200" systemDiffCode="A" systemCode="J00" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="022" infoCodeVariant="B" itemLocationCode="D"/></dmRefIdent></dmRef></brexDmRef></dmStatus></identAndStatusSection><content><techRepository><partRepository/></techRepository></content></dmodule></POBJECT>
<PSTATUS isInput="true" type="CHAR">D</PSTATUS>
<PISSTYPE isInput="true" type="CHAR"/>
<POBJECT_CLASS isInput="true" type="VARCHAR">XML</POBJECT_CLASS>
</LSA_REL_DM>
</Statement>
Thanks in Advance -
Loading unpacked Zoned data into NUMBER data types
I need to use SQL*Loader to load data created on an MVS machine (EBCDIC) which is FTP'd to AIX (converted to ASCII during the FTP). Some of the data elements have signed unpacked numeric data. These need to be loaded into two types of fields in Oracle - 1) defined as data type NUMBER(19) 2) - defined as data type NUMBER (38,2) (i.e. dollar field with 2 decimal positions). For the dollar data I am loading there is an implied decimal. I need to know how to code SQL*Loader statements to handle these two situations. Because I have zoned unpacked source the resulting data loaded into the table must have a trailing sign (only if negative). Also the dollar fields need to have an explicit decimal inserted - and these dollar fields could also end up being negative.
Any help would be appreciated. Various google searches have not given me the answers I need.979755 wrote:
Most helpful. Pardon a few follow-on questions:
1. The Zoned definition refers (I hope) to the data on the input file - regardless of the definition of the field field being loaded in the table (in my case the field in the table is defined as NUMBER) - is this a true statement?
True, in your controlfile you set (for example): , zonedCol POSITION(x:y) ZONED(precision,scale)
2. If I am correct on item 1, if I have a negative number in the input file (let's say a negative 10) is a trailing sign loaded into the database (so it will be 10-)?
NO, to deal with signed numbers, you set trailing signs as table column in a staging table and then apply to real table.
3. What happens to any leading zeroes when the data is loaded into the table?
Ignored.
4. For dollar fields where the source has an implied decimal but I want an implicit decimal in loaded into the table and the number can be positive or negative, can I specify this as ZONED (10.2) in the control file?
See answer #2.
ZONED (10,2) implies field is 10 characters long and the last two are decimals.
5. And finally, regarding item 4 my understanding is that ZONED (10.2) would result in 12345678.12 (with a negative sign if appropriate) - is this a correct understanding?
Nope, only the digits. That is why we use staging table to capture the sign.
PS: The best would be to create external table on the source file.
Edited by: L-MachineGun on Jan 4, 2013 3:12 PM -
Number data-type saving problem through PL/SQL
hi,
I am having a field in my table called "amount" with type number(17,3). I am facing some problem while saving the data through pl/sql developer.
while i am inserting data like 123456789012.567 its working fine but when I am inserting 1234567890123.567 for amount field its now showing any error while saving, but actually its storing "1234567890123.570" in DB. Similar thing is happening when I was saving "12345678901234.567",actually its saving "12345678901234.600".
Whenever I was getting for 17 digits it's rounding last 3 and for 16 its rounding 2.
I am using oracle10g as DB server.
please suggest how to solve this particular problem as i am stuck or the alternate ways...
Thanks,
ShouvikIt is a display problem, not a storage problem. i'm not sure what the equivalent in PL/SQL Developer is, but this sqlplus example seems to replicate your stated issue.
SQL> create table t (num number(17,3));
Table created.
SQL> insert into t values (123456789012.567);
1 row created.
SQL> insert into t values (1234567890123.567);
1 row created.
SQL> insert into t values (12345678901234.567);
1 row created.
SQL> commit;
Commit complete.
SQL> set numwidth 16
SQL> select * from t;
NUM
123456789012.567
1234567890123.57
12345678901234.6
SQL> set numwidth 25
SQL> /
NUM
123456789012.567
1234567890123.567
12345678901234.567You need to expand the display width for numbers.
John -
Adding scale to a number data type
I have a current column that is Number(22) that has many rows in it. I would
like to keep the 22 and add 2 to the scale, can this be done on the fly????Why not try
ALTER TABLE a MODIFY num_col NUMBER( 24, 2);
and see what happens. If it works you are done. If not add a column number(24,2), update the table to set the new column = to the old column, alter that table to drop the old column, alter the table to rename the new column to the old columns name. Or set the old column null, modify it, update back to it from the new column, then drop the new column, or use DBMS_REDEFINITION.
It is well to try something before coming here for a solution. Then tell us what you have tried and the results. -
Why there is no datatype which only stores date (without time part)
Hi All,
Is there any specific reason for not having a data type which only stores date (without time part) in ORACLE - I am asking this because DATE (without time) is a very frequently used data type in any application.
Thanks.884476 wrote:
Then why ORACLE is allowing to have scale and precision in a NUMBER data type. If I want to store an integer there is no harm in storin it just as NUMBER. But I habe option to give something like NUMBER(10). But in DATE, the time part is mandatory.a) because there's no need for seperate DATE and DATETIME datatatypes, and b) the time part is not 'mandatory'.
SQL> create table mytable (x date);
Table created.
SQL> insert into mytable (x) values (to_date('01/01/1980','DD/MM/YYYY'));
1 row created.
SQL>The DATE datatype contains the Time as well, to make it flexible... a single datatype that can do both things without the need for any conversion between datatypes (either explicitly or implicitly).
Yes, many application need to have fields on the screen that just show a date, such as a date of birth as you say, but that's simply a display issue, and any application interface will allow for a date format to be specified for displaying the data from the database, so in terms of such "Date only" dates, you would simply use a format mask that ignores the time portion.
There's absolutely no issue with the fact that it's just a single datatype... it causes no problems... it's perfectly flexible at being used for just dates or for dates and times... so why such a concern? -
Core data: Versioned model migration with change in existing attribute data types.
Hi ,
I want to upgrade my ios app with app store version with enhancement of new functionality related to core data features in the app.
-In new upgarde version, I want to change data types of attribute which is already present in core data model of existing app store version.
e.g.In Version 1.0 ,Attribute "date" datatype is "NSDate", New change required to change datatype "NSDate" to "NSString" with new version model.
I followed Lightwaight migration, but as per documentation , Lightwaigh migration not support for change data type of any existing attribute/entity of core data model.
Please suggest optimized solution for migration of database along with change in data type of exsiting attribute of the entity in core data.
If required in further info ,please ask.
Thanks in advances.
Regards,
LaxmikantMore Info: The two entries are actually pointing to the same object. If I save the context and restart, I only have one entry (I can also see this by looking at the XML store).
It seems that the NSTableView is getting messed up somehow after the FetchRequest. Still stumped. -
Displaying "N/A" in report fields where Number data is not valid using a formatting formula
Post Author: Horizon57
CA Forum: General
I have many reports which are populated by "Number" data. However, there are certain charts and tables where the number data is not appropriate and the summation of such data does not add value to the report. In these instances I would like to display "N/A", however the formula I am using keeps giving me an error that I need to use a "Number" data type. Please note this is a formatting formula.
Formatting Formula
DO{TREND.EPTP1} = 'N/A' AND{TREND.EPTP2} = 'N/A' AND{@Trend %} = 'N/A' WHILE {TREND.POS2} = 'TOTAL';
Can anyone assist me with displaying "N/A"?Post Author: V361
CA Forum: General
Try this
DOtotext ( {TREND.EPTP1} ) = 'N/A' ANDtotext ( {TREND.EPTP2} ) = 'N/A' ANDtotext ( {@Trend %} ) = 'N/A' WHILE {TREND.POS2} = 'TOTAL';
Maybe you are looking for
-
Sharing two computers on the same network
I have a mac mini and a mac air and wish to synch/share the entire Itunes with each other. I have turned on home sharing but do not see the devices listed with each other. They are both on the same network and can be seen by apple tv.
-
Boot Camp failure installing windows??
Hi all, I have been trying to install windows for few days now with no success. I have a Macbook Pro (Uni) 17" with OS X 10.6.8 and boot camp 3.0.4. Started few days ago by partitioning the hard disc, assigning 35 gigs for the windows (to be) partiti
-
Preloader Code: Error 1061
I bought a preloader on Flashden.com and it didn't come with much instruction. Here is what I have done: My index file has my timeline with actions, preloader, and then my movie clips for my opening page. I have placed my preloader movieclip in frame
-
End users get blank result from VC model calling an R/3 BAPI.
Hello everyone. We have build a VC model calling a Z*BAPI that we built in the R/3 backend. Everything works fine through DEV and QAS. However in our production environment when an end user attempts to run the VC application and search for a record
-
How to define an new New transaction type in SRM Environment?
Hi All, There is a situation where in I have to add anew transaction type and link it to the existing process. If I am going to SPRO->SRM->SRM Server -> Cross appl.Basic Setting -> Define transaction type It gives me an un editable screen. My questio