PL/SQL (MOSC)

MOSC Banner

Parse a text file in PLSQL?

edited Jun 17, 2019 9:31AM in PL/SQL (MOSC) 6 commentsAnswered ✓

I have a need to parse a multi line text file and run a procedure for each line.  Essentially, I'm trying to add back uses to a cloned database.

The text file would look like this:

JOHNDOE#DEVELOPER

JANEDOE#DEVELOPER

What I would like to do is parse that file line by line, assign variables for username and role and then for each line, add the user and assign the role.

I'm fairly new to PLSQL so I would appreciate any help.  My environment is Oracle Enterprise Database 12.1.0.2 running on Redhat 7.

I was easily able to do this by creating an array variable in a shell script and then logging onto the database for every row but I thought it would be a lot better to log on once and parse the file rather that parse the file and log on for each row.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center