oracle - 当(1:5)在选择时加载外部内联视图要求绑定变量
问题描述
我在 SQL Developer 中找不到打开绑定的开关:
我创建了一个 csv 文件:
declare
v_file utl_file.file_type;
begin
v_file := utl_file.fopen('DATA_FILE_DIR', 'example2.csv', 'W');
utl_file.put_line(v_file, 'colid|colstring|colnumber|coldate');
utl_file.put_line(v_file, '1|"nothing"|231.12|2019-01-03 23:43:32');
utl_file.put_line(v_file, '2|"not more"|121|2020-10-05 14:33:15');
utl_file.FFLUSH(v_file);
utl_file.fclose(v_file);
end;
我想用内联选择阅读:
select c_001,c_002, c_003, c_004 from external
(( c_001 varchar2(200)
, c_002 varchar2(200)
, c_003 varchar2(200)
, c_004 varchar2(200)
)
TYPE oracle_loader
default directory DATA_FILE_DIR
access parameters (
RECORDS DELIMITED BY newline
load when (1:5) != 'colid'
LOGFILE DATA_FILE_DIR:'inline_ext_tab_%a_%p.log'
FIELDS CSV WITH EMBEDDED TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL(
c_001
, c_002
, c_003
, c_004
)
)
location ('example2.csv')
reject limit unlimited
)
我得到的问题load when (1:5) != 'colid'
是要求绑定替换。
set define off;
set escape off;
在我的情况下没有帮助。有什么想法可以防止这种行为吗?使用跳过 1 是因为错误 29420254 没有选项。
load when text != 'xxxxxxxxxxxxxx'
使用代替的回归错误 29420254 skip 1
:
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-30653: reject limit reached
select filename,text
from external(( FILENAME VARCHAR2(255 CHAR),text VARCHAR2(10 CHAR))
TYPE ORACLE_LOADER
DEFAULT DIRECTORY "DATA_FILE_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY newline
preprocessor DATA_FILE_DIR:'add_filename_semikolon.sh'
load when text != 'xxxxxxxxxxxxxx'
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
(
FILENAME CHAR(255),
text CHAR (10)))
LOCATION
( 'Testfall_s1.csv')
);
Testfall_s1.csv:
"xxxxxxxxxxxxxx"
"abcd"
add_filename_semikolon.sh
#!/bin/bash
# Separator: ;
FILENAME='"'${1##*/}'"'
/usr/bin/sed -e 's/^/'$FILENAME';/' $1
但是在重新评估错误时(有补丁可用,但不想修补每个虚拟机......)我错过了一个preprocessor
我目前不使用的重要要求......
解决方案
推荐阅读
- performance - 稀疏文件的性能损失?
- google-apps-script - 将新的 HTML 加载到侧边栏而不重新加载整个侧边栏
- c++ - 从函数中安全返回和处理动态分配的内存,C++ 11
- c# - 打开虚拟机失败
- java - HttpURLConnection 响应显示为未经授权
- jaspersoft-studio - JDBC 数据库连接失败
- c++ - Cuda 写入设备上的数组不会改变值
- java-8 - 我们可以使用 Novel Ldap api 为 OpenDJ 加载模式(基本模式)吗?
- postgresql - ORDER BY [array] 每行和每列排序后
- webpack - Webpack - 如何配置为只有相对 url 作为输出?