Skip to Main Content
  • Questions
  • To delete specific line from file using oracle

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Laxmi.

Asked: August 26, 2016 - 6:36 pm UTC

Last updated: August 27, 2016 - 2:37 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hi Tom,

is there any way to delete the specific line from the file using oracle?
Actually i have around 500 files, and i need to perform the same action on the all files.
Is there any process?

and Connor said...

You could create something with UTL_FILE to read the file, and write it to a new file (skipping the appropriate line), but that seems to be re-inventing the wheel.

Is there a reason it has to be done via 'oracle' (I assume you mean plsql).

Anything wrong with simple tools like 'grep' (unix) or 'findstr' (windows) ?

If it has to be *controlled* from Oracle, you could use the scheduler (dbms_scheduler) to run those OS commands.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Laxmi, August 30, 2016 - 3:33 pm UTC

Thank you Tom,

I tried the same using Unix script which work fine, and i thought of trying the same using oracle pl/sql. But anyways using Unix script is pretty simple and easier.
thanks a lot for your reply.

More to Explore

DBMS_SCHEDULER

More on PL/SQL routine DBMS_SCHEDULER here