External table.How to load numbers (decimal and scientific notation format)
Hi all, I need to load inside an external table records that contain 7 fields. The last field is called AMOUNT and it's represented in some records with the decimal format, in others records with the scientific notation format as, for example, below:
CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Jan;11200100;'60800;CYZ900;41380,77
The External table's script is the following:
CREATE TABLE HYP_DATA
COUNTRY VARCHAR2(50 BYTE),
YEAR VARCHAR2(20 BYTE),
PERIOD VARCHAR2(20 BYTE),
ACCOUNT VARCHAR2(50 BYTE),
DEPT VARCHAR2(20 BYTE),
ACTIVITY_LOC VARCHAR2(20 BYTE),
AMOUNT VARCHAR2(50 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY HYP_DATA_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'HYP_BAD_DIR':'HYP_LOAD.bad'
DISCARDFILE 'HYP_DISCARD_DIR':'HYP_LOAD.dsc'
LOGFILE 'HYP_LOG_DIR':'HYP_LOAD.log'
SKIP 0
FIELDS TERMINATED BY ";"
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
"COUNTRY" Char,
"YEAR" Char,
"PERIOD" Char,
"ACCOUNT" Char,
"DEPT" Char,
"ACTIVITY_LOC" Char,
"AMOUNT" Char
LOCATION (HYP_DATA_DIR:'Total.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
If, for the field AMOUNT I use the datatype VARCHAR (as above), the table is loaded but I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation as:
CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Feb;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Mar;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Dec;11220020GR;'03900;CYZ900;-9,99999999839929e-03
All the others records with a decimal AMOUNT are loaded correctly.
So, my problem is that I NEED to load all the records (with the decimal and the scientific notation format) together (without records rejected), but I don't know which datatype I have to use for the AMOUNT field....
Anybody has any idea ???
Any help would be appreciated
Thanks in advance
Alex
@OP,
What version of Oracle are you using?
Just cut'n'paste of you script and example woked FINE for me.
however my quation is... An external table will LOAD all data or none at all. How are you validating/concluding that...
I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation
select * from v$version where rownum <2;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
select * from mydata;
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Feb 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11200100 '60800 CYZ900 41380,77
CY001_STATU 2009 Mar 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Dec 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11200100 '60800 CYZ900 41380,77MYDATA table script is...
drop table mydata;
CREATE TABLE mydata
COUNTRY VARCHAR2(50 BYTE),
YEAR VARCHAR2(20 BYTE),
PERIOD VARCHAR2(20 BYTE),
ACCOUNT VARCHAR2(50 BYTE),
DEPT VARCHAR2(20 BYTE),
ACTIVITY_LOC VARCHAR2(20 BYTE),
AMOUNT VARCHAR2(50 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY IN_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'IN_DIR':'HYP_LOAD.bad'
DISCARDFILE 'IN_DIR':'HYP_LOAD.dsc'
LOGFILE 'IN_DIR':'HYP_LOAD.log'
SKIP 0
FIELDS TERMINATED BY ";"
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
"COUNTRY" Char,
"YEAR" Char,
"PERIOD" Char,
"ACCOUNT" Char,
"DEPT" Char,
"ACTIVITY_LOC" Char,
"AMOUNT" Char
LOCATION (IN_DIR:'total.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;vr,
Sudhakar B.
Similar Messages
-
External table: How to load data from a fixed format UTF8 external file
Hi Experts,
I am trying to read data from a fixed format UTF8 external file in to a external table. The file has non-ascii characters, and the presence of the non-ascii characters causes the data to be positioned incorrectly in the external table.
The following is the content's of the file:
20100423094529000000I1 ABÄCDE 1 000004
20100423094529000000I2 OMS Crew 2 2 000004
20100423094529000000I3 OMS Crew 3 3 000004
20100423094529000000I4 OMS Crew 4 4 000004
20100423094529000000I5 OMS Crew 5 5 000004
20100423094529000000I6 OMS Crew 6 6 000004
20100423094529000000I7 Mobile Crew 7 7 000004
20100423094529000000I8 Mobile Crew 8 8 000004
The structure of the data is as follows:
Name Type Start End Length
UPDATE_DTTM CHAR 1 20 20
CHANGE_TYPE_CD CHAR 21 21 1
CREW_CD CHAR 22 37 16
CREW_DESCR CHAR 38 97 60
CREW_ID CHAR 98 113 16
UDF1_CD CHAR 114 143 30
UDF1_DESCR CHAR 144 203 60
UDF2_CD CHAR 204 233 30
DATA_SOURCE_IND CHAR 294 299 6
UDF2_DESCR CHAR 234 293 60
I create the external table as follows:
CREATE TABLE "D_CREW_EXT"
"UPDATE_DTTM" CHAR(20 BYTE),
"CHANGE_TYPE_CD" CHAR(1 BYTE),
"CREW_CD" CHAR(16 BYTE),
"CREW_DESCR" CHAR(60 BYTE),
"CREW_ID" CHAR(16 BYTE),
"UDF1_CD" CHAR(30 BYTE),
"UDF1_DESCR" CHAR(60 BYTE),
"UDF2_CD" CHAR(30 BYTE),
"DATA_SOURCE_IND" CHAR(6 BYTE),
"UDF2_DESCR" CHAR(60 BYTE)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER DEFAULT DIRECTORY "TMP"
ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE
CHARACTERSET UTF8
STRING SIZES ARE IN BYTES
NOBADFILE NODISCARDFILE NOLOGFILE FIELDS NOTRIM
( "UPDATE_DTTM" POSITION (1:20) CHAR(20),
"CHANGE_TYPE_CD" POSITION (21:21) CHAR(1),
"CREW_CD" POSITION (22:37) CHAR(16),
"CREW_DESCR" POSITION (38:97) CHAR(60),
"CREW_ID" POSITION (98:113) CHAR(16),
"UDF1_CD" POSITION (114:143) CHAR(30),
"UDF1_DESCR" POSITION (144:203) CHAR(60),
"UDF2_CD" POSITION (204:233) CHAR(30),
"DATA_SOURCE_IND" POSITION (294:299) CHAR(6),
"UDF2_DESCR" POSITION (234:293) CHAR(60) )
) LOCATION ( 'D_CREW_EXT.DAT' )
REJECT LIMIT UNLIMITED;
Check the result in database:
select * from D_CREW_EXT;
I found the first row is incorrect. For each non-ascii character,the fields to the right of the non-ascii character are off by 1 character,meaning that the data is moved 1 character to the right.
Then I tried to use the option STRING SIZES ARE IN CHARACTERS instead of STRING SIZES ARE IN BYTES, it doesn't work either.
The database version is 11.1.0.6.
Edited by: yuan on May 21, 2010 2:43 AMHi,
I changed the BYTE in the create table part to CHAR, it still doesn't work. The result is the same. I think the problem is in ACCESS PARAMETERS.
Any other suggestion? -
How to load master data and hierarchies from R/3 systems
HI all,
how to load master data and hierarchies from R/3 systems.
Please explain the steps.
Thanks,
cheta.HI,
Its normally done following: Transferring the master datasources in RSA5 to RSA6 and then replicating the DS into BW and assignment of DS to Infosource and cretaion of Infopackage and load it into the master tables.
Generally, the control parameters for data transfer from a source system are maintained in extractor
customizing. In extractor customizing, you can access the corresponding source system in the source
system tree of the SAP BW Administrator Workbench by using the context menu.
To display or change the settings for data transfer at source system level, choose Business
Information Warehouse → General Settings → Maintaining Control Parameters for Data Transfer.
Note: The values for the data transfer are not hard limitations. It depends on the DataSource if these
limits can be followed.
In the SAP BW Scheduler, you can determine the control parameters for data transfer for individual
DataSources. You can determine the size of the data packet, the number of parallel processes for
data transfer and the frequency with which the status IDocs are sent, for every possible update
method for a DataSource.
To do so, choose Scheduler → DataSource → Default Settings for Data transfer.
In this way you can, for example, update transaction data in larger data packets in the PSA. If you
want to update master data in dialog mode, smaller packets ensure faster processing.
Hope this info helps.
Thanks,Ramoji. -
My MacBook Pro hard drive is almost full and I wish to store my Aperture Library on an external drive, how do I do this and is the use of USB2 suitable or do I need to use a Firewire external hard drive?
You'll get better performance if you use a Firewire hard drive (especially if you buy a 7200 RPM drive). Firewire's IO speed is significantly faster than USB 2. USB 2 has a theoretical max speed of 480 Mbps except that it has extremely high over-head. The fastest speeds you can typically get are about 300 Mbps. Firewire, on the other hand, has very little overhead. The fastest speeds you can get are very nearly 800 Mbps. You will typically be constrained by the maximum read/write speed of the drive, not the speed of the I/O on the Firewire bus. Now if you had one of those nice shiny new Macs with the Thunderbolt I/O and a Thunderbolt drive (Light Peak) ... I think they alter space and time so that your data arrives before you know you want it.
Also... unless you want to buy a solid state drive (very expensive), try to keep your hard drives from becoming much more than about 60% full if you want great performance. A nearly "full" hard drive is, on average, only about half as fast as the same hard drive when nearly empty.
USB 2 will work perfectly fine... just not as fast.
Also... it's much safer to move the entire Aperture library than to "relocate masters". Your images must be managed. You can Aperture manage them, or you can manage them. But someone has to manage them. If you "relocate" them so that they are no longer stored inside the Aperture library then you'll need to work out a system of how you decide to organize things and it's critically important that you don't start moving files around or deleting things without Aperture's knowledge. If you do, you'll break the links to your masters and start having problems with missing masters. If you have Aperture manage the library then you don't need to worry about any of that stuff.... it's safer.
Do make backups (use the Aperture Vault or use some other backup program, but make sure you back up your work if you care about it.) There are only two kinds of hard drives in the world: (1) those that have failed and (2) those that are going to fail. There are no exceptions to this rule. Hard drives are cheap. Backup software is built into Aperture and into your Mac. -
Decimal Format and Scientific Notation
I am trying to print numbers in scientific notation using the Decimal Format class. What follows is a simple test program I wrote to find the bug. So far, I have not found a solution.
import java.text.*;
public class formatted {
public static void main (String Arguments[]) {
DecimalFormat form = new DecimalFormat("0.###E0");
double numb = 123456.789;
System.out.println("Nuber is: " +
form.format(numb));
The output of this program is... Nuber is: 123456E
The output is the same if numb is an int, float, or double. If I format the number as "#####.0" or "#####.00" the output is correct. I think that I am following the rules for formatting a number in scientific notation as the process is outlined in the documentation (provided below).
***** From Decimal Format under Scientific Notation ***
Numbers in scientific notation are expressed as the product of a mantissa and a power of ten, for
example, 1234 can be expressed as 1.234 x 10^3. The mantissa is often in the range 1.0 <= x < 10.0,
but it need not be. DecimalFormat can be instructed to format and parse scientific notation only via a
pattern; there is currently no factory method that creates a scientific notation format. In a pattern,
the exponent character immediately followed by one or more digit characters indicates scientific
notation. Example: "0.###E0" formats the number 1234 as "1.234E3".
Anyone understand how the short program is incorrectly written?
MarcThe problem is
format = "0.###E0"
input number = 123456.789
output = 123456E (not scientific notation!)
This is not scientific notation at all. There is no decimal point given and no value in the exponent.
I understand entirely that by adding more #'es will provide more precision. The bug I have is the output is not printed in the scientific format; other formats work.
MArc -
I need how to load data from MS Excel(csv format) to NW Excel
Hi,
I am doing Migration project from SAP MS to NW Manually.
I need how to load data from MS excel (csv format) to NW excel .
For example 2008 budget data.
Could you please help me in this.
Thanks and Regards
KrishnaHi,
You need to create a transformation file and a conversion file if required. First upload the excel (csv) file into BPC using Manage Data and Upload File option.
Create the transformation file (refer to the sap help on how to define a transformation file). You need to specify the mapping correctly and include all your application dimensions and map them to appropriate columns of the flat file.
Before running the import package, do validate the data in the flat file you uploaded into BPC with the transformation file you created.
Thanks,
Sreeni -
To_number and scientific notation
Hi
I am trying to convert a number in scientific notation stored in a character ffield to a number.
I use this statement, but gets a ORA-01722 error.
What is wrong ?
select to_number('1.1111111111111112E-6','9.9EEEE')
from dual
PrebenHi guys, I'm following this forum in order to reuse what you wrote, but I still have a problem with the scientific notation format...
From SQL Plus If I run this query:
select b.CONTRACT_NUMBER,b.id as cont_id from OKC_K_HEADERS_B b--, okc_k_lines_b v
where b.contract_number = 'NR19Mini'
I retrieve the following row:
CONTRACT_NUMBER CONT_ID
NR19Mini 1.4733E+38where the CONT_ID datatype is NUMBER.
Now I want to specify a condition using the CONT_ID field (for another use in the future), but if I use the following syntax
select b.CONTRACT_NUMBER,b.id as cont_id from OKC_K_HEADERS_B b
where b.contract_number = 'NR19Mini'
and b.id = to_number('1.4733E+38','9.99999EEEE');
I don't retrieve any rows (no rows selected)
How can I modify the format number in order to see my row, and for example use it inside a join with another fied of the same type ?
Thanks in advance
Alex -
Calculator.app Version 4.5.3 (99.2) and Scientific Notation
I want to enter a number with scientific notation.
2.71e1 doesn't return 27.1, but rather 0.999...
It seems that Calculator.app is dividing by e.
This is not a common operation.
2.71E1 gives 27.1great! But ...
2.71E-1 does not return 0.271 neither does
2.71E(-1)
I have yet to figure out how to use negative exponents in Scientific notation.
This seems to be a bug in Calculator.app Version 4.5.3 (99.2)All my spaces were deleted.
Take two.
My input ======= Calculator
2 ============ 2
2. ============ 2.
2.7 =========== 2.7
2.7E ========== 2.7 E 0
2.7E- ========== 2.7 (and the small - subscript indicating a negative number)
2.7E-1 ========= 1 (and the small - subscript indicating a negative number)
Now hitting enter === 1.7 (it appears to have subtracted 1 from 2.7)
Do our version of Calculator match?
Thanks for being interested. -
External Table vs SQL Loader.
Hi,
Pls anybody can tell me what is the significant differences between external table and SQL Loader.Both fall into category of Oracle utilities
[SQL*Loader|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm#i10606] is the one that loads data into Oracle tables from operating system files and [external table|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm#i10611] is the one that
is providing functionality similiar as SQL*Loader in the means of accessing external data but with with a different logic and rules,it lets you access data in external sources as if they were in a table in the database. -
Office 365 Shared External Contacts - how do I delegate Edit and Update permissions to users
Hello
Office 365 Shared External Contacts - how do I delegate Create/Update/Delete/Edit permissions to users who are not Admins? These Contacts are in the Global Address List. Not Outlook personal Contacts. O365 Small Business PremiumHi,
To grant users delegate permissions, open Outlook, go to FILE -> Info -> Account Settings -> Delegate Access -> Add -> Search and add the user, click OK -> Edit the permission of the user. We can set different permissions in the dropbox
of Contacts.
There are four permisssions for Contacts:
1. None
2. Reviewer (can read items)
3. Author (can read and create items)
4. Editor (can read, create, and modify items)
Select the permission that you want to grant the user.
We can also modify the permission later in this section.
I hope the information is helpful, if I misunderstood anything, feel free to correct me and provide more detailed description of the question.
Regards,
Melon Chen
Forum Support
Come back and mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback on our support, please click
here -
How to load item level and location level member in demantra
This is in context where we are not using any integration of demantra with either Ebiz or E1 system.
Data is present in flat file.
As per i know, integration interface can only export the data for item level and location level but can not import data for these level.
the second thing i know is that when we create data model then load_data.bat file should have been created in Demand Planner/Desktop directory. But this didn't got created. So i am not able to use load_data.bat file for uploading data.
The third place ,i think is from worksheet thru edit method ( i am not sure about this).
But i want to upload the data in bulk for item level and location level. Can it be done without any customization i.e without creating any sql loader file etc ??Hi Abhishek,
The standard practice to load data for items/ locations and sales is through the DATA MODEL definition only. One should use LOAD_DATA.BAT file in normal scenario for loading data into Demantra staging tables from tEXT files.
In case you are having trouble with loading data using LOAD_DATA.BAT file, then do the following:
- modify your DM definition to Data tables instead of flat files
- use SQL loader to upload data in correct format into Demantra's staging tables "T_SRC_XXX"
- Run EBS Full Download workflow to download data into demantra's main tables.
Integration interfaces should not be used to load basic sales data into Demantra.
Hope this helps.
Thanks
Raj
(http://oracledemantra.blogspot.com) -
How to Load a data for database when format is different??
Hai all...
I have problem in Apex while loading the data to a database from external files..
Like i have my project input data in spreadsheet format..I wanted to load that in to Database..
But sequence and column names are different in spreadsheet and database tables.
My problem is like.....
In manual input format(spreadsheet) column names are employee names and while loading that to database i want to load that in a separate column named emp_name..
It looks as below
Manual data is like this:
WEEK ENDING DATE Abc Xyz Pqr
15-Nov-08 71.4 50 100
22-Nov-08 76.9 100 100
i have database table like this
Column Name Data Type
EMP_NAME VARCHAR2(100)
WEEK_END_DATE DATE
PERCENTAGE NUMBER(2,0)
So I should be able to store like this
Emp_name Week_end_date Percentage
Abc 15-Nov-08 71.4
Xyz 15-Nov-08 50
Pqr 15-Nov-08 100
Abc 22-Nov-08 76.9
Xyz 22-Nov-08 100
pqr 22-Nov-08 100
But i am not able to get that..
Can any one suggest me how to do that in Apex..??
Should I use SQL loader for that???or do I have any option in Apex??or i should go for C program??
Thanks and Regards
ShanHello Shan,
You can access a CSV as an "External Table" (search on that). Then you can access the CSV as it was a 'normal' table and process data into your real tables.
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
How to load a flat file with utf8 format in odi as source file?
Hi All,
Anybody knows how we can load a flat file with utf8 format in odi as source file.Please everybody knows to guide me.
Regards,
SaharCould you explain which problem are you facing?
Francesco -
Numberformatter and scientific notation
Hello all. I'm having an issue with Numberformatter that I could use some assistance with. It looks like this:
<mx:NumberFormatter id="numberFormatter"
precision="6"
rounding="up"
useThousandsSeparator="false"
useNegativeSign="true"/>
I'm applying it to a Number object that was created from a deserialized java BigDecimal. In most cases, this is successful. So, 0.000024603877571 becomes 0.000025 and so on.
However, in some cases, my Number is in scientific notation like "0E-15". In this case, the NumberFormatter formats the number as -15.000000. Not helpful. Any ideas on what is going on and how I might could work around it?Thanks for the quick response, Michael. I was about to simply change the sending of the numbers as a string when I decided to try one more thing. If I use toFixed() on my number first (before the NumberFormatter.format() function) it seems to fix the issue. So, for example, in my label function for a column of a datagrid that has Numbers that sometimes appear in scientific notation, I do something like this:
public function myNumberLabelFunction(item:Object, column:DataGridColumn):String
var myNumber:Number = item.number;
var myNumberString:String = myNumber.toFixed(20);
return numberFormatter.format(myNumberString);
That (toFixed) appears to not mess up the regular numbers as well as the ones that have E notation. I don't know if anyone has any thoughts on the workaround. It seems to work find since my formatter is ultimately rounding to a precison of 6. -
Double and scientific notation
Hi,
I am using a Double to store data but when i output it the value
is printed in scientific notation example, 2.3333E5..I want to print it as decimal without the 'E' notation, is there a way to format it or set the precision in Java???
Many ThanksYou can have a look at NumberFormat and also search this forum because it's a frequently asked question.
Maybe you are looking for
-
Can You Daisy Chain Firewire 400 and 800 Mixed?
I would like to purchase an External Drive. I'm looking at a FW800. What I'm wondering is, Can I daisy chain devices mixed in. I Want to run a FW800 Bilingual cable from my Powerbook to the External Enclosure. From the Ext. Enclosure, I'd like to hav
-
i have three servers . DC + MDT/WDS + SQL i installed SQLExpress with SQL Management Studio 2012 when i tried to create my databse from MDT/WDS server i get an error : 40 provider: Named Pipes Provider, error: 40 - Could not open a connection to
-
Hi, I need to know the formula and method followed by an easy example for calculating the valued quantity? This quantity appears while updating the average cost of an item.
-
How do I import my itunes plalists into Mavericks from time machine backup
I just did a clean install of Mavericks, and it won't let me restore iTunes from my Time Machine backup. I imported all the media, but I can't import the playlists. When I grab a playlist file, I get "it doesn't appear to be exported." Any ideas ab
-
Might my computer have been hacked? It clicks like I am doing something and I am Not? Please Help someone???