Irena
Irena

Reputation: 21

Generate header with OdiSqlUnload for a csv file

How do I generate header with OdiSqlUnload for a csv file? At the moment I have this code but it does not generate the column headers ot the table.

OdiSqlUnload "-FILE=<%=odiRef.getSchemaName("SAMPLE_SCHEMA","D")%>/FILE.csv" "-DRIVER=<%=odiRef.getInfo("SRC_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("SRC_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("SRC_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("SRC_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-FIELD_SEP=;" "-ROW_SEP=\n" "-DATE_FORMAT=yyyy/MM/dd" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"

select * from <%=odiRef.getSchemaName("SCHEMA_NAME","D")%>.TABLE_NAME

I must not change the Oracle query, I am looking for option of OdiSqlUnload to generate automatically this header.

Upvotes: 0

Views: 764

Answers (2)

Benjamin Tua
Benjamin Tua

Reputation: 1

In order to achieve this do the following 3 steps: 1.Have your 1st step of odisqlunload to generate the herder to your main file e.g Main_Output.csv. 2.2nd step of odisqlunload to load data to your other file e.g _data.csv 3. 3rd step use odiFile Apend to append _data.csv to main_Outpout.csventer image description here

Upvotes: 0

JeromeFr
JeromeFr

Reputation: 1928

There is no parameter to OdiSqlUnload to add a header. I suggest to first write the header to a file, then use your OdiSqlUnload step and finally use OdiFileAppend to concatenate both files.

Upvotes: 0

Related Questions