Ok, so i\'m a complete newb with oracle. Now that that\'s out of the way;
I think you can get an understand of what i\'m trying to do below. For each stored procedur
SPOOL is a SQLPlus directive and you can't mix it into the PL/SQL anonymous block. If you're going to do this purely in SQLPlus, I think the general idea would be to process in two passes, i.e. use a first script that dynamically generates the spool filename references into a second script that actually makes the dbms_metadata call.
[Edit]
This should be close to what you need - maybe a line termination problem, depending on your platform:
set pagesize 0
set linesize 300
spool wrapper.sql
select
'spool '||object_name||'.sql'||chr(10)||
'begin
dbms_metadata.get_ddl('||chr(39)||object_type||chr(39)||','||chr(39)||object_name||chr(39)||')'||' end;'||chr(10)||
'/'||chr(10)||
'spool off'
from user_objects
where object_type = 'PROCEDURE'
;
spool off