Home » RDBMS Server » Server Utilities » HOW DO I INVOKE MULTIPLE SQL*LOADER COMMANDS?
HOW DO I INVOKE MULTIPLE SQL*LOADER COMMANDS? [message #71261] Thu, 03 October 2002 07:08 Go to next message
Lee Bennett
Messages: 3
Registered: September 2002
Junior Member
I am trying to run several SQLLDR commands two different ways. My first method is via SQL*Plus and I execute the cmd :- SQLLDR uname/pwd@host CONTROL = SECURITY_MAINGROUP.CTL LOG = SECMAINGRP.LOG
This executes no problem but the cmd window sits there until I close it and if I have another SQL*Loader cmd line in the file it doesn't run. If I press CTRL C to close the SQL*Loader session, then the next one will run. My first question is how do I run multiple cmds this way without having to intervene?
The second method that I'm using is to run the cmds from a PL/SQL procedure. It's running on Unix, here's the basic code :-

CREATE OR REPLACE PROCEDURE LEEB_SQL_LOADER_CTL
IS

-- DECLARE

CURSOR C_GET_TABLE_NAMES
IS
SELECT TABLE_NAME
FROM LEEB_REQUIRED_TABLES
WHERE DATA_CONVERSION = 'Yes'
AND TABLE_NAME='CAP';

R_TABLE_NAME_REC C_GET_TABLE_NAMES%ROWTYPE;

V_INVOKE_LOADER VARCHAR2(200);

BEGIN
OPEN C_GET_TABLE_NAMES;

LOOP
FETCH C_GET_TABLE_NAMES INTO R_TABLE_NAME_REC;

EXIT WHEN C_GET_TABLE_NAMES%NOTFOUND
OR C_GET_TABLE_NAMES%NOTFOUND IS NULL;

V_INVOKE_LOADER := 'SQLLDR uname/pwd'||
' CONTROL = /home/isd/lxb/' ||R_TABLE_NAME_REC.TABLE_NAME||'.CTL'||
' LOG = /home/isd/lxb/'||R_TABLE_NAME_REC.TABLE_NAME||'.LOG';

dbms_output.put_line('$ SQLLDR TAROT/TAROT'||
'CONTROL = /home/isd/lxb/' ||R_TABLE_NAME_REC.TABLE_NAME||'.CTL'||
' LOG = /home/isd/lxb/'||R_TABLE_NAME_REC.TABLE_NAME||'.LOG');

EXECUTE IMMEDIATE V_INVOKE_LOADER;

END LOOP;

CLOSE C_GET_TABLE_NAMES;

EXCEPTION

WHEN NO_DATA_FOUND THEN
GENERALPACKAGE.CREATEERRORLOG('LEEB','LEEB_SQL_LOADER_CTL','OTHERS ERROR',NULL);
UTL_FILE.FCLOSE_ALL;

WHEN OTHERS THEN
GENERALPACKAGE.CREATEERRORLOG('LEEB','LEEB_SQL_LOADER_CTL','NO DATA FOUND',NULL);
UTL_FILE.FCLOSE_ALL;

END;

/

Basically, it doesn't work. What am I doing wrong? Everything probably!
Re: HOW DO I INVOKE MULTIPLE SQL*LOADER COMMANDS? [message #71262 is a reply to message #71261] Thu, 03 October 2002 07:52 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
1. how are u calling sqlldr from sql*plus???
i have NO IDEA ABOUT THIS.
i beleive, u must be using host command?
simplest way is to write multiple shell scripts
and run them from OS.
2. If you are looking into invokin sqlloader from
pl/sql then,
you have u to some external proceudures or
dbms_pipe.

[url=http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:952229840241] TOM <a/> has good solution for this( calling host commands from pl/sql)
Previous Topic: Using SQL Loader if Oracle has Operatin System Level Authentication.
Next Topic: Oracle SQL how to
Goto Forum:
  


Current Time: Sun Apr 28 19:11:16 CDT 2024