暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

How do I use a custom function in a SQL*Loader script?

2011-01-01
1292

The Oracle (tm) Users' Co-Operative FAQ

How to Call Functions From SQL*Loader.


Author's name: MichaelBialik

Author's Email: bialik@isdn.net.il

Date written: 6-Feb-2002

Oracle version(s): 8.1.6/8.1.7

Quite often we need to execute some logic during data load by SQL*Loader. It's possible to do it via triggers, but it is much more convinient to performs such once only tasks by calling built-in or user-defined functions. Following is an example of such call.


It is possible to call any built-in or user-defined function during load process. Usually it's done for date columns, when non-default date format must be used, however user-defined function(s) may be called to perform some application logic.

The syntax for such calls is quite simple:

LOAD DATA
INFILE *
APPEND
INTO TABLE dept (
	deptno	POSITION(01:02) INTEGER EXTERNAL,
	dname	POSITION(03:16) CHAR "LDR_PCK.NAME(:dname, :deptno)",
	loc	POSITION(17:29) CHAR
)
BEGINDATA
21Dep Loc
22Dep Loc 

Here LDR_PCK.NAME is name of package and function, :dnname and :deptno are parameters.

When calling user-defined functions we must remember that only conventional path may be used. An attempt to use direct path will cause an error:

	SQL*Loader-00417 SQL String (on column column_name) not allowed in direct path.

 


Further reading: N/A



最后修改时间:2020-04-16 15:13:25
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论