在 sql 加载程序中使用 ltrim 时出现错误 "Error parsing insert statement for table ROOT.LOAD_SQL"
Getting error "Error parsing insert statement for table ROOT.LOAD_SQL" while using ltrim in sql loader
我尝试使用 sql 加载程序将数据从数据文件加载到数据库 table load_sql。我的数据文件中有如下数据。
empid,ename
1,Raja,**Kanchi
2,Poo,**Kanchi
3,Bhasker,**Kanchi
4,Siva,**Kanchi
我必须加载才能以 load_sql table 格式加载它,如下所示:
1,Raja,Kanchi
2,Poo,Kanchi
3,Bhasker,Kanchi
4,Siva,Kanchi
我已经借助字符操作函数编写了一个控制文件,用于在第三列中插入记录,但我收到错误消息:
options(skip = 1,Errors = 100, direct = True)
load data
infile 'D:\SQLLDR\control.ctl'
truncate into table load_sql
when city = 'Kanchi'
fields terminated by ','
optionally enclosed by '"'
(
empid,
ename,
X filler,
city "ltrim(:city,*)"
)
我收到类似
的错误
'SQL*Loader-951: Error calling once/load initialization
ORA-02373: Error parsing insert statement for table ROOT.LOAD_SQL.
ORA-00936: missing expression'
ltrim(:city,*)
^
|
this is invalid
应该是
ltrim(:city, '*')
或者,可能,
replace(:city, '*', '')
您的控制文件中有一些语法错误。试试这个:
options(skip = 1,Errors = 100, direct = True)
load data
infile 'D:\SQLLDR\control.ctl' <-- This doesn't look like a data file name?
truncate into table load_sql
when (city = '**Kanchi')
fields terminated by ','
optionally enclosed by '"'
(
empid,
ename,
city "ltrim(:city, '*')"
)
我尝试使用 sql 加载程序将数据从数据文件加载到数据库 table load_sql。我的数据文件中有如下数据。
empid,ename
1,Raja,**Kanchi
2,Poo,**Kanchi
3,Bhasker,**Kanchi
4,Siva,**Kanchi
我必须加载才能以 load_sql table 格式加载它,如下所示:
1,Raja,Kanchi
2,Poo,Kanchi
3,Bhasker,Kanchi
4,Siva,Kanchi
我已经借助字符操作函数编写了一个控制文件,用于在第三列中插入记录,但我收到错误消息:
options(skip = 1,Errors = 100, direct = True)
load data
infile 'D:\SQLLDR\control.ctl'
truncate into table load_sql
when city = 'Kanchi'
fields terminated by ','
optionally enclosed by '"'
(
empid,
ename,
X filler,
city "ltrim(:city,*)"
)
我收到类似
的错误'SQL*Loader-951: Error calling once/load initialization
ORA-02373: Error parsing insert statement for table ROOT.LOAD_SQL.
ORA-00936: missing expression'
ltrim(:city,*)
^
|
this is invalid
应该是
ltrim(:city, '*')
或者,可能,
replace(:city, '*', '')
您的控制文件中有一些语法错误。试试这个:
options(skip = 1,Errors = 100, direct = True)
load data
infile 'D:\SQLLDR\control.ctl' <-- This doesn't look like a data file name?
truncate into table load_sql
when (city = '**Kanchi')
fields terminated by ','
optionally enclosed by '"'
(
empid,
ename,
city "ltrim(:city, '*')"
)