Creating SQL scripts
Four SQL scripts are created: /tmp/3001.sql
, /tmp/3002.sql
, /tmp/4999.sql
and /tmp/5000.sql
.
The number in the filename corresponds to the number of characters in the first line (including new line):
printf "%-2999s;\nexit\n" "select '3001' len from dual" > /tmp/3001.sql
printf "%-3000s;\nexit\n" "select '3002' len from dual" > /tmp/3002.sql
printf "%-4997s;\nexit\n" "select '4999' len from dual" > /tmp/4999.sql
printf "%-4998s;\nexit\n" "select '5000' len from dual" > /tmp/5000.sql
Using
wc
to verify the length of the first lines:
head -1 /tmp/3001.sql | wc -c
head -1 /tmp/3002.sql | wc -c
head -1 /tmp/4999.sql | wc -c
head -1 /tmp/5000.sql | wc -c
Executing the scripts
The scripts are now executed in SQL*Plus.
SQL*Plus can execute files whose maximum line length is 3000 characters (without new line):
$ sqlplus -S rene/rene@localhost/freepdb1 @/tmp/3001.sql
LEN
----
3001
However, adding one character does not permit to execute the script anymore:
$ sqlplus -S rene/rene@localhost/freepdb1 @/tmp/3002.sql
SP2-0341:
line overflow during variable substitution (>3000 characters at line 1)
Still the same error with 4999 characters:
$ sqlplus -S rene/rene@localhost/freepdb1 @/tmp/4999.sql
SP2-0341:
line overflow during variable substitution (>3000 characters at line 1)
As soon as the input length reaches 5000 characters, a different error is thrown:
$ sqlplus -S rene/rene@localhost/freepdb1 @/tmp/5000.sql
SP2-0027: Input is too long (> 4999 characters) - line ignored