oracle dbms_lob.createtemporary() 的意义何在?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21219588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the point of dbms_lob.createtemporary()?
提问by eaolson
I don't quite get the point of the dbms_lob.createtemporary() function. How is:
我不太明白 dbms_lob.createtemporary() 函数的要点。怎么:
DECLARE
myclob CLOB;
BEGIN
myclob := 'foo';
END;
any different from:
任何不同于:
DECLARE
myclob CLOB;
BEGIN
dbms_lob.createtemporary( myclob, TRUE );
myclob := 'foo';
dbms_lob.freetemporary( myclob );
END;
I'm assuming the actions in between the create and free calls make it relevant, but I'm just not clear on how.
我假设 create 和 free 调用之间的操作使其相关,但我不清楚如何。
采纳答案by Wernfried Domscheit
In earlier times you were always forced to use DBMS_LOB package. Then in Oracle 10g a feature called "SQL semantics for LOB" was introduced and now you can use the simplified syntax.
在早期,您总是被迫使用 DBMS_LOB 包。然后在 Oracle 10g 中引入了一个称为“用于 LOB 的 SQL 语义”的特性,现在您可以使用简化的语法。
In CREATETEMPORARY
you can specify the duration of the LOB in SQL semantic you cannot.
在CREATETEMPORARY
您可以指定SQL LOB的时间语义你不能。
In your case the LOB is freed in the same way, i.e. when you leave the scope (i.e. the PL/SQL block) where the LOB is declared, then it is freed.
在您的情况下,LOB 以相同的方式被释放,即当您离开声明 LOB 的范围(即 PL/SQL 块)时,它就会被释放。
When you use FREETEMPORARY
then the temporary segment in tablespace is released, when you call myclob := NULL;
it will be kept.
当你使用FREETEMPORARY
然后表空间中的临时段被释放,当你调用myclob := NULL;
它时它会被保留。