Creating Oracle Log File

Hello,

I have created an Oracle 9i PL/SQL procedure that will load records from one database into another.  I want to create a log file at the end of the run that will be stored on the database server (or some other network server) that contains information about how many records processed and how many failed during the run.  What is the code to do this within my procedure?

Thanks,
Chris
ccorrenteAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MikeOM_DBACommented:
Use the UTL_FILE package to write log info to disk.
0
geotigerCommented:

Or you could create a external table and store the statistic about your data loads in the table. Since the external table reside outside your database as plain text file, you can view the file using other tools as well.

For example,

SQL> CREATE TABLE emp_ext
      (
      empcode NUMBER(4),
      empname VARCHAR2(25),
      deptname VARCHAR2(25),
      hiredate date
      )
  ORGANIZATION EXTERNAL
    (
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY ext_tables
      ACCESS PARAMETERS
      (
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        MISSING FIELD VALUES ARE NULL
      )
      LOCATION ('emp_ext1.dat','emp_ext2.dat')
    )
  REJECT LIMIT UNLIMITED;

Table created.



You can find details about external table at this link: http://www.dbasupport.com/oracle/ora9i/External_Tables9i.shtml
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.