SQL*Loader: How to load multi-line report data?
Hi,
is it possible to use SQL*Loader to load data from a hierarchical structured fixed column ASCII file like this
001 scott
New York 01.01.2002 1234
Chicago 15.10.2001 9876
002 smith
Los Angeles 24.12.1999 5678
Washington 01.12.1999 0000
Chicago 01.01.2000 1111
into one database table:
id name city day code
001 scott New York 01.01.2002 1234
001 scott Chicago 15.10.2001 9876
002 smith Los Angeles 24.12.1999 5678
002 smith Washington 01.12.1999 0000
002 smith Chicago 01.01.2000 1111
The number of lines per name is unlimited, the next line starts after a separating ---- line.
We cannot change the format of the text file to import.
There is an example in the documentation that shows how to load a structure like the following via insert triggers:
001 scott New York 01.01.2002 1234
Chicago 15.10.2001 9876
002 smith Los Angeles 24.12.1999 5678
Washington 01.12.1999 0000
Chicago 01.01.2000 1111
But we have the name information on a separate header line, so I don't know if we can use a similar technique here.
regards
Sven
Try enclosing your strings with e.g. a double-quote. To do so, the control file needs the following (example):
LOAD DATA
REPLACE
INTO TABLE test
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
id1,
id2,
id3,
id4,
)of course this does mean that your data must change...
L.
Similar Messages
-
SQL* Loader - Multi-line record problem
Hi all,
I've been given a ver dirty source file. One that has records of more than 1 line. The only record terminator that is available is that the first columns should always be in number in 7 digits (0000000-9999999). Is it possible to create a control file that checks if the current record is actually a new record or if it is just a continuation of the previous record?
I've been checking on some parameters like the CONTINUEIF and the "str terminator_string".
I tried both but neither fully satisfies the requirements.
I tried using CONTINUEIF by adding CONTINUEIF THIS (1) = '0' to check if it only creates records that has a column value starting with '0'. Unfortunately it still adds those that doesn't start with '0'.
Also tried the INFILE 'mydata.dat' "str '\r\n0'". This works for those who starts with 0 only but unfortunately it trims out the first zero (0) from that column.
Can someone suggest any other approach?
Thanks.
Allenhi,
thanks for the suggestion. i did try it. it works ok but i also found a way to use sql loader since this is better performance wise. i used
CONTINUEIF NEXT PRESERVE (8) <> X'09'.
basically, what this does is check if the character on the 8th position is a tab. if it is, then it's a new line. i used this since the first column in my text file uses a 7 digit number. it's not perfect but loads fast. although i'm still looking for some other ways and means.
thanks again. -
How to make multi-line report headings?
Hi all,
By default, Apex creates a single-line report heading for each column in a report. To minimize white space, multi-line column headings are sometimes appropriate. How can Apex be directed to split a column heading at certain place(s)?
Thanks,
Kim
P.S. I'm running Apex 4.2.2.See https://forums.oracle.com/message/11154533
-
How to display multi line headings in procedural alv report
Hi experts,
How to display multi line heading in alv( procedural alv report) report.
some columns single line and some columns multi line in the same report.
ex:
solvent consumed solvent recovered
fresh | recovery recovery | spent batch no storage
I am using procedural alv .pls give me idea.Hi Ram,
Check the sample report [how to display multi line headings in procedural alv report|http://sample-code-abap.blogspot.com/2008/01/printing-multiple-line-header-and.html]
Thanks,
Duy -
(8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기
제품 : ORACLE SERVER
작성날짜 : 2003-10-21
===============================================================
(8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기
===============================================================
PURPOSE
Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
되었다.
Explanation
Oracle8i 이전에는 record seperator로 default로 linefeed(carriage return,
newline 등)였다. 이전에는 VAR 또는 FIX 등의 적당한 file을 다루기 위한 옵션을
주어야 하기 때문에 복잡한 감이 있었고 flexible하지 못했다.
Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
되었다. newline 또는 carriage return 문자를 포함하는 data 또는 special 문자를
포함하는 data를 load하고자 할때 record terminator를 hexadecimal로 지정하여 활용할 수 있다.
Example
다음의 예제는 '|' (pipe line)을 record separator로 사용한다.
record separator를 사용하기 위해서 SQL*Loader의 control file에 'infile'절에 적당한 값을 지정하여야 한다.
아래의 예는 '|' (pipe line)을 사용하기 위해서
"str X'7c0a'"을 'infile'절에 지정하였다.
--controlfile : test.ctl
load data
infile 'test.dat' "str X'7c0a'"
into table test
fields terminated by ',' optionally enclosed by '"'
(col1, col2)
--datafile: test.dat
1,this is the first line of the first record
this is the second|
2,this is the first line of the second record
this is the second|
SQL> desc test
Name Null? Type
COL1 VARCHAR2(4)
COL2 VARCHAR2(100)
$ sqlldr scott/tiger control=test.ctl log=test.log
load된 data을 보면 아래와 같이 carriage return이 들어가 있는 data가 한 column에
제대로 들어간 것을 볼 수 있다.
SQL> select * from test;
COL1
COL2
1
this is the first line of the first record
this is the second
2
this is the first line of the second record
this is the second
RELATED DOCUMENT
<Note:74719.1> -
Sql loader error in offline data load
Hi,
I have done an offline schema creation using existing tablespace.
I am trying to do an offline data load using sql loader.The CTL and DAT file are generated by the work bench.
This is my CTL file code generated by workbench.
load data
infile 'Import.dat' "str '<EORD>'"
into table IMPORT
fields terminated by '<EOFD>'
trailing nullcols
When I am running the ctl file with DAT file in sql loader I am getting the following error
SQL*Loader-350: Syntax error at line 4.
Expecting single char, found "<EOFD>".
fields terminated by '<EOFD>'
^
My Sql Loader version is Release 8.0.6.3.0
Please help if anyone has came across this issue.
Thanks in advance.
Regards
Saravanan.BSaravanan,
Its a long time since I have seen 8 sql loader. Check the doc. Is it resrticted to a single character delimter??
Barry -
How can I sort lines of data (alphabetically) in the new pages 5.0?
How can I sort lines of data (alphabetically) in the new pages 5.0?
It was very simple to do in the previou version of pages.I'm not sure why people are torturing themselves with Pages 5 given the nearly universal outcry on this forum and the incredibly negative reviews elswhere, such as the App Store.
Pages 4.3 should still be in an iWorks folder within your Applications folder. Just use that.
Please remember to tell Apple what we need from them at:
http://www.apple.com/feedback/pages.html -
How to avoid a line of data being cut by page jump ?
Dear Java Experts,
I have encountered a very troublesom problem!
The problem is described as follows:
When the browser (IE or Netscape) contains many HTML character data (especially HTML tables and data from DATABASE), how can I print the data to client's printer
(i.e. browser's printer) without having a line of data cut by page jump?
That is how to avoid a line of data cut by page jump, upper part of the data in one page and lower part in next!
I think the problem should be solved with client's java applet!
Can any expert give me sample code to solve the problem or indicate me where I can find documents about solving the problem?
Thank you very much in advance!!
Best Regards,
Jackie SuHTML is not really meant for device-specific presentation (despite a lot of abuses in this area).
I don't think you're going to solve this satisfactorily with HTML, no matter what you jury-rig around it.
If this kind of presentation control is a requirement, you're probably better off with a format that directly supports this--PDF is the most obvious choice.
There's a sourceforge project that supports PDF generation from Java (http://sourceforge.net/projects/itext/ - I don't have any experience with it) and I think there may be others.
And I believe there are also commercial products for this. -
How to refer the SQL*Loader command line parameters in the control file
The problem I am trying to resolve is to insert the input file name when SQL*Loader is loading the record from the file. I have multiple files to load and it is nice to associate a record with a particular input file.
Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
Another option is to use external tables
Re: Data Loading
Message was edited by:
Jens Petersen -
How to Design Multi Page Report in SSRS 2008
Hi All,
I have managed to create a multi page report. When I am preview mode i can see that the report has 2 pages.
But when I am in design view I cannot view the second page. How can I view the second page. Reason being I am trying to create a template where the table for certain data needs to be at the top of the page and some data at the middle and so on.
Thanks in advance.
Aash.
AashHi Aash2,
According to your description, the behavior of cannot view the second page in design view is expected, in another way, there is only one page in design view.
Report Designer supports two views: Design to define the report data and report layout, and
Preview to display a rendered view of the report. If you would like to show a table on the first page, and show the other table on the second page, you can add a page break on the first table like followings:
1. Click the gray handle in the first table, select “Tablix Properties”
2. Click “Add a page break after” check box under Page break options in General Tab
After do above, you can see the first table in the first page, and the other table in the second page.
For more details about report designer, please see the following article,
Working with Report Designer in Business Intelligence Development Studio:
http://msdn.microsoft.com/en-us/library/cc281300(v=sql.110).aspx
If you have any question, please feel free to ask.
Thanks,
Eileen -
SQL Loader Approch to fetch data from Previous Data Segment.
CREATE TABLE T
RECORD_ID NUMBER,
SEG_VALUES VARCHAR2(4000)
==============================================================================
LOAD DATA
INFILE *
TRUNCATE
INTO TABLE T
WHEN SEG_VALUES <> ''
RECORD_ID RECNUM,
SEG_VALUES POSITION(1:4000)
BEGIN DATA
AAASH9561000000074120081029SYS
BBB0000001H0351
CCC0000001 6040818 078141532A 202007083020070830 36274
CCC0000002 12623239 526486168A 202008063020080630 4808
CCC0000003 13326331 530229550A 202008042620080426 V4611
CCC0000004 23554261 161340499A 202008082220080822 6868
==============================================================================
CREATE TABLE T1
FILE_ID VARCHAR2(20),
CONT_NBR VARCHAR2(20),
SEG_VALUES VARCHAR2(4000)
==============================================================================
CREATE OR REPLACE PROCEDURE P
AS
l_Fileid T1.file_id%type;
l_Contractnbr t1.CONT_NBR%Type;
BEGIN
FOR REC IN (SELECT SEG_VALUES FROM T ORDER BY RECORD_ID)
LOOP
IF SUBSTR(REC.SEG_VALUES,1,3) ='AAA' THEN
l_Fileid := SUBSTR(REC.SEG_VALUES,10,10);
ELSIF SUBSTR(REC.SEG_VALUES,1,3) ='BBB' THEN
l_Contractnbr := SUBSTR(REC.SEG_VALUES,11,5);
ELSIF SUBSTR(REC.SEG_VALUES,1,3) ='CCC' THEN
INSERT INTO T1 VALUES (l_Fileid,l_Contractnbr,REC.SEG_VALUES);
END IF;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR (-20458,SQLERRM);
END P;
==============================================================================
Is there is any simple approch to handle the above scenario in SQL Loader Control file? if possible can you please show me?Handle the above scenario? What above scenario?
Could I guess ... you betcha. Will I guess? Quite another matter.
Please provide full version (all 3 decimal places) and a clear and concise description of what help you need. -
SQL Loader - want to access data from .txt file but don't want to insert
Hello,
I have situation where I have some data in .txt file and I have to load that data into one of my table.
My problem is I have fundtion get_id(a,b,c) in database which I have to call while loading the data to find out value of x.
I have value of a, b and c in txt file which I can access it using POSITION(N:M) in sql loader, but After accessing that value I just want to past to get_id() function and dont want to insert into sql loader.
any helpMy control file is as below
Following field is not in database but I need to pass the value to the function to get a ESC_USER_ID. any help
OFFICE_NUM filler POSITION(32:35) ,
STATION_DESK filler POSITION(45:48),
LOAD DATA
INFILE REFERRALs.TXT
BADFILE REFERRAL_LOAD.BAD
DISCARDFILE REFERRAL_LOAD.DIS
INSERT
INTO TABLE REFERRAL
EVALUATE CHECK_CONSTRAINTS REENABLE DISABLED_CONSTRAINTS
TRAILING NULLCOLS
ID sequence (1,1),
JOB_ID POSITION (16:22) "GET_JOB_ID(:JOB_ID)" ,
CUS_ID POSITION (23:31) "GET_CUS_ID(:CUS_ID)" ,
STATUS_LU CONSTANT 'F' ,
REQUEST_USER_TYPE_LU CONSTANT 'S' ,
OFFICE_NUM filler POSITION(32:35) ,
STATION_DESK filler POSITION(45:48),
REQUEST_USER_ID POSITION(143:149) "GET_ESCUSER_ID(OFFICE_NUM,STATION_DESK,:REQUEST_USER_ID)" ,
REQUEST_DT POSITION (37:44) "to_date(:REQUEST_DT,'YYYY/MM/DD')" ,
REVIEW_USER_ID FILLER ,
REVIEW_DT FILLER ,
REFUSE_REASON_LU FILLER ,
RESULT_LU POSITION (97:97) ,
NOTIFY_STATUS_LU FILLER ,
NOTIFY_DT FILLER ,
APPOINTMENT_DT POSITION (106:113) "to_date(:APPOINTMENT_DT,'YYYY/MM/DD')" ,
RESULT_DT POSITION (98:105) "to_date(:RESULT_DT,'YYYY/MM/DD')" ,
NO_MATCH_IND CONSTANT 'N'
) -
Hi
I have a text file like this:
logs~-~189.138.221.234~[19/Nov/2007:18:39:53 +0100]~mujer.orange.es~/mujer.woo/home/home/index.html~mujer.woo~home~home~index.html~Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts; InfoPath.2)~bid=1195493283-1925481236; __em_p=1195493283-1925481236%26bid; GUID=0002D029C7BD07412A7C28F861626364~-~?ord=4939922038660
Im trying to load via sql loader to a table like this:
CREATE TABLE SPY_LOGS_FLOGS
TYPE VARCHAR2(10 BYTE),
PROXY VARCHAR2(30 BYTE),
IP VARCHAR2(30 BYTE),
DATETIME DATE,
REFERER VARCHAR2(100 BYTE),
SPY VARCHAR2(100 BYTE),
SPY0 VARCHAR2(100 BYTE),
SPY1 VARCHAR2(100 BYTE),
SPY2 VARCHAR2(100 BYTE),
SPY3 VARCHAR2(100 BYTE),
BROWSER VARCHAR2(300 BYTE),
COOKIE VARCHAR2(100 BYTE),
UNKNOWN VARCHAR2(100 BYTE),
QS VARCHAR2(100 BYTE)
Im using a control similar to this:
LOAD DATA
infile '../files/spy_logs_flogs'
append
into table spy_logs_flogs
FIELDS TERMINATED BY '~'
TRAILING NULLCOLS
TYPE char,
PROXY char,
IP char,
DATETIME date 'to_date(:DATETIME,'"["yyyymmdd hh24:mi:ss"] +100"')' ,
REFERER char,
SPY char,
SPY0 char,
SPY1 char,
SPY2 char,
SPY3 char,
BROWSER char,
COOKIE char,
UNKNOWN char,
qs char
Im trying to transform the DATETIME field from [19/Nov/2007:18:39:53 +0100] to date 19/10/2007 18:39:53, but have tested with control and cant find the way to do it.
Any help will be appreciate.Play with
select substr('[19/Nov/2007:18:39:53 +0100]',2,20) the_date
from dualand if you get 19/Nov/2007:18:39:53 proceed to
select to_date('19/Nov/2007:18:39:53','DD/MON/YYYY:HH24:MI:SS')
from dual
select to_date('19/Nov/2007:18:39:53','DD/Mon/YYYY:HH24:MI:SS')
from dual
select to_date('19/Nov/2007 18:39:53','DD/MON/YYYY HH24:MI:SS')
from dual
select to_date('19/Nov/2007 18:39:53','DD/Mon/YYYY HH24:MI:SS')
from dualperhaps one of those will work (if it's the one without : then you must replace it with space using substr and || before using to_date)
Regards
Etbin -
SQL Loader Error : ORA-01830: date format picture ends before converting en
I am inserting following data
BES101706 M.E. Deals 7 10/17/2006
through control file :
LOAD DATA
APPEND
INTO TABLE abc_temp
FIELDS TERMINATED BY ' '
TRAILING NULLCOLS
(BATCH_NAME ,
SUPPLIER_NAME ,
SUPPLIER_NBR ,
INV_DATE "to_date(substr(:INV_DATE,1,10),'MM/DD/YYYY' )"
But I am getting this error:
ORA-01830: date format picture ends before converting entire input string
inv_data is a date field in the database.I think it has to do with data format.Exactly.
You have
BES101706*M.E.*Deals*7*10/17/2006
I replace each space with an asterisk. You have 5 columns according to your spec (terminated by '<space>')
SQL Loader doesn't know that M.E. Deals is the supplier name.
It's trying to convert 7 as the date. -
SQL Loader - double quote within data
Hi,
I'm putting together some SQL loader scripts to load source data into a DB. The data we are receiving is comma delimited, optionally enclosed by double quotes (").
e.g. "abc","123","this is a "test"","987"
The problem I've got is that some data items contain double quotes ("test") as part of the data and this cause the SQL Loader to fall over with the error:
Record 14644: Rejected - Error on table x, column y.
no terminator found after TERMINATED and ENCLOSED field
Is it possible to load this without changing the extraction process from the source system?
My .ctl file looks like this:
LOAD DATA
INFILE '../data/toload/BR_ADDRESS.CSV'
APPEND INTO TABLE STA_COMP_BRADD
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
etc....
Message was edited by:
MaximumStaggHi,
Look in to this in Oracle documentation:
"If two delimiter characters are encountered next to each other, a single occurrence of the delimiter character is used in the data value. For example, 'DON''T' is stored as DON'T. However, if the field consists of just two delimiter characters, its value is null."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm
Thanks,
Kishore
Maybe you are looking for
-
Any way to save data in loop without using shift register or feedback loop
Hello all I was thinking, is it possible to save data in a loop to next iteration without the use of a shift register or a feedback loop? I need the possibility to reload data within a loop from a lvm file, but I want to use the same data until i loa
-
Version 11.1.2 Install on Win7 VM
Hi, I successfully installed the Hyperion stack on my WIN7 VM on my mac book pro. I then configured it, hooking it up to MS SQL 2008 Express also running on the win7 VM. Everything seemed fine. HOWEVER - when I open up EAS, and try to connect to the
-
Filtering InfoPath Form Data Based on Sharepoint Login
We have a form designed in InfoPath that updates a SharePoint list. We've added a data connection in InfoPath to an SQL database that holds information we'd like to have populated in the form. One of the columns in the database is username which ma
-
Init 5 doesn't shutdown Solaris 8 Sparc system
Hi, I am trying to bring down the Solaris 8 Sparc system using the command # init 5 but it doesn't do anything whereas the command # shutdown brings down the system. What could be the problem of init 5 command not functioning. Thanks & Regards
-
Check boxes are whited out where I can't see them how do I change the color of them to black?
I just recent loaded Win 8 and a new Firefox 17 .... All my check boxes and bullet points colors are white so I can not see them. The back ground color is white also. So when check box is selected I can see nothing. Screen capture to show http://prnt