Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2012
    Posts
    1

    Help using SQL Loader to count the number of fields being loaded

    I am loading data into tables using SQL Loader. My datavaires from being comma delimited to simply using whitespace.

    The problem is that vendors will often decide to add or remove a column without notification. Is there a way to have the loader check the number of fields then either break if it's incorrect or load the data if it is correct?

    Any help you can provide will be greatly appreciated

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,647
    what exactly does the "checking"?
    based upon what criteria does the checker decide if file is correct or not?

    You have a business process problem that is independent of & external to Oracle.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,679

    Cool

    If the files are in *nix OS, you could use "awk", something like this:

    Code:
    awk -F' ' 'BEGIN {minf=9999; maxf=-1}
    { if(NF < minf) minf = NF;
      if(NF >= maxf) maxf = NF;
    } END {print "Min fields = "minf", Max fields = "maxf;}
    ' TheFile.txt
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •