1

I'm declaring and initializing the variable like this:

var test CLOB
exec :test := q'<
many many lines
many many lines
>'

I suppose I didn't really expect this syntax of string-quoting to work outside of PL-SQL blocks, but if there a SQLPlus equivalent? In particular, is there a syntax that doesn't require mangling every line in between the quotes (putting an escape before every newline in the file)? I expect this SQLPlus script to be generated by a shell script, with the value of the clob just catted in from another file.

4

1 回答 1

3

execute实际上创建并运行一个 PLSQL 匿名块,但它必须放在一行中。因此,您可以改为显式编写 PLSQL 块,如下所示:

begin 
:test :=  q'<
many many lines
many many lines
>' ;
end; 
/

如果够方便的话。

于 2013-11-04T23:40:26.817 回答