Context
I'm trying to import a dump that have some long lines (8k+ character) with SQL*Plus, so I face the error SP2-0027: Input is too long (> 2499 characters). This is a hard-coded limit and cannot be overcome.
Expected solution
I would like to stream my input in bash and to split lines longer than the expected width on the last , (comma) character.
So I should have something like
cat my_dump.sql | *magic_command* | sqlplus system/oracle@xe
Details
- I know that newer version can accept lines up to 4999 characters but I still have lines longer (
grep '.\{5000\}' my_dump.sql | wc -l) - It is not really feasible to update the dump by hand
- I did try to use
trbut this split every line wich I do not want - I did try to use
fmtandfoldbut it does not seems to be possible to use a custom delimiter - I am currently looking on
sedbut I cannot seem to figure out a regexp that would "find the last match of,in the first 2500 characters if there is more than 2500 characters"
,can't also appear in literal strings - in which case appending newlines after them would alter the values inserted in tables? Also, are there lines with more that 2500 consecutive characters with no commas?