Page 1 of 1

Issues Loading csv file into a Oracle Database

Posted: Tue May 29, 2007 7:55 am
by sashah
I have a datastage job that loads a csv file into an Oracle Database. The csv file has some disclosure text at the bottom which prevents the file from being loaded. Is there a way I can filter out this unwanted text while loading the data.

Thank you

Posted: Tue May 29, 2007 7:59 am
by DSguru2B
Define unwanted data? What is the error message that you are getting?

Posted: Tue May 29, 2007 8:03 am
by sashah
The error message is required column is missing. The reason I am getting this is because I have mapped the sequential file columns with the columns in the oracle table.

In the CSV file I have **DISCLOSURE** text in one of the columns at the end of file and nothing in the other columns. I want to filter these rows.

Thank you
DSguru2B wrote:Define unwanted data? What is the error message that you are getting?

Posted: Tue May 29, 2007 8:11 am
by DSguru2B
In the sequential file stage, activate filter command and put the following in the filter command box

Code: Select all

sed '$d'
This will delete the last line before the stage even starts reading it.

Posted: Tue May 29, 2007 8:41 am
by sashah
Thank you. Another question I have is how would I delete all the lines below the Disclosure text.
DSguru2B wrote:In the sequential file stage, activate filter command and put the following in the filter command box

Code: Select all

sed '$d'
This will delete the last line before the stage even starts reading it.

Posted: Tue May 29, 2007 7:04 pm
by ray.wurlod
With a more appropriate sed or awk script, of course. Might be time to invest some effort in learning these tools.

Posted: Wed May 30, 2007 8:00 am
by DSguru2B
I believe the following should work. Test it out before you stick to it.

Code: Select all

sed '/**DISCLOSURE**/;/^*$/d'

Posted: Wed May 30, 2007 8:02 am
by sashah
Thank you. I will try it.
DSguru2B wrote:I believe the following should work. Test it out before you stick to it.

Code: Select all

sed '/**DISCLOSURE**/;/^*$/d'