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

  • Home
  • SEARCH
  • 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
  • 0 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 a form and several external classes (serial port, file access) that are
On our server, we have several periodical jobs that login to external accounts through
We have several seismic attribute generators which require data from seismic volumes which are
We have several branches of one project that share about half of the code
I have several large (200+ lines) of HTML that I need to place in
I have several ASP.NET MVC 3 Web applications that have a lot of common
I have a query similar to this FROM products AS p, .. LEFT JOIN
I am a newbie to Jquery as will be evident. I have 2 scripts
Do any of you know of a Java Map or similar standard data store
Some time ago we needed a solution for Single Sign On authentication between multiple

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.