If you do nothing else with the variable then the assigning of the command string to the variable is complete useless.
Scottn's way is a direct efficient way without any detour.
If you were going to execute the script and redirect the output to the log, this way is wrong anyway since you do not execute the script itself (just in case this was your intended goal).
Here again, do it like Scottn's says.
thanks for your inputs. i tried to do what Scott suggested but it is also the same error.
it seems that all dbms_output.put_line is consuming a large amount of memory in out AIX server since there are a lot of dbms_output.put_line in our SQL Script (mainly used for debugging).
commenting some of the output lines seems to omit the error but it seems to be a work around only.