Home » RDBMS Server » Server Utilities » SQL Loader conditional statements?
SQL Loader conditional statements? [message #155419] Mon, 16 January 2006 01:45 Go to next message
k08489
Messages: 6
Registered: January 2006
Junior Member
Hi, can anyone tell me if it is possible to have if-else statements for a field column?

For example,

SITEID if(location is null) then get_siteid_by_asset (:ASSETNUM)
else if(asset is null) then get_siteid_by_location (:LOCATION)

If so, please give me an example. Thanks.

Re: SQL Loader conditional statements? [message #155426 is a reply to message #155419] Mon, 16 January 2006 02:51 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I *think* that there's no such possibility (at least, I don't know about it), but what you could do is write your own function which would - as parameters - have "location" and "asset" and return desired value.

In your example, rewrite existing functions or - if it is too complicated - write a new one which would then call existing ones.

How to incorporate a function into the SQL*Loader utility, see Barbara's example.
Re: SQL Loader conditional statements? [message #155427 is a reply to message #155426] Mon, 16 January 2006 03:04 Go to previous message
k08489
Messages: 6
Registered: January 2006
Junior Member
I found out the way, it is something as follows:

SITEID "decode ( :LOCATION, null, (get_siteid_by_asset (:ASSETNUM)),(get_siteid_by_location (:LOCATION)))",

For others keen to follow up, you can read at this url:

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:420419456499
Previous Topic: When Importing data from Toad: Error: Out Of Memory - Very Urgent
Next Topic: HELP!How to convert Tamino XML DB Server to Oracle XML DB Server and/or Ora
Goto Forum:
  


Current Time: Tue Jul 02 04:21:45 CDT 2024