Fastest way to export to a pipe-delimited text file
I'm using Oracle 9i and need to export a table that has 150 million rows into a text file (or multiple text files based on a query that divides the table). I'd like it to be pipe-delimited and without quotes around strings.
How can this be done so that it runs fast? Keep in mind, I'm kind of a newbie.
I don't know what the fastest method would be but I would put quite a bit of money on it not being the Oracle SQL Developer tool, which is the subject of this forum.
Similar Messages
-
XML Column from table extract to Pipe Delimited Text File
Hi,
I have an XML column with large data in a Table ( Source SQL server Database).
I was asked to extract XML column to .txt file using SSIS.
Is it possible to extract xml column with huge data to text file ?
when I tried, select XML column from Table in source , I noticed that Property of column is taken as [DT_NTEXT] . I Converted it to DT_TEXT as Ansi donot support DT_NTEXT.
Execution method was success but it failed due to trucation. so wondering is there a way to get XML column extracted to Pipe delimited text file?
Is it advisable to do this ? or IS It Valid to export XML in Pipe Delimited File ?
Please Kindly advice
thanks
kodiAre you looking at shredding data within XML nodes and then importing it to text file or are you looking at exporting XML value as is? Also is SSIS a necessity?
If not, You can simply use T-SQL for this along with bcp for this. just use a query like
EXEC xp_cmdshell 'bcp "SELECT CAST(XMLColumn AS varchar(max)) AS Column FROM table" queryout <full file path> -c -S <ServerName> -T -t |'
provided you use trusted connection (windows authentication)
see
http://visakhm.blogspot.in/2013/10/bcp-out-custom-format-data-to-flat-file.html
If you want to shred the data use Xpath functions in the query as below
http://visakhm.blogspot.in/2012/10/shred-data-as-well-as-metadata-from-xml.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Downloading pipe delimited text file on to desktop with data in internal
hi all,
how to download pipe delimited text file on to desktop with data in internal
table with an example plz.hi,
u can use the FM GUI_DOWNLOAD.
here is the sample code.
*Internal table to hold the employee details
DATA: it_details TYPE STANDARD TABLE OF x_details,
wa_details TYPE x_details.
*Internal table for file
DATA: BEGIN OF it_details_txt OCCURS 0,
line(700),
END OF it_details_txt.
*Employee details for the file
CLEAR wa_details.
LOOP AT it_details INTO wa_details.
CLEAR it_details_txt.
CONCATENATE
wa_details-var1
wa_details-var2
wa_details-var3
wa_details-var4
INTO it_details_txt-line SEPARATED BY '|'.
APPEND it_details_txt.
CLEAR wa_details.
ENDLOOP.
*Download file in .TXT format to local desktop
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'data.txt'
filetype = 'ASC'
TABLES
data_tab = it_details_txt
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc = 0.
MESSAGE 'Data downloaded successfully' TYPE 'S'.
ENDIF. -
If you have answer, please provide specific and detailed steps.
Situation 1:
Start:
150+ files in .xls OR .xlsx format
data contains many characters EXCEPT "Tab"
Process:
Use Automator to:
Select Files from Finder window
Convert selected files from xls/xlsx to TAB-DELIMITED file format
End:
150+ files in .txt format
files have identical names to those from "Start:"
data is TAB-DELIMITED
Situation 2:
Start:
150+ files in .xls OR .xlsx format
data contains many characters EXCEPT | (pipe, vertical bar)
Process:
Use Automator to:
Select Files from Finder window
Convert selected files from xls/xlsx to |-delimited file format
End:
150+ files in .txt format
files have identical names to those from "Start:"
data is "|"-delimitedIf your post is addressed to my response then the answer is you have to write your own or search on-line to see if something exists to do what you want.
As you note there is no pre-built script for this.
regards
Message was edited by: Frank Caggiano - Are you certain there isn;t something in Excel to export as a tab delimited file?
This link Convert An Excel Spreadsheet To A Tab Delimited Text File seems to indicate that the function is in Excel already. -
What is the best and most efficient way to read a .xls File and create a pipe-delimited .csv File?
Thanks in advance for your review and am hopeful for a reply.
ITBobbyP85You should have no trouble doing this in SSIS. Simply add a data flow with connection managers to an existing .xls file (excel connection manager) and a new .csv file (flat file). Add a source to the xls and destination to the csv, and set the destination
csv parameter "delay validation" to true. Use an expression to define the name of the new .csv file.
In the flat file connection manager, set the column delimiter to the pipe character. -
Best and fastest way to export HD Video
What is the best and fastest way to export HD video once I have finished editing it. I shot the footage in 720p30 on an HD camera, now I am just looking for the quickest way to get this out the door, any ideas?
And compressing DVCPRO HD to DVD isn't a quick process. it took me 13 hours for 90 min. With the specs you see below.
But to us, it is worth every minute.
We see a qualitative difference in DVDs whose source is 720/24pn on our component out DVD player to a Fijitsu plasma.
I swear that it is not much different than the original DVCProHD footage out the component of the cam.
Shane is responsible for educating and encouraging us to move to the HVX200.
We intend, of course, to send the purchase price bill for cam and cards to him. -
Any way to export from iPhoto and have the file date be the photo date?
I can't deal with iPhoto any longer. I just imported photos from the last few days and they ended up being associated with some "Event" from Jul 19, 2007. So now I have an event that spans Jul 19, 2007 to Feb 21, 2009!!! I'd like to just display, sort, view all photos in my library by date (I am meticulous about dates on all my devices) but apparently that's not possible anymore. "Events" is the worse thing to ever happen to my photo library...
So I'd like to export them all and just use the Finder. It actually works the way I'd like. However there does not seem to be any way to export the photos so that the file creation or the file modification date is the actual date the photo was taken as shown in the information box in iPhoto. Does anyone know how to to this? Or is this just the iPhoto engineers screwing with people like me who have gotten disgusted with their product?
Thanks!Yes, I know what the Finder is... The cool thing is it actually does know about the contents of the file. For example it can display thumbnails of the images contained within.
Even better the files can be sorted any way you want, are not hidden in some odd proprietary package, can be backed up, restored at will and can easily be programmatically changed using AppleScript. The file system for an OS is generally bullet-proof and as such doesn't screw with dates like iPhoto did (the events stuff screwed with all our dates and has been a disaster for us and the 40,000 or so pictures we had in our library).
iPhoto has just gotten too modal, too bloated, and too proprietary while not providing the basics like a way for my wife and I to have a single library for all our photos. On the other hand using just the file system and some network storage this is easy.
For the recored most pros I consulted with have moved to the file system and Finder as their primary means of managing their photos. I'm just looking for an easy way to get my stuff out of iPhoto so I can do the same. -
Exporting Table data to delimited txt file
I am trying to import the table data into delimited text file, I am running the following code from Tom Kyte's website on the server. When I run the procedure after I run the function it is not creating any .dat file for me.
I have also checked for the parameter 'utl_file_dir' in the database and it is set to the correct path. Is there anything that I am missing??
any suggestions/inputs would help.
create or replace function dump_csv( p_query in varchar2,
p_separator in varchar2
default ',',
p_dir in varchar2 ,
p_filename in varchar2 )
return number
AUTHID CURRENT_USER
is
l_output utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_columnValue varchar2(2000);
l_status integer;
l_colCnt number default 0;
l_separator varchar2(10) default '';
l_cnt number default 0;
begin
l_output := utl_file.fopen( p_dir, p_filename, 'w' );
dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );
for i in 1 .. 255 loop
begin
dbms_sql.define_column( l_theCursor, i,
l_columnValue, 2000 );
l_colCnt := i;
exception
when others then
if ( sqlcode = -1007 ) then exit;
else
raise;
end if;
end;
end loop;
dbms_sql.define_column( l_theCursor, 1, l_columnValue,
2000 );
l_status := dbms_sql.execute(l_theCursor);
loop
exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
l_separator := '';
for i in 1 .. l_colCnt loop
dbms_sql.column_value( l_theCursor, i,
l_columnValue );
utl_file.put( l_output, l_separator ||
l_columnValue );
l_separator := p_separator;
end loop;
utl_file.new_line( l_output );
l_cnt := l_cnt+1;
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_output );
return l_cnt;
end dump_csv;
create or replace procedure test_dump_csv
as
l_rows number;
begin
l_rows := dump_csv( 'select *
from doctype
where rownum < 25',
',', '/tmp', 'test.dat' );
end;
/Hi,
It works for me...
SQL> select dump_csv('select * from dba_users',',','/tmp','teste.txt') from dual;
DUMP_CSV('SELECT*FROMDBA_USERS',',','/TMP','TESTE.TXT')
149
SQL> show parameter utl_file_dir
NAME TYPE VALUE
utl_file_dir string /tmp
oracle@icaro:/tmp> ls -l teste.txt
-rw-r--r-- 1 rps users 394353 2006-07-31 17:40 teste.txtJust for information:
I'm using SUSE LINUX 10 and Oracle 10g 10.1.0.2
Cheers
Message was edited by:
Legatti -
How to get tab delimited text file when Stored Procedure executes ?
Hello Everyone,
I have a stored procedure which returns 1 result set as an output.
I want the output as a Tab Delimited Text file.
I know that I can use SSIS and get the same output but I am not allowed to use SSIS in this case.
Is there any other ways ?
I will be really appreciate If someone can answer with, How many different ways I can get Tab delimited text file ?
Thanks in advance
Henaryyou can do that by using SQLCMD
http://blog.sqlauthority.com/2013/03/05/sql-server-exporting-query-results-to-csv-using-sqlcmd/
you can also use BCP
EXEC master..xp_cmdshell 'bcp "select * from tempdb.dbo.orders" queryout "c:\output.txt" -c -T'
EXEC master..xp_cmdshell 'bcp "exec usertest.dbo.proctest" queryout "c:\output.txt" -c -T'
--Prashanth -
How to get summary columns in delimited text file
How to get summary columns in delimited text file
I am trying to generate a delimited text file output with delimited_hdr = no.The report is a Group above report with summary columns at the bottom.In the text file the headers are not getting repeated & thats ok.The problem is the summary data is getting repeated for each row of data.Is there a way where i will get all the data & summary data will get displayed only once.I have to import the delimited text file in excel spreadsheet.Sorry there were a typos :
When I used desformat=DELIMITEDDATA with desttype=FILE, I get error "unknown printer driver DELIMITEDDATA". When you look for help, DELIMITED is not even listed as one of the values for DESTFORMAT. But if you scroll down and look for DELIMITER it says , this works only in conjuction with DESTFORMAT=DELIMITED !!!!!!??!! This is in 9i.
Has this thing worked for anybody ? Can anyone please tell if they were able to suppress the sumary columns or the parent columns of a master-detail data for that matter ? -
How do I save a Number file to an delimited text file
I was trying to import all my conatct that I created from Number to iList, I kept on failing, after I did some reaserch, and found out I need to save to an delimited text file. Can anybody help me? Or if anyone can direct me from import an Number file into iList, it would be wonderful, please help.
Thank againYou have a couple of options to convert the data to a tab-delimited file. The easist may be to copy the table from Numbers & paste it into a Pages word processing document. From there you can export it as a plain text file which you can then import.
Jerry,
IList Data is a database app that may be a solution for those moving from AppleWorks. It's more than Bento & less than FileMaker. -
Hi friends,
My requirement is i need to download a tab delimited text file.
i am using the below coding but i am able to download a file but it is not coming with delimited.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file_str
write_field_separator = 'X'
TABLES
data_tab = outab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
pls give solution for thishi ,
Plz chek the below code...
v_name1 is the destination where u want to store
c_asc is the constant '.ASC'
C_X MEANS 'X'.
Down load the contract error files to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_name1
filetype = c_asc
write_field_separator = c_x
TABLES
data_tab = i_error
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE e140.
ENDIF.
Regards,
Nagaraj -
OPEN DATASET output to Tab delimited text file???
Can anyone suggest the best way for downloading a TAB DELIMITED text file to the application server using open dataset.
I'm currently downloading the file, but I find that it puts "#"'s in place of empty numeric fields.
any help appreciated,
LeeHi Lee,
System identifies Tab delimited as #.
But its not a problem.
If you wang to download the data into intenal table,
you need to do declare delimiter.
Refer code:
CONSTANTS: c_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_hash TYPE c VALUE '#'.
data:wa_input_rec TYPE char2000.
OPEN DATASET p_appl IN TEXT MODE ENCODING DEFAULT FOR INPUT.
IF sy-subrc = 0.
DO.
READ DATASET p_appl INTO wa_input_rec.
IF sy-subrc <> 0.
EXIT.
ELSE.
*-- Split the Tab # into corresponding Columns fields.
PERFORM f0056_split_records.
APPEND wa_input_file TO i_input_file.
CLEAR: wa_input_rec, wa_input_file.
ENDIF.
ENDDO.
FORM f0056_split_records .
CLEAR wa_input_file.
SPLIT wa_input_rec AT c_split INTO
wa_input_file-column0
wa_input_file-column1
wa_input_file-column2
wa_input_file-column3
wa_input_file-column4 IN CHARACTER MODE.
ENDFORM. " f0056_split_records
Reward points if this helps.
Manish
Message was edited by: Manish Kumar
Message was edited by: Manish Kumar -
Application Server Download - Tab Delimited Text File
Hi,
I am trying to create a tab delimited text file in application server. Is there any option should i use with the Open Dataset / Transfer statements? My requirement is to download the file (Text - Tab Delimited) into Excel for further analysis. Can you please suggest me a suitable solution for this?
Thanks,
Kannan.Hi,
You can use transactions CG3Y and CG3Z. Its very simple.
Refer sample code:
constants: c_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE VALUE char100 '/local/data/interface/A28/DM/OUT'.
*& Form f1001_browse_appl_file
Pick up the file path for the file in the application server
FORM f1001_browse_appl_file .
DATA: lcl_directory TYPE char128.
lcl_directory = p_direct.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = lcl_directory
filemask = c_mask
IMPORTING
serverfile = p_f2
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE s000 WITH text-039.
EXIT.
ENDIF.
ENDFORM. " f1001_browse_appl_file
*& Form f1004_app_file
upload the file from the application server
FORM f1004_app_file .
REFRESH: i_input.
OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_f2 INTO wa_input_rec.
IF sy-subrc 0.
MESSAGE s000 WITH text-030.
EXIT.
ENDIF.
o
+ Split The CSV record into Work Area
PERFORM f0025_record_split.
o
+ Populate internal table.
APPEND wa_input TO i_input.
CLEAR wa_input.
ENDDO.
ENDIF.
ENDFORM. " f1004_app_file
*& Form f0025_record_split
Move the assembly layer file into the work area
FORM f0025_record_split .
CLEAR wa_input.
SPLIT wa_input_rec AT c_split INTO
wa_input-legacykey
wa_input-profile_role
wa_input-read_date.
ENDFORM. " f0025_record_split
DO your manipulation with the data records here.
Popualte data into final internal table and write it back to application server at the desired path.
*& Form f0020_write_application
Write error log to application Server
FORM f0020_write_application .
IF p_f1 IS NOT INITIAL.
CONCATENATE p_direct p_obj sy-datum text-037 INTO p_f2.
ELSEIF p_f2 IS NOT INITIAL.
REPLACE text-036 IN p_f2 WITH text-037.
ENDIF.
OPEN DATASET p_f2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc 0.
EXIT.
ENDIF.
LOOP AT i_error INTO wa_error.
TRANSFER wa_error TO p_f2.
IF sy-subrc 0.
EXIT.
ENDIF.
CLEAR wa_error.
ENDLOOP.
CLOSE DATASET p_f2.
ENDFORM. " f0020_write_application
HTH,
Regards,
Dhruv Shah -
Small doubt reg upload from tab delimited text file
Hi all,
i am uploading a tab delimited text file to a ztable.
I moving the text file in to internal table
data : begin of i_tab occurs 0,
text(1024) type c,
end of i_tab.
then i have passed to FM GUI_UPLOAD.
and then splitting
loop at i_tab.
split i_tab at con_tab
into i_xyz-matnr
i_xyz-werks.
append i_xyz.
endloop..
is this the right approach . iam getting the results but iam just curious to know.
Do i need to internal like the one i created
data : begin of i_tab occurs 0,
text(1024) type c,
end of i_tab.
or do i need to create one with field that i have in text file.
data : begin of i_tab occurs 0,
matnr like mara-matnr,
werks like marc-werks
end of i_tab.
WHICH ONE OF THE TWO IS RIGHT.
THANKS IN ADVANCEThere will be NO difference,i guess in the 2 methods.
you can use which you like.
Check the below program,i also given quantity fields F2,F3.
its working fine
REPORT ZSRIM_TEMP13.
data : begin of itab occurs 0,
f1(20) type c,
f2 type i,
f3(10) type p DECIMALS 2,
end of itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'c:a.txt'
FILETYPE = 'ASC'
<b>HAS_FIELD_SEPARATOR = 'X'</b>
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH = FILELENGTH
* HEADER = HEADER
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT ITAB.
WRITE :/ ITAB-F1, ITAB-F2,ITAB-F3.
ENDLOOP.
my input file i created with TAB seperated text file,
here is the input file
LINE1 1000 123.25
LINE2 2000 234.25
LINE3 3000 345.25
LINE1 1000 123.25
LINE2 2000 234.25
LINE3 3000 345.25
Regards
Srikanth
Message was edited by: Srikanth Kidambi
Maybe you are looking for
-
Serializing a JavaBean to the WEB-INF directory or subdirectories
Hello, I'm hoping someone can help me on this. I'm working with two scenarios in WSAD Enterprise Edition 5.0.0.2 for serializing a JavaBean (called AddressBean) to the following location in my Web application: /WEB-INF/classes/resources/serializable
-
IMac won't start up, error tones
I am trying to upgrade ram for my iMac 24 inch (early 2009) from 4GB to 8GB with two 4GB 1333 DDR3 because my computer uses those. I've done all the research and reseted PRAM, checked my firmwares and everything is just fine but when I change the mem
-
Weg Gallery - Slideshow(s)
I have created my first web gallery - These are my issues when viewing the gallery on internet: 1. If you double click the first photo you see a rather small pic and a description of what the subject is about (hitting i [info] can give u the further
-
Running SSIS Package from another server and performance
I've built an SSIS package that integrates data from one SQL Server 2008 database to another SQL Server 2008 database. However, since I needed to leverage some SSIS 2012 components, I've installed the package on another SQL Server 2012 in the networ
-
(N)icecast using AirPort Express
Hello, After getting AirPort Express (AX), I've lost the ability to do desktop broadcasting using Nicecast. What's confusing me is whether port mapping changes should be made in my Speedstream 5100 (a short email suggestion from the Nicecast folks) o