2012-02-17 14 views

答えて

1

動的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; 
+0

ありがとうございました!それはうまくいくはずです。 – Pat

関連する問題