Extracting into Flat Files Using OCI or Pro*C Programs
Data Extraction into Flat Files from a database Using OCI or Pro*C Programs - please provide me a sample code. It is urgent. Thank you in advance.
This problem is very simple to solve. Simply use Pro*C, issue an SQL select into a host variable, then use unix "printf" to output the result. An alternative is to use the provided sqlplus utility to grab the data in a script, disabling headers, etc.
Sadly, this area is a huge, basic hole in the Oracle product offering. While they have an import utility, there is no export utility, except for one that makes binary files not usable outside Oracle. Every other RDBMS I've seen has this. In Informix, you can say something like "export to <filename> select * from <table>", but that syntax is not offered by Oracle Corporation.
Similar Messages
-
Data convertion while exporting data into flat files using export wizard in ssis
Hi ,
while exporting data to flat file through export wizard the source table is having NVARCHAR types.
could you please help me on how to do the data convertion while using the export wizard?
Thanks.Hi Avs sai,
By default, the columns in the destination flat file will be non-Unicode columns, e.g. the data type of the columns will be DT_STR. If you want to keep the original DT_WSTR data type of the input column when outputting to the destination file, you can check
the Unicode option on the “Choose a Destination” page of the SQL Server Import and Export Wizard. Then, on the “Configure Flat File Destination” page, you can click the Edit Mappings…“ button to check the data types. Please see the screenshot:
Regards,
Mike Yin
TechNet Community Support -
Import data from Oracle table into flat file
How to import the data in the oracle table into flat file using UTL File of PL/SQL....
I am new in PL/SQL..
can someone help me in writing query?Note : Not Tested.
DECLARE
V1 VARCHAR2(32767);
F1 UTL_FILE.FILE_TYPE;
cursor c1 is select ename,empno from emp;
r_c1 c1%rowtype;
BEGIN
-- In this example MAX_LINESIZE is less than GET_LINE's length request
-- so the number of bytes returned will be 256 or less if a line terminator is seen.
open c1;
F1 := UTL_FILE.FOPEN('MYDIR','MYFILE','W',256);
loop
fetch c1 into r_c1;
v1:= r_c1.ename||''||To_char(r_c1.empno);
UTL_FILE.PUT_LINE (F1, v1,TRUE);
v1:= null;
Exit when c1%not found;
end loop;
UTL_FILE.FCLOSE(F1);
END;
http://download.oracle.com/docs/cd/B19306_01/appdev.102
------------------------------------------------------------------ -
How to extract data from Essbase to Flat File using ODI
Hi,
Anyone know how to extract data from Essbase to Flat File using ODI?
Thanks in advance.
Regards,
SumardiHi,
Have you read through :-
Oracle Data Integrator Adapter for Hyperion Essbase Getting Started - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_getting_started.pdf
Oracle Data Integrator Adapter for Hyperion Essbase User's Guide - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_users.pdf
If you have read them and are still have a problem at what stage are you having the issues?
Cheers
John
http://john-goodwin.blogspot.com/ -
Exporting R3 tables into Flat Files for BPC
Dear BPC experts,
I understand currently the way for BPC to extract data from R3 is via flat files. I have the following queries:
1) What exactly are the T codes and steps required to export R3 tables into flat files (without going through the OpenHub in BI7)? Can this process be automated?
2) Is Data Manager of BPC equivalent to SSIS (Integration Services) of SQL Server?
Please advise. Thanks!!
SJHi Soong Jeng,
I would take a look at the existing BI Extractors for the answer to Q1, I am working on finishing up a HTG regarding this. Look for it very soon.
Here is the code to dump out data from a BI Extractor directly from ERP.
You need dev permissions in your ERP system and access to an app server folder. ...Good Luck
*& Report Z_EXTRACTOR_TO_FILE *
report z_extractor_to_file .
type-pools:
rsaot.
parameters:
p_osrce type roosource-oltpsource,
p_filnm type rlgrap-filename,
p_maxsz type rsiodynp4-maxsize default 100,
p_maxfc type rsiodynp4-calls default 10,
p_updmd type rsiodynp4-updmode default 'F'.
data:
l_lines_read type sy-tabix,
ls_select type rsselect,
lt_select type table of rsselect,
ls_field type rsfieldsel,
lt_field type table of rsfieldsel,
l_quiet type rois-genflag value 'X',
l_readonly type rsiodynp4-readonly value 'X',
l_desc_type type char1 value 'M',
lr_data type ref to data,
lt_oltpsource type rsaot_s_osource,
l_req_no type rsiodynp4-requnr,
l_debugmode type rsiodynp4-debugmode,
l_genmode type rois-genflag,
l_columns type i,
l_temp_char type char40,
l_filename like rlgrap-filename,
wa_x030l like x030l,
tb_dfies type standard table of dfies,
wa_dfies type dfies,
begin of tb_flditab occurs 0,
* field description
fldname(40) type c,
end of tb_flditab,
ls_flditab like line of tb_flditab,
l_file type string.
field-symbols:
<lt_data> type standard table,
<ls_data> type any,
<ls_field> type any.
call function 'RSA1_SINGLE_OLTPSOURCE_GET'
exporting
i_oltpsource = p_osrce
importing
e_s_oltpsource = lt_oltpsource
exceptions
no_authority = 1
not_exist = 2
inconsistent = 3
others = 4.
if sy-subrc <> 0.
* ERROR
endif.
create data lr_data type standard table of (lt_oltpsource-exstruct).
assign lr_data->* to <lt_data>.
call function 'RSFH_GET_DATA_SIMPLE'
exporting
i_requnr = l_req_no
i_osource = p_osrce
i_maxsize = p_maxsz
i_maxfetch = p_maxfc
i_updmode = p_updmd
i_debugmode = l_debugmode
i_abapmemory = l_genmode
i_quiet = l_quiet
i_read_only = l_readonly
importing
e_lines_read = l_lines_read
tables
i_t_select = lt_select
i_t_field = lt_field
e_t_data = <lt_data>
exceptions
generation_error = 1
interface_table_error = 2
metadata_error = 3
error_passed_to_mess_handler = 4
no_authority = 5
others = 6.
* get table/structure field info
call function 'GET_FIELDTAB'
exporting
langu = sy-langu
only = space
tabname = lt_oltpsource-exstruct
withtext = 'X'
importing
header = wa_x030l
tables
fieldtab = tb_dfies
exceptions
internal_error = 01
no_texts_found = 02
table_has_no_fields = 03
table_not_activ = 04.
* check result
case sy-subrc.
when 0.
* copy fieldnames
loop at tb_dfies into wa_dfies.
case l_desc_type.
when 'F'.
tb_flditab-fldname = wa_dfies-fieldname.
when 'S'.
tb_flditab-fldname = wa_dfies-scrtext_s.
when 'M'.
tb_flditab-fldname = wa_dfies-scrtext_m.
when 'L'.
tb_flditab-fldname = wa_dfies-scrtext_l.
when others.
* use fieldname
tb_flditab-fldname = wa_dfies-fieldname.
endcase.
append tb_flditab.
* clear variables
clear: wa_dfies.
endloop.
when others.
message id sy-msgid type sy-msgty number sy-msgno
with sy-subrc raising error_get_dictionary_info.
endcase.
describe table tb_flditab lines l_columns.
" MOVE DATA TO THE APPLICATION SERVER
open dataset p_filnm for output in text mode encoding utf-8
with windows linefeed.
data i type i.
loop at <lt_data> assigning <ls_data>.
loop at tb_flditab into ls_flditab.
i = sy-tabix.
assign component i of structure <ls_data> to <ls_field>.
l_temp_char = <ls_field>.
if i eq 1.
l_file = l_temp_char.
else.
concatenate l_file ',' l_temp_char into l_file.
endif.
endloop.
transfer l_file to p_filnm.
clear l_file.
endloop.
close dataset p_filnm.
Cheers,
Scott
Edited by: Jeffrey Holdeman on May 25, 2010 4:44 PM
Added markup to improve readability
Edited by: Jeffrey Holdeman on May 25, 2010 4:47 PM -
How to get field separator in flat file using GUI_DOWNLOAD function
hi,
how to get field separator in flat file using GUI_DOWNLOAD function.
thanking you.Hi,
Use WRITE_FIELD_SEPARATOR = 'X'.
Check this sample code
REPORT z_file_download.
DATA: w_name(90) TYPE c.
DATA:
BEGIN OF fs_flight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
currency LIKE sflight-currency,
END OF fs_flight.
DATA:
BEGIN OF fs_head,
carrid(10) TYPE c,
connid(10) TYPE c,
fldate(10) TYPE c,
price(10) TYPE c,
curr(10) TYPE c,
END OF fs_head.
DATA:
t_head LIKE
TABLE OF
fs_head.
DATA:
t_flight LIKE
TABLE OF
fs_flight.
fs_head-carrid = 'CARRID'.
fs_head-connid = 'CONNID'.
fs_head-fldate = 'FLDATE'.
fs_head-price = 'PRICE'.
fs_head-curr = 'CURRENCY'.
APPEND fs_head TO t_head.
SELECT-OPTIONS:
s_carrid FOR fs_flight-carrid.
START-OF-SELECTION.
SELECT carrid
connid
fldate
price
currency
FROM sflight
INTO TABLE t_flight
WHERE carrid IN s_carrid.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'D:\flight.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = t_head
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.xls'
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = t_flight
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 EQ 0.
MESSAGE 'Download successful' TYPE 'I'.
ENDIF.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How o place Flat file Using JMS Adapter.
Hi Frnds,
I have one scenario ,
Sender side i am having IDOC, i want convet the IDOC into Flat file. But my receiver side i have to use only JMS Adapter,
Flat file i have to place in FTP Server using JMS Adapter.
Can ne share your thoughts..
Regards,
rajRaj,
The below Link will help
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50061bd9-e56e-2910-3495-c5faa652b710
Surya,
Welcome Back to SDN.
Regards
Agasthuri Doss -
How to Create a Flat File using FTP/File Adapter
Can any body done workaround on creating the Flat file using FTP/File Adapter?.
I need to create a simple FlatFile either using of delimiter/Fixed length. using the above said adapters we can create XML file, i tried concatinating all the values into a single String and writing into a file, but it does not have proper structure
Can any body help me out on this..
Thanks
RamYou can create a text schema while creating a File Adapter. If schema is specified for File Adapter, it takes care of converting XML into fixed length or delimited format.
Thanks,
-Ng. -
Idoc to flat file using Integration process does not show up at all
Hello All,
I created a scenario IDOC to Flat File using Integration Process and one without IntegrationProcess. I am able to execute the one without Integration Process easily.
However when I send the IDOC from SAP then the Integration Process scenario just does not work.
I Checked SXMB_MONI There is no entry for the Integration Process.I can see entry for other without Integration Process.
SXI_CACHE : I can see my Integration Process active
SWEQADM : I have activated the Event Queue and Background job
SWF_XI_ADM_BPE : ALL BPE is showing green status.
All syntax check on IP are fine.
There is no Basis Help for me so there could be some additional basis steps which need to be configured. Has anyone faced such an issue with Integration Process?
Regards
PrashantaHope this might help you. when u configure an IDoc as Sender with BPM this is how you proceed.
<b>1<b>. let us split the scenario into two</b>.</b>
a. <b>Sender to BPM</b> ( Integration Process).
b. <b>BPM to Receiver</b>.
<b>2. First let us configure the first Sender to BPM.</b>
a. Sender Agreement( <b>Not required</b> ).
b. Receiver Agreement( <b>NOT Required</b>).
c. Receiver Determination( Sender Service, Outbound Interface, Receiver Service(<b>Integration Process</b>).
d. Interface Determination( Inbound Interface(Sender Abstract Interface), Message Mapping(NOT Required if your using transformation stepin Integration Process)).
<b>3. Now let us configure the Second BPM to Receiver.</b>
a. Sender Agreement( <b>NOT Required</b>)
b. Receiver Agreement( Sender Service(<b>Integration process</b>), Receiver Abstarct Interface,Receiver service, Inbound Interface).
c. Receiver Determination( Sender Service(Integration Process), Receiver Abstarct Interface,Receiver Service).
d. Interface Determination( Inbound Interface, Message Mapping(<b>NOT Required</b>)).
So Finally we have <b>One Receiver Agreement</b>, <b>Two Receiver Determinations</b>, <b>Two Interface Determinations</b>.
Please let me know if you have any more queries.
Regards
Gopi -
Spool SQl data into text file using dynamic sql
Hi,
I am spooling output data into text file using command
select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
'where <condition>';
here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
e.g Part|1211121313|A
but due to column width the output,I am getting is with spaces.
"Part then blank spaces |1211121313 then blank spaces |A"
how can I remove these spaces between columns.I used set space 0 but not working.
Thanks in advance.
Your help will be appreciated.Hi Frank,
I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
I am facing similar kind of issue in my present project.
I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
--Created : Sep 22,2008, Created By : Srinivasa Bojja
--Export all Fulfillments
--Scheduled daily after 1:00am and should complete before 3:30am
WHENEVER SQLERROR EXIT SQL.SQLCODE
SET LINESIZE 800
SET WRAP OFF
SET PAGESIZE 800
SET FEEDBACK OFF
SET HEADING ON
SET ECHO OFF
SET CONCAT OFF
SET COLSEP '|'
SET UNDERLINE OFF
SPOOL C:\Fulfillment.txt;
SELECT SRV.COMM_METHOD_CD AS Method,
SRV.SR_NUM AS "Fulfillment Row_Id",
CON.LAST_NAME AS "Filled By"
SRV.SR_TITLE AS Notes,
SRVXM.ATTRIB_04 AS "Form Description"
FROM SIEBEL.S_SRV_REQ SRV,
SIEBEL.S_SRV_REQ_XM SRVXM,
SIEBEL.S_USER USR,
SIEBEL.S_CONTACT CON
WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
SRV.OWNER_EMP_ID = USR.ROW_ID AND
CON.ROW_ID= SRV.CST_CON_ID;
SPOOL OFF;
EXIT; -
Transfer data from Result Set (Execute SQL Task) into Flat File
Hi to all,
My problem is this:
-) I have a stored procedure which use a temporary table in join with another "real" table in select statement. In particular the stored procedure look like this:
create table #tmp
col1 varchar(20),
col2 varchar(50)
--PUT SOME VALUE IN #TMP
insert into #tmp
values ('abc','xyz')
--SELECT SOME VALUE
select rt.*
from realTable rt, #tmp
where rt.col1 = #tmp.col1
-) I cannot modify the stored procedure because I'm not admin of database.
-) I HAVE THE REQUIREMENT OF TRANSFER DATA OF SELECT STATEMENT OF SOTRED PROCEDURE INTO FLAT FILE
-) THE PROBLEM is that if I use an OLEDB source Task within a Data Flow Task I'm not be able of mapping column from OLEDB source to flat file destination. The reason for this, is that in the "Column page" of OLEDB source task, SSIS do not retrieves
any column when we using a temporary table. The reason for this, is that SSIS is not be able to retrieve metadata related to temporary table.
-) One possible solution to this problem is to use an Execute SQL Task to invoke the stored procedure, store the result returned from stored procedure in a Result Set through a Object type user variable.
-) The problem now is: How to transfer data from result set to flat file?
-) Reading here on this forum the solution look be like to use a Script task to transfer data from result set to flat file.
QUESTIONS: How to transfer data from result set to flat file using a script task?? (I'm not an expert of vb .net) Is it really possible?? P.S.: The number of row returned of stored procedure is very high!
thanks in advance.Hi Visakh16<abbr
class="affil"></abbr>
thanks for the response.
Your is a good Idea, but I do not have permission to use DDL statement on the database in production environment. -
Insert into Flat File with no data
Hello,
One of my client is encountering a problem in loading data from oracle table to a Flat File.
We are using a IKM SQL to File.
A staging area different from Target and defined on the source Logical Schema.
and options Genreate Header and Insert rows.
The problem is :
At the end of the interface execution, which finish without error we see in the file, the header correctly generated which let me think that there's no permission problem with the file.
But there is no records...
And I don't know why ???
There is the .bad and .error files but they are empty.
The file datastore seems to be well declared with the good delimiters....
We are using the Sunopsis Driver File :
com.sunopsis.jdbc.driver.FileDriver
jdbc:snps:file
Cause the file are not accepted with the new one ...
Note that all our interfaces which are reading flat file work fine.
But there's no one writting in which work.
If somebody ever had this problem, or just have an idea about this let me know please.
Cordially,
BM"Bonjour",
I usually use the snpsoutfile API to unload data into flat file.
It's not the exact solution at your question, but i's a technical solution. -
Export batch data into CSV file using SQL SP
Hi,
I have created WCF-Custom receive adapter to poll Sql SP (WITH xmlnamespaces(DEFAULT 'Namespace' and For XML PATH(''), Type) . Get the result properly in batch while polling and but getting error while converting into CSV by using map.
Please can anyone give me some idea to export SQL data into CSV file using SP.How are you doing this.
You would have got XML representation for the XML batch received from SQL
You should have a flat-file schema representing the CSV file which you want to send.
Map the received XML representation of data from SQL to flat-file schema
have custom pipeline with flat-file assembler on the assembler stage of the send pipeline.
In the send port use the map which convert received XML from SQL to flat file schema and use the above custom flat-file disassembler send port
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
How can I split a pdf file into smaller files using Acrobat XI
How can I split a pdf file into smaller files using Acrobat XI?
Hi laforcej
Open the PDF In Acrobat ...
Go to Tools -> Pages -> Extract
Now Select the Page Number you Want to Extract and Save them -
Delete data from a flat file using PL/SQL -- Please help.. urgent
Hi All,
We are writing data to a flat file using Text_IO.Put_Line command. We want to delete data / record from that file after data is written onto it.
Please let us know if this is possible.
Thanks in advance.
VaishaliThere's nothing in UTL_FILE to do this, so your options are either to write a Java stored procedure to do it or to use whatever mechanism the host operating system supports for editing files.
Alternatively, you could write a PL/SQL procedure to read each line in from the file and then write them out to a second file, discarding the line you don't want along the way.
Maybe you are looking for
-
How do I use AT-A2150 board with LV 5.1 ?
Hi, I'm trying to find a way of using my old AT-A2150 board with labview 5.1. I followed some posting tips from NI knowledgeBase (1JACI8U3 and 1JO8TB2O ) and installed NI-DAQ 4.9. The only problem is that now I'm getting broken arrows on my DAQ VIs.
-
I have Encore CS3. I had two menus called "Romaji Songset Menu 1" and "Romaji Songset Menu 2" (I'll shorten that to "RSM" here), and I duplicated them and renamed the copies "Japanese Songset Menu 1" and "Japanese Songset Menu 2" (hereafter "JSM").
-
J just want to say that Video Call in Windows Live Mesenger (MSN) is far more stable than in Skype, always problemes with the connection.
-
H HP PC with Windows 7 that I just purchased recently. Two Printers: Officejet F4480 and Photosmart C6380 All-in-one series do NOT print any of web-pages, although I can print any others sites, i.e., e-mails, word and all other sites. I installed HP
-
ASA 5520 IP range block or Country IP block
hi, i need help on ASA 5520 and i would like to block countries IP address from the attack, there is any way to block countries ip address or range ip address . Thanks, Rabih