validate csv file load


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting validate csv file load
# 1  
Old 12-28-2005
Lightbulb validate csv file load

Hi All,

I am using sqlldr to load my csv files into the database. The code in the sh script is as follows.

sqlldr ${DBUSER}/${DBPASS}@${ORACLE_SID} \
data=myCSV.data \
bad=myCSV.bad \
control=myCSV.ctl \
log=myCSV.log > /dev/null 2>&1

Now, the log file has some lines at the end which state the following:

Total logical records read: 30
Total logical records rejected: 1

This does not indicate why the record was rejected.

Now I want to validate the csv files, either before load or during load. During load would be better as i can add code in the same loader sh script.

The validation should be as follows:
1) Check for premature EOF in the input csv file.
2) Check for the number of fields for all records in the csv file.
3) Check for Not Null validations in the csv file.
4) Check for datatype violations in the csv file according to the database table column definitions.

This way I can find the reason for the records not being loaded.

If you guyz have faced such a scenario, do let me know your inputs.

Thanks in advance,
Rahul.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to validate header in a csv file

Hi All; I am struggling to write a script that validates file header. Header file would be like below with TAB separated TRX # TYPE REF # Source Piece Code Destination Piece Code every time I need to check the txt file if the header was same as above fields if validation success... (6 Replies)
Discussion started by: heye18
6 Replies

2. UNIX for Beginners Questions & Answers

Validate csv file

Hi guys, i want to validate the no.of colums in a csv file ,but if there is a comma(,) in any of the data values it should skip and count only valid (,) commas. e.g 1.abc,pqrs,1234,567,hhh result :4 2.abc,pqrs,1234,567,hhh,"in,valid",end12 result:6 here script should skip the comma inside... (10 Replies)
Discussion started by: harry123
10 Replies

3. Shell Programming and Scripting

Script to ingest a csv, validate data and insert into Oracle

Hi all i would appreciate your help... I am looking for a set of unix commands which i can use to 1) ingest a csv file with a known format 2) validate the filename 3) validate the data/datatypes 4) Insert into an oracle db Can you help get me started? yogz888 (1 Reply)
Discussion started by: yogz888
1 Replies

4. Shell Programming and Scripting

How to: Validate a CSV file using an XSD?

Hi All, I was wondering if there is a utility/perl library/way of validating the contents of a CSV file using an XSD. i.e. Customer csv (including Header & Trailer) Cust_num, Cust_nme, Cust_typ, Cust_act_dte, Cust_loc, 101,Joe's Pizza,Retail,10121979,Detroit, 102,Sony... (6 Replies)
Discussion started by: luinzi
6 Replies

5. Web Development

script to load data from csv file

hello i want a script to load the data line by line from a csv file into a mysql table (3 Replies)
Discussion started by: srpa01red
3 Replies

6. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

7. Shell Programming and Scripting

Shell Script to Load data into the database using a .csv file and .ctl file

Since i'm new to scripting i'm findind it difficult to code a script. The script has to be an executable with 2 paramters passed to it.The Parameters are 1. The Control file name(.ctl file) 2. The Data file name(.csv file) Does anybody have an idea about it? :confused: (3 Replies)
Discussion started by: Csmani
3 Replies

8. Shell Programming and Scripting

How to validate a CSV file?

Hi. I think some people have already asked this, but the answers/questions seem to be about validating the contents inside a CSV file. I am simply after a simple variable solution (ie 0 = false, 1 = true) that I can use in my script to say that file so-and-so is actually a CSV file, or in some... (4 Replies)
Discussion started by: ElCaito
4 Replies

9. UNIX for Advanced & Expert Users

How to load comma seperated values file (*.csv) into Oracle table

Hi all I need to input values in a .csv file into my Oracle table running in Unix, I wonder what would be the command to do so... The values are recorded in an excel file and I tried using a formatted text file to do so but failed because one of the field is simply too large to fit in the... (4 Replies)
Discussion started by: handynas
4 Replies

10. UNIX for Dummies Questions & Answers

How to load comma seperated values file (*.csv) into Oracle table

Hi all I need to input values in a .csv file into my Oracle table running in Unix, I wonder what would be the command to do so... The values are recorded in an excel file and I tried using a formatted text file to do so but failed because one of the field is simply too large to fit in the... (5 Replies)
Discussion started by: handynas
5 Replies
Login or Register to Ask a Question
MONGOIMPORT(1)							  Mongo Database						    MONGOIMPORT(1)

NAME
mongoimport - the Mongo import tool SYNOPSIS
mongoimport [OPTIONS] DESCRIPTION
mongoimport is a tool to import a MongoDB collection from JSON, CSV, or TSV. The query can be filtered or a list of fields to input can be given. OPTIONS --help show usage information -h, --host HOST server to connect to (default HOST=localhost) -d, --db DATABASE database to use -c, --c COLLECTION collection to use (some commands) --dbpath PATH directly access mongod data files in this path, instead of connecting to a mongod instance -v, --verbose be more verbose (include multiple times for more verbosity e.g. -vvvvv) -f, --fields NAMES comma separated list of field names e.g. -f name,age --fieldFile FILE file with fields names - 1 per line --jsonArray load a json array, not one item per line. Currently limited to 4MB. --ignoreBlanks if given, empty fields in csv and tsv will be ignored --type TYPE type of file to import. default: json (json,csv,tsv) --file FILE file to import from; if not specified stdin is used --drop drop collection first --headerline CSV,TSV only - use first line as headers COPYRIGHT
Copyright 2007-2009 10gen SEE ALSO
For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. AUTHOR
Kristina Chodorow 10gen January 2010 MONGOIMPORT(1)