I don't understand why you want to use SVRMGRL instead of SQL*Plus to create a table. Also, the example you have provided won't give you what you want since you are asking to generate a dynamic CREATE TABLE statement and also because &new_table will not be assigned by the command line parameter passed to the script.
For Oracle 8.1.5 and later the following will work:
create_new_table.bat:
sqlplus / @new_table %1
new_table.sql
declare
new_table varchar2(40):='&1';
sqlstmt varchar2(255);
begin
sqlstmt:='create table '||new_table||' as select * from emp';
execute immediate sqlstmt;
end;
/
exit
If the Oracle version is older than 8.1.5 then it will be necessary to use the DBMS_SQL package. The batch file will not change, but new_table.sql would then be:
set serveroutput on size 1000000 verify off feedback off
declare
source_cursor integer;
created integer;
begin
source_cursor := dbms_sql.open_cursor;
dbms_sql.parse(source_cursor, 'create table &&1 as select * from emp', 2);
created:=dbms_sql.execute(source_cursor);
if created <> 0 then
dbms_output.put_line('Table Create failed for &&1');
else
dbms_output.put_line('Table &&1 created');
end if;
dbms_sql.close_cursor(source_cursor);
end;
/
exit
I hope this helps.
David D. Fitzjarrell
Oracle Certified DBA