你可以編寫一個使用動態SQL的PL/SQL塊。類似於
DECLARE
l_current_temp_size_mb NUMBER;
l_sql_stmt VARCHAR2(1000);
BEGIN
SELECT SUM(bytes)/1024/1024
INTO l_current_temp_size
FROM dba_temp_files
WHERE tablespace_name = 'TEMP';
l_sql_stmt :=
'CREATE TEMPORARY TABLESPACE tempTest TEMPFILE <<somepath>> size ' ||
to_char(l_current_temp_size_mb/2) ||
' M';
-- Print out the SQL statement or write it to a table so that if there is an error,
-- you know what SQL statement was generated and can debug it.
dbms_output.put_line(l_sql_stmt);
EXECUTE IMMEDIATE l_sql_stmt;
END;
謝謝賈斯汀!這應該工作。 – Pat 2012-02-18 02:10:51