【发布时间】:2018-04-04 13:55:34
【问题描述】:
我正在尝试在本地计算机上读取一系列模板文件,并将数据放入 oracle 数据库中的 clob 列中。当文件名是硬连线时,我有一些非常有效的东西:
Declare
v_Template clob:= '
@@MyFolder\MyFilename.txt
';
Begin
--Insert the contents of the file into a Clob column in the database
end;
/
此变量值稍后会插入到表的 CLOB 列中。
但是当我尝试为文件名添加一个变量时,v_template 的值会填充变量的名称,而不是文件的内容。有没有办法让这个问题得到妥善解决?例如,
DECLARE
-- the @@ expression must be in separate line as follows
Myfilename varchar(50):='@@MyPath\Template_File.txt';
file_contents VARCHAR2(32767):='
&&MyFileName
';
Begin
insert into MyTAble (template_definition)
values(file_contents);
commit;
end;
【问题讨论】:
标签: variables plsql oracle11g sqlplus