Date format in external table
Hi All,
I have a flat file which has date field that looks like '2007-08-09 19:04:03.597000000'. I have to create an external table to read the file. I tried giving these two date formats 'yyyy-mm-dd hh24:mi:ss.ff' and 'yyyy-mm-dd hh24:mi:ss.ms'. But none of them works. what should be the date format to be mentioned in external table defnition?
The external table defnition is like
CREATE TABLE EXT_TEST
( "ID" NUMBER(10,0),
"DATE_COL" DATE
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "EXT_TAB_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL(
ID,
"DATE_COL" DATE "yyyy-mm-dd hh24:mi:ss.ff"
LOCATION
( 'test.dat'
REJECT LIMIT UNLIMITED;
Thanks
Thanks for the help,
I have one more date column and the format is like 1/31/2007 4:03:56 PM. The external table defnition looks like
CREATE TABLE EXT_TEST
( "ID" NUMBER(10,0),
"DATE_COL" DATE
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "EXT_TAB_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL(
ID,
"DATE_COL" char date_format date mask "M/d/yyyy h:mm:ss tt"
LOCATION
( 'test.dat'
REJECT LIMIT UNLIMITED;
But this again gives an error. Is this the correct date format?
Similar Messages
-
Uploading data from an external table with a where clause
Hi,
How do insert data from an external table in to a table already created in the database where person_id = person-_id on the external table?
Example:
External table
XX_EXTERNAL_TBL (Person_id, emp_number, emp_name)
Internal table
XX_SQL_LOADER_TEST (Person_id, emp_number, emp_name)
and person id already exists on the internal table (only want the last to columns to import where the person ids are the same)
ThanksINSERT
INTO XX_SQL_LOADER_TEST
SELECT *
FROM XX_EXTERNAL_TBL
WHERE Person_id IN (
SELECT Person_id
FROM XX_SQL_LOADER_TEST
/SY. -
How to load external data without using external tables
Hi,
I'm asked to develop an ETL for loading external data into a database but, unfortunately, the vers. is 8i so I can't use external tables.
I know that it's possible by using SQL-Loader. What I want to know is whether there's another way in 8i to load external data from a text file or a CSV file directly with a stored procedure without having to write CTL of SQL-Loader on the server. I mean, is there a way to write everything on the database the same manner I'd do whether I wrote data from a table to a file using for example UTL_FILE or the unique way is to write control files of SQL-Loader directly on the server?
Thanks!Mark1970 wrote:
Thank you very much Karthick
I didn't know I could use UTL_FILE also for reading files. I've always use it only for writing data into external files.Yes you can use UTL_FILE to read. The version of oracle you are using i last used in 2004 :) Still remember giving the OS path of the file to open the file. That is long gone now. Its surprising that you are still in 8i. -
Hi
I have Csv file in UTF-8 format have fields like data
2012/02/23, XXXXXX( all 2byte characters),........................................
When i import it says invalid number for 2012/02/23.
I created table like this
Create column table Schema1.table (
SHOD DATE,
MANUD DATE,
and
Create column table Schema1.table (
SHOD VARCHAR(10),
MANUD VARCHAR(10),
both does not allow me to store data into table..any idea please.
Regards
MagalingamHi,
If you are using the .ctl file to import .CSV files into HANA, the default source date format is YYYYMMDD. However, if say your source format is in the YYYY/MM/DD format for e.g... you can change your IMPORT statement as follows:
IMPORT FROM '<file_location>.ctl' WITH THREADS 16 BATCH 200000 DATE FORMAT 'YYYY/MM/DD';
It is worth noting the SYTAX of the IMPORT statement as you could transform TIME and TIMESTAMP fields similarly:
IMPORT FROM [<file_type>] <file_path> [INTO <table_name>] [WITH <import_from_option
_list>]
<file_type> ::= CSV FILE | CONTROL FILE
<file_path> ::= '<character>...'
<table_name> ::= [<schema_name>.]<identifier>
<import_from_option_list> ::= <import_from_option> | <import_from_option_list> <import_from_option>
<import_from_option> :: =
THREADS <number_of_threads> |
BATCH <number_of_records_of_each_commit> |
TABLE LOCK |
NO TYPE CHECK |
SKIP FIRST <number_of_rows_to_skip> ROW |
COLUMN LIST IN FIRST ROW |
COLUMN LIST ( <column_name_list> ) |
RECORD DELIMITED BY '<string_for_record_delimiter>' |
FIELD DELIMITED BY '<string_for_field_delimiter>' |
OPTIONALLY ENCLOSED BY '<character_for_optional_enclosure>' |
DATE FORMAT '<string_for_date_format>' |
TIME FORMAT '<string_for_time_format>' |
TIMESTAMP FORMAT '<string_for_timestamp_format>' |
Thanks,
Anooj -
Hi Experts,
I have had an excellent experience of getting expert answers here. I am again facing a small issue -
I have a form with a tabl ui element which gets populated with some values from the backend.
One of the field in the table is date. So i have a binding with the table with a node with attributes where one of the fiel in the table is date so is bound with an attribute in that node with date type DATS. Now the requirement of the client is that they want the date field in the table (on the form ) to be displayed in the form of mm/dd/yy and not mm-dd-yy. Right now it is being displayed as
mm-dd-yy. Is there any way to display the field in the table on the form in the form of mm/dd/yy ???
Thanks in advance for the help.see this thread if this helps you [Date format : DD-MMM-YYYY ???|Date format : DD-MMM-YYYY ???]
-
Problem in Date format display at table leve in 3.1i System
Hi Team,
I am facing an issue in 3.1i Prod System.
When i go and check at SE16 transaction and table name is TCURR. Execute the same i am getting date displayed in an unknown format.
For Eg:
Valid From Date
79908769
When i double click the same record, it displays the correct date format:
12/30/2009
when i download the table contents into excel sheet it should display the correct date format: instead of 79908769 to 12/30/2009.
But my problem is either to display the proper format of date at the table level.
Is there anyway to download the contents in correct dated format without disturbing the data elements or domain at table level.
Please let me know how to solve this problem.
Thanks,
Sunil KumarYou need to write abap program to download into the required format.
once you get the date field in your work area...
say you have date field in wa_data-budat , after that use the above syntax you will get the required format.
DATA :
v_date type sy-datum.
write wa_data-budat to v_date MM/DD/YYYY.
Please let me know if you need further information.
Regards
Satish Boguda -
Data format in the table(THTMLB:CELLERATOR)
Hi All,
I want to format the data in the table.
In my case I want the date field to be displayed in MM/DD/YYYY(currently it is displaying as YYYYMMDD) format. For table display I am using "THTMLB:CELLERATOR".
I tried using the interface method: IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START but it is not triggering at all.
Thanks in advance.
-ChandraThe issue has been resolved. Need to initialize the iterator in the do_init_context.
-
Date format from J_1IEXCTAX table...
Dear All,
DATA dt type d.
dt1 = sy-datum.
SELECT SINGLE RATE ECSRATE J_1IADDRAT1 FROM J_1IEXCTAX INTO
(ITAB-RATE,ITAB-ECSRATE,ITAB-J_1IADDRAT1) WHERE J_1ICHID = ITAB-J_1ICHID AND
J_1IEXCIND = ITAB-J_1IEXCICU AND
( VALIDFROM >= dt1 AND VALIDTO <= dt1 ).
Where as in table J_1IEXCTAX date format is different and i am not getting output. VALIDFROM and VALIDTO fields is in text.
How to get data ? waiting for reply.
Yusuf
Edited by: YUSUF BHORI on Mar 4, 2010 12:40 PM
Edited by: YUSUF BHORI on Mar 4, 2010 12:41 PMThere are different Convertions required for different applications.
You can check this at domain level of field.
Check this from SAP help.
Conversion Routine
Conversion takes place when converting the contents of a screen field from display format to SAP-internal format
and vice versa and when outputting with the ABAP statement WRITE, depending on the data type of the field.
If standard conversion is not suitable, it can be overridden by specifying a conversion routine in the underlying domain.
A conversion routine is identified by its five-place name and is stored as a group of two function modules.
The function modules have a fixed naming convention. The following function modules are assigned to
conversion routine xxxxx:
CONVERSION_EXIT_xxxxx_INPUT
CONVERSION_EXIT_xxxxx_OUTPUT
The INPUT module performs the conversion from display format to internal format. The OUTPUT module performs the
conversion from internal format to display format.
If a screen field refers to a domain with a conversion routine, this conversion routine is executed automatically each
time an entry is made in this screen field or when values are displayed with this screen field. -
Invalid data format on EXPORTING table to SQL-FLAT FILE (Insert type)
Hi there!
Writing from Slovenia/Europe.
Working with ORACLE9i (standard version) on Windows XP with SQL-deloper 1.0.0.015.
FIRST SQL.-DEVELOPER IS GOOD TOOL WITH SOME MINOR ERRORS.
1.) Declare and Insert data EXAMPLE
drop table tst_date;
create table tst_date (fld_date date);
insert into tst_date values (sysdate);
insert into tst_date values (sysdate);
2.) Retriving date with SQLPLUS
SQL> select to_char(fld_date,'DD.MM.YYYY HH24:MI:SS') FROM TST_DATE;
23.10.2006 11:25:23
23.10.2006 11:25:25
As you see TIME DATA IS CORRECT.
When I EXPOPRT data TO SQL-insert type I got this result IN TST_DATE.SQL file:
-- INSERTING into TST_DATE
Insert into "TST_DATE" ("FLD_DATE") values (to_date('2006-10-23','DD.MM.RR'));
Insert into "TST_DATE" ("FLD_DATE") values (to_date('2006-10-23','DD.MM.RR'));
As you seel I lost TIME DATA.
QUESTION!
HOW CAN I SET PROPER DATE FORMAT IN SQL-DEVELOPER BEFORE I EXPORT DATA TO FLAT FILE.
Best regards, Iztok from SLOVENIA
Message was edited by:
DEKUSA DATE-Field, is a DATE-Field and not a
DATE-TIME-Field.
The export-tool identifies a DATE-Field and exports
the data into date-format.This is not true. Oracle DATE fields include a time element.
To the original poster - I believe this is a bug in the current version.
See this thread for possible workarounds Bad Export format --- BUG ???
Message was edited by:
smitjb -
How to get the Date format inside the table
I have a startdate column in the db in the format May 5, 2001 12:39:00 PM, when I query it from a view in this way : SELECT startdate, ... FROM ..., it returns the format in the db,
However I have to do this SELECT
decode(startdate, null, 'NOT START'), startdate), ... the result is 5-MAY-01,
then I tried this to_char(startTime, 'Month DD, YYYY HH:MI: A.M.') the results become May 05, 2001 12:39:00 PM. (more space between month and day, and 05 instaed of 5)
Does anybody know how to fix this, so I get exactly what is in the db?
Thanks in advanceNo matter what you do if you are storing a date in a column it will get stored in the Oracle's internal 7 byte date format.
The way you get it on retreiving it is as set by your date format. You can either change the default date format for the instance, the individual session or the individual SQL statement(in this case using to_char(date, 'format')).
If you want to store the date in a format you want to store you'll have to store it as char or varchar2.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by George ([email protected]):
I have a startdate column in the db in the format May 5, 2001 12:39:00 PM, when I query it from a view in this way : SELECT startdate, ... FROM ..., it returns the format in the db,
However I have to do this SELECT
decode(startdate, null, 'NOT START'), startdate), ... the result is 5-MAY-01,
then I tried this to_char(startTime, 'Month DD, YYYY HH:MI: A.M.') the results become May 05, 2001 12:39:00 PM. (more space between month and day, and 05 instaed of 5)
Does anybody know how to fix this, so I get exactly what is in the db?
Thanks in advance<HR></BLOCKQUOTE>
When you do to_char() with 'month' oracle blank pads the month to nine characters, the same goes with day too. So to get rid of it you'll have to trim() the month. And if you want to get a single digit for date less than 10 instead of 0x you'll have to do a bit of extra jugglery using translate() or replace().
Hope this helps
Naveen -
Unload data with DATAPUMP external tables performance
Hi,
I archive some tables with external tables ORACLE_DATAPUMP.
How can I increase the performance of the table creation?
I try PARALLEL, and I want to know if some others parameters or init parameters can increase the performance.
Thanks for your feedback.
ElodieHi,
take a look here:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_perf.htm
You will find some hints.
Acr -
Problem with Date Format in a Table.
Hi, I have several views, in each views I have two tables with two fields of date.
This data are from an adaptive RFC function exported in Date ABAP format.
The webdynpro is showing me the date in mm/dd/yyyy format, and I want to change that to dd/mm/yyyy. Which is the easiest way to accomplish this.
ThxRodrigo,
Before you start to alter default behavior, take on acount that it was created with certain reason, namely support for internationalization(I18N) and localization (I10N). So WD application displays date, times, currencies in locale-specific manner.
Altering just date display leads to inconsistences with other formatting.
The locale is choosen by sevearl criterias, you may search WD forum to find out more. Briefly, WD consider settings in UME for logged-in user, browser headers and application url parameters.
For example, try to add the following sap-locale parameter with settings for Spanish/Argentina:
sap-locale=es_AR
<b>Notice, that unlike other options suggested here, this will affect all formating in your application. Moreover, if back-end is localized as well (R/3 for example) you will get localized data from back-end</b>
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Date format in create table statement
Hello,
I would like to know if it possible to CREATE TABLE with formated date;
create table months
(id number,
(month_col to_char( month_col,'MM'));so when I insert
insert into months values (1,sysdate); And query
select *from months;
I would get
id months_col
1 04I know this could easily be done by cerating a view on a table, but I was wondering if this was possible to implement directly into table.
I browesed through the documentation, but did not find any datatype that would support this.
Thank you for replies.Personally I would go for using the DATE data type. Using the DATE data type will always ensure that you are actually inserting a date. With a VARCHAR2 or CHAR data type you could insert '27' which is a valid character string but an invalid date.
To display the data the way you want you could either use a view or if you are on a more recent version of Oracle a virtual column.
Hope this helps! -
Data format in pivot table calculated item
Hi All,
I've got a pivot table with a dimension on rows and a dimension on columns and a measure. I have a "new calculated item" based on the dimension on the columns which does the following: ( ($2-$1) / ($1) ) *100
I want this calculated item shown as a percentage like 1,2% but the measure must stay a whole number like 1234 (no decimal places or percentage symbols) any suggestions on how to achieve this?
Thanks in advance!
GillesHi Kishore,
It is not helpful, I mean, it doesn't solve my problem. But nice post!
What I have is the following:
--------C1------C2-----C3
R1|--123--|--345--|--678--|
R2|--124--|--346--|--679--|
R3|--125--|--347--|--670--|
What I want is the following:
--------C1------C2-----C3---------calculated item
R1|--123--|--345--|--678--|--(($2-$1) / ($1) ) *100)
R2|--124--|--346--|--679--|
R3|--125--|--347--|--670--|
the column results must remain in the same format, but the calculated item must be in the format %9.99 (to see the percentage change)
any other suggestions? -
Selecting data from external table
Hi there
I was wondering if somebody could assist me. When I try to select data from an external table, no data is displayed, and in my log file I receive the following error:
KUP-04026: field too long for datatype. Please find attached my external table script.
CREATE TABLE DEMO_FILE_EXT
MACODE NUMBER(7),
MANO NUMBER(7),
DEPNO VARCHAR2(2 BYTE),
DEPTYPE NUMBER(5),
STARTDATE NUMBER(8),
ENDDATE NUMBER(8),
OPTIONSTART NUMBER(8),
BENEFITSTART NUMBER(8),
STARTSUSPEND NUMBER(8),
ENDSUSPEND NUMBER(8),
INITIALS VARCHAR2(5 BYTE),
FIRSTNAME VARCHAR2(20 BYTE),
SURNAME VARCHAR2(25 BYTE),
STR1 VARCHAR2(30 BYTE),
STR2 VARCHAR2(30 BYTE),
STR3 VARCHAR2(30 BYTE),
STR4 VARCHAR2(30 BYTE),
SCODE VARCHAR2(6 BYTE),
POS1 VARCHAR2(30 BYTE),
POS2 VARCHAR2(30 BYTE),
POS3 VARCHAR2(30 BYTE),
POS4 VARCHAR2(30 BYTE),
PCODE VARCHAR2(6 BYTE),
TELH VARCHAR2(10 BYTE),
TELW VARCHAR2(10 BYTE),
TELC VARCHAR2(10 BYTE),
IDNUMBER VARCHAR2(13 BYTE),
DOB NUMBER(8),
GENDER VARCHAR2(1 BYTE),
EMPLOYER_CODE VARCHAR2(10 BYTE),
EMPLOYER_NAME VARCHAR2(900 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY DEMO_FILES
ACCESS PARAMETERS
( RECORDS DELIMITED BY newline
BADFILE 'Tinusb.txt'
DISCARDFILE 'Tinusd.txt'
LOGFILE 'Tinusl.txt'
SKIP 1
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL
(MACODE,
MANO,
DEPNO,
DEPTYPE,
STARTDATE,
ENDDATE,
OPTIONSTART,
BENEFITSTART,
STARTSUSPEND,
ENDSUSPEND,
INITIALS,
FIRSTNAME,
SURNAME,
STR1,
STR2,
STR3,
STR4,
SCODE,
POS1,
POS2,
POS3,
POS4,
PCODE,
TELH,
TELW,
TELC,
IDNUMBER,
DOB,
GENDER,
EMPLOYER_CODE,
EMPLOYER_NAME
LOCATION (DEMO_FILES:'Test1.txt')
REJECT LIMIT UNLIMITED
LOGGING
NOCACHE
NOPARALLEL;
I have the correct privileges on the directory, but the error seems to be on the EMPLOYER_NAME field. The file I try to upload is in pipe-delimited format. The last field in the file does not have a pipe-delimiter at the end. Can this be the problem? Must I go and look for any trailing spaces? Can I specify in the external table script how many characters I need for the employer_name field? We receive this file from an external company
Thank you very much for the help
Ferdiecommon mistake, you gave the field sizes in the
column listing of the table, but not in the file
definition. oracle does not apply one to the other.
in the file defintion section, give explict field
sizes.Hi shoblock
Sorry for only coming back to you now, thank you for your help, I had to give the explicit field size for the last column (employer name).
Thank you once again!!
Ferdie
Maybe you are looking for
-
Error while deploying a business process
Hi all. Am new to Integration Server development. I got this error while deploying my business process. ERROR: <Feb 15, 2004 3:19:41 PM GMT+05:30> <Warning> <DRS> <BEA-002506> <The current ve rsion 6 for DataIdentifier DataIdentifierID: 1 does not ma
-
Is there a trick to fixing an iPad Air (Wifi version) that won't turn on?
I am out of the country for work and while I was in Singapore, I was in the middle of using my iPad (Facebook browsing) while it was plugged in and it shut off unexpectedly (it was at roughly 93% battery as I was getting ready to catch my next flight
-
Can't change typing direction using ctrl+shift in Gmail
Using firefox 6, in Gmail, I can't change text direction while typing using Ctrl+shift combination. The direction arrows in the email editor are working, just the keyboard shortcut don't. Needles to say it works in other browsers.
-
Hi, I just bought a GP70 2PE with Core i7 and so far I quite like it. I installed Windows 7 x64 instead of the default Windows 8. However, I have one problem with it - the screen is very bright - even on the lowest setting, the screen is brighter tha
-
MaxDB/Livecache running on VSphere
Does anyone have productive instances of MaxDB/Livecache running in a virtual mode using Vsphere 4.x? We have a Livecache system that was originally sized for slightly over 128GB of memory but now have a memory requirement that is < 64GB. We are tr