在SQL * Plus脚本中,我想使用
的结果select SUBSTR(file_name, 0, INSTR(file_name,'\',-1,1))
into :oradataPath
from dba_data_files where ROWNUM = 1;
在以下声明中:
CREATE TABLESPACE DEMO DATAFILE '&oradataPath\DEMO.DBF';
但SQL * Plus要求我提供oradataPath
答案 0 :(得分:2)
你可能需要动态的sql;例如:
declare
vOradataPath varchar2(100);
vSQL varchar2(1000);
begin
select SUBSTR(file_name, 0, INSTR(file_name,'\',-1,1))
into vOradataPath
from dba_data_files
where ROWNUM = 1;
--
vSQl := 'CREATE TABLESPACE DEMO DATAFILE ''' || vOradataPath || '\DEMO.DBF''';
execute immediate vSQL;
end;