Adding a little flexibility
Dexter Jones, November 09, 2022 - 4:34 pm UTC
I agree - keep up the great work, guys.
If your file has a footer that is not static, perhaps with a line count, you will need a bit more flexibility to deal with it. In my case, the footer is: LINE COUNT: nnn where nnn varies with each file.
The solution in this case is qualify the position of the constant portion of the footer text to load when .
In my case it is always at the beginning of the line which simplifies things somewhat.
create table t (
text varchar2(1000)
) organization external (
default directory tmp
access parameters (
records delimited by newline
-- load when (text != 'and skip this') -- good for static text.
load when (1:10) != 'LINE COUNT' -- handles changing values.
skip 1
)
location ('test.txt')
);
PS: This isn't in the Database Utilites doc (for 19c), but it might be nice to add an example for future reference. :)
November 11, 2022 - 3:30 am UTC
good stuff