Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6592817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:36:13+00:00 2026-05-25T17:36:13+00:00

I have several external tables used to read file data into the DB each

  • 0

I have several external tables used to read file data into the DB each one for a particular file specification.

For files of a single format a table is reused by pointing it at a new default directory and new file name. This is working fine except I now need to dynamically change the BADFILE, LOGFILE and DISCARDFILE parameters whilst keeping the rest of the access parameters unchanged.

Is there a direct way to do this without having to respecify all the other access parameters (column transformations filed delimiters etc.) as well?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:36:14+00:00Added an answer on May 25, 2026 at 5:36 pm

    Unfortunately changing just the BADFILE, LOGFILE and DISCARDFILE parameters couldn’t be achieved without having to respecify the other access parameters too.

    For what it’s worth and for anyone who finds this question in the future i eventually worked around the problem with the following:

    Select the external table and use REGEXP_REPLACE on its access parameters to replace the parts of the access parameter BLOB that matched BADFILE, LOGFILE and DISCARDFILE and their associated values with the new values that I supplied.

      CURSOR external_table_cur(
         cp_external_table IN VARCHAR2,
         cp_new_log_dir IN VARCHAR2,
         cp_log_file IN VARCHAR2
      )
      IS
         SELECT table_name,
                REGEXP_REPLACE(
                   access_parameters,
                   <REGEX PATTERN>,
                   cp_new_log_dir||':'''||LOWER(cp_log_file),
                   1,
                   0,
                   'i'
                ) AS new_access_params
           FROM all_external_tables
          WHERE table_name = UPPER(cp_external_table);
    

    I then used dynamic SQL to alter the external table and supplied the new access parameters.

      -- Point external table to new file, directory and access params
      EXECUTE IMMEDIATE(
         'ALTER TABLE '
         || p_table_name
         || ' DEFAULT DIRECTORY '
         || p_directory
         || ' LOCATION ('''
         || p_filename
         || ''') '
         || ' ACCESS PARAMETERS ('
         || TO_CHAR(new_access_params)
         || ')'
      );
    

    It’s not ideal and I did end up having to respecify ALL the access parameters but using the REGEX (and fully testing the output) meant the process wasn’t too painful or slow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several inline jqueries, how can I move them into one single external
I have a index.php file that will include several external files: content/templates/id1/template.php content/templates/id2/template.php content/templates/id3/template.php
I have several tables whose only unique data is a uniqueidentifier (a Guid) column.
I have several JAR file pattern sets, like <patternset id=common.jars> <include name=external/castor-1.1.jar /> <include
I have a jquery page that loads parts stored in several external files. I
I have several .reg (Windows registry) files (generated by an external application) that need
We have several external DLL files being referenced in our Web Application Project. We
I have a form and several external classes (serial port, file access) that are
I have several images stored in content://media/external/images/media. I would like to display by using
We have several webapps, as well as an external device authenticating against the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.