Is there a longer type variable for building lengthy sql statements? how add new line too? I want to store the statement in a very long variable text so I can run it from sql prompt. I think it will exceed limit if I use normal variable. thanks
export DATABASE_LIST="/location/dblist.cfg"
export SQL_INSERT_TEXT=""
while read -r USERID ORACLE_SID2
do
### how do I do this if too long?? and add new line
SQL_INSERT_TEXT="${SQL_INSERT_TEXT} longgSqlStatements; \newline"
done < <(tac $DATABASE_LIST)
echo ${SQL_INSERT_TEXT}
export sqllog = "/location/sqllog.log"
$ORACLE_HOME/bin/sqlplus -S accnt_name@db_name << EOF >${sqllog}
${SQL_INSERT_TEXT}
EOF
USERID
norORACLE_SID2
in your loop. Are these variables needed at all? Why don't you just pipe the output oftac
directly intosqlplus
(possibly with anawk
preprocessing stage in-between)? – Kusalananda♦ May 9 '19 at 18:16longgSqlStatements; \n
to the end of a here document. Is that correct? – ctrl-alt-delor May 9 '19 at 18:47