Calling the function/procedure in the control file of the SQL*loader???
Hi,
Could you please let me know whether we can call procedure/function in the control file ? If possible, please share some examples.
Thanks in advance !!
Regards,
Vissu...
Please see below code, I think It will help you...
LOAD DATA
INFILE 'mail_orders.txt'
BADFILE 'bad_orders.txt'
APPEND
INTO TABLE mailing_list
FIELDS TERMINATED BY ","
( addr,
city,
state,
zipcode,
mailing_addr EXPRESSION "Your_function(:mailing_addr)",
mailing_city EXPRESSION "UPPER(:mailing_city)",
mailing_state,
move_date EXPRESSION "substr(:move_date, 3, 2) || substr(:move_date, 7, 2)"
)Edited by: Atanu Chatterjee on Nov 12, 2010 2:44 AM
Similar Messages
-
How to refer the SQL*Loader command line parameters in the control file
The problem I am trying to resolve is to insert the input file name when SQL*Loader is loading the record from the file. I have multiple files to load and it is nice to associate a record with a particular input file.
Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
Another option is to use external tables
Re: Data Loading
Message was edited by:
Jens Petersen -
Control file for the sql*loader
hi
i'm doing my project in database management as the part of my project i have to write the control file for the sql*loader so, any one please clear the funda...so that i can get back to my project work...help me with sample code ..Refer chapter 3 and 5 on this url for sql loader and its control file references :
http://download-west.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90192/toc.htm
or
http://download-east.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90192/toc.htm
You may also refer sql loader examples on this page:
http://otn.oracle.com/sample_code/products/intermedia/htdocs/avi_bulk_loading.html
Chandar -
Changing the File path for SQL Loader Recognition
I am learning how to create a control file. The names.ctl file was placed in "Names" folder in my "C:\Windows" file.
I get the following error when trying to run the script for sqlldr:
Sql*Loader-500 Unable to open file.
Sql*Loader-553 file not found
Sql*Loader-System error: the system cannot find the specified file.
The path on the folder in c:\Windows\names\names.ctl
How do I make SQL Loader recognize it?Pl post details of OS and database versions. Have you tried this ?
sqlldr CONTROL=c:\Windows\names\names.ctl ...HTH
Srini -
Want To Capture The File name Using the SQL Loader
Hi,
I Am loading The Data To Staging Table Using The SQL*developer, The File That need to be Loaded Will be One Of The Input To the SQL*Loader Concurrent Program.
In One Of The Column Of My staging Table I want To Put The File name.
Can We do the Same.
thanks,
AnkitNot unless you generate the loader controlfile dynamically.. try this.. pass file name as $1 first parameter. Use the below example and modify as per your requirement
1) create table with following table structure
create table temp_table (x varchar2(20),file_name varchar2(30));
2) create data file - test.dat (contains only values for x)
abc
def
geh
ggg
fff
3) create a host file host file - test.sh with following content:
echo "load data
infile $1
append
into table temp_table
fields terminated by ','
(x,
file_name constant "$1")" > test.ctl
sqlldr <usr>/<pwd>control=test.ctl
4) run the host file from unix prompt with data file name as parameter (ensure test.sh has execute permissions)
test.sh test.dat
Hope this helps
Regards,
Bhadri -
Loading the data from a packed decimal format file using a sql*loader.
Hi ,
In one of the project i'm working here i have to load the data into oracle table from a file using a Sql*loader but the problem is the data file is in the packed decimal format so please let me know if there is any way to do this....I search a lot regarding this ..If anybody faced such type of problem ,then let me the steps to solve this.
Thanks in advance ,
Narasingarao.declare
f utl_file.file_type;
s1 varchar2(200);
s2 varchar2(200);
s3 varchar2(200);
c number := 0;
begin
f := utl_file.fopen('TRY','sample1.txt','R');
utl_file.get_line(f,s1);
utl_file.get_line(f,s2);
utl_file.get_line(f,s3);
insert into sampletable (a,b,c) values (s1,s2,s3);
c := c + 1;
utl_file.fclose(f);
exception
when NO_DATA_FOUND then
if utl_file.is_open(f) then utl_file.fclose(f); ens if;
dbms_output.put_line('No. of rows inserted : ' || c);
end;SY. -
Launch the SQL*Loader From Stored Procedure???
Is it possible to aaunch the SQL*Loader from a stored procedure? Please help!
Try the documentation on external procedures
-
To schedule the SQL loader Script
How to schedule the SQL loader Script everyday at 6.30PM in windows Server 2003?
Could you please help me for this query?create a text file with your sql loader commands.
from batch file you can run sqlplus and call this text file.
add the schedule to your windows server -
Possibility of capturing data file name in SQL * Loader
Hi,
I have a requirement to capture the data file name in the staging table, is there a way that i can capture it in SQL * Loader or any other way of doing it.
Need experts suggestion please.
Thanks,
GenooHi Genoo.
how do we capture the file name and stores in the temporary table
You may use the above command mentioned in my previous post (if Linux) to populate the Test.csv file with the available file name in the directory, i.e:
ls /some/path/*.dat | xargs -n1 basename > /home/oracle/Test.csv
1. Ensure to first load the Test.csv file as for eg:
1,aaa
2,bbb
3,ccc
2. Create a control file to load these records into temporary tables,for eg:
load data
infile '/home/oracle/Test.csv'
into table file_name_upload
fields terminated by ","
( id, file_name )
3. Create the respective table in the database:
create table file_name_upload
id number,
file_name varchar2(20)
4. Load the data into temporary table
sqlldr test/test control=/home/oracle/sqlldr_test.ctl
Please refer notes:
SQL*Loader - How To Load A Date Column With Fractions Of Second (Doc ID 1276259.1)
Script To Generate SQL*Loader Control File (Doc ID 1019523.6)
SQL*Loader performance tips (Doc ID 28631.1)
How To use the Sequence Function of SQL*Loader (Doc ID 1058895.6)
How to Get Data from Existing Table to Flat File Usable by SQL*Loader (Doc ID 123852.1)
Also see link:
10 Oracle SQLLDR Command Examples (Oracle SQL*Loader Tutorial)
Thanks &
Best regards, -
Can We rename BAD File name in SQL Loader
Hi All,
Can we rename BAD File name in SQL loader?
If yes, how?
Thanks in Advance,
SHi,
You can rename the bad file before running SQL*Loader, or specify the name of the bad file using the BADFILE clause followed by a filename. If you do not specify a name for the bad file, the name defaults to the name of the datafile with an extension or file type of .bad
Specifying the Bad File
http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/ldr_control_file.htm#i1005085
Regards,
Hussein -
How can I call a function/procedure in VBA?
Hallo,
can somebody help me with this topic? I have vba-code and wanna call a oracle-procedure/function. Does this work? And how does this work?
Thanks, KatrinHallo,
now I tried to reach my aim with a procedure and a trigger but I get error-messages.
create or replace procedure updateNutzGeo (objnr integer, kat integer) AS
sqlStmt varchar2(500);
begin
sqlStmt := 'UPDATE NUTZUNG SET GEOMETRIE=(SELECT F'||Kat||'_GEOM FROM UG_F'||Kat||'_GEOM F, Nutzung N WHERE N.OBJNR='||Objnr||' AND F.F'||Kat||'_OBJNR='||Objnr||' AND GETFEATUREID(F.F'||Kat||'_FID) IN(SELECT MSLINK FROM FEATURE WHERE FCODE like '%0000')) WHERE N.Objnr='||Objnr||'';
EXECUTE IMMEDIATE sqlStmt;
end;
create or replace trigger update_nutz_geo_aft_upd
before insert or update on nutzung
for each row
begin
updateNutzGeo(:new.objnr,:new.kategorie);
end;
The error-messages I get:
ORA-00904: invalid columnname
ORA-06512: in "pilot.updatenutzgeo", line 5
ORA-06512: in "pilot.Update_Nutz_geo_Aft_Upd", line2
ORA-04088: Error while execution of trigger pilot.update_nutz_geo_aft_upd
Any help? -
Calling a function from an external AS file
I create a AS file that contains my DAO functions. I imported
the class into my application, but what do I have to do to call one
of its functions?
In my ProjectDAO.as I have updateProject(projectID:Number),
in my mxml I have a button that calls that function but I get a
'function cannot be found' error.
What am I missing?In your first post you said you wanted to call
updateProject(projectID:Number).
In your latest post you have this:
<mx:Button label="New Project"
click="PDAO.addNewProject(event)" />
I think it should be this
<mx:Button label="New Project"
click="addNewProject(event)" />
Where addNewProject is not in class ProjectDAO, but is the
click handler function in the mxml file.
Then within that addNewProject click handler you call
PDAO.updateProject(projectID).
If in fact addNewProject is another method in class
ProjectDAO, and is an instance method, then create a click handler
like myClickHandler(event) and do this:
<mx:Button label="New Project"
click="myClickHandler(event)" />
and here is the handler function:
private function myClickHandler(e:MouseEvent):void{
PDAO.addNewProject(projectID);
If instead addNewProject is a class method, call it like
this:
private function myClickHandler(e:MouseEvent):void{
ProjectDAO.addNewProject(projectID);
Your actual click handler function may differ, but these are
some hints. If none of this makes sense, start by reading FB3 help
topic Flex Programming Elements and all its sub-topics, compiling
all the sample apps, otherwise you will find it difficult to
proceed with Flex. -
RoR Calling Oracle Function/Procedure
Hello,
Has anyone got experience of calling an Oracle Function or Procedure from RoR?
thanks
DavidHello for calling function/procedure at RoR in Oracle I write muself classes and use they.
Module:
module SQLStatement
class NoTypeResult < StandardError
end # class
class SQLProc
attr_accessor :name, :arguments
def initialize( args = nil )
@name = args[:name] unless args[:name].nil?
@arguments = args[:arguments] unless args[:arguments].nil?
@conn = ActiveRecord::Base.connection.raw_connection
end # def initialize
def exec( args = nil )
unless args.nil? || ( !args.is_a? Hash )
args.each { |k, v| @arguments[k.to_s.intern] = args[k] }
end # unless
func_args = ''
@arguments.each { |k, v| func_args += "#{func_args == '' ? '' : ', '}#{k.to_s} => :#{k.to_s}"}
sql = "BEGIN {#@name}( #{func_args} );END;"
cursor = @conn.parse( sql )
@arguments.each do |k, v|
cursor.bind_param( ":#{k.to_s}", v )
end # each
cursor.exec()
end # def exec
end # class SQLProc
class SQLFunc < SQLProc
attr_reader :result
attr_accessor :result_type
def initialize( args = nil )
@result_type = args[:result_type] unless args[:result_type].nil?
super( args )
end # def
def exec( args = nil )
if @result_type.nil?
raise NoTypeResult, 'No type for result setting', caller
end # if
unless args.nil? || ( !args.is_a? Hash )
args.each { |k, v| @arguments[k.to_s.intern] = args[k] }
end # unless
func_args = ''
@arguments.each { |k, v| func_args += "#{func_args == '' ? '' : ', '}#{k.to_s} => :#{k.to_s}"}
sql = "BEGIN :result := #{@name}( #{func_args} );END;"
cursor = @conn.parse( sql )
@arguments.each do |k, v|
cursor.bind_param( ":#{k.to_s}", v )
end # each
cursor.bind_param( ":result", nil, @result_type )
cursor.exec()
@result = cursor[':result']
cursor
end # def exec
end # class
end # module SQLStatment
Example of use:
function = SQLStatement::SQLFunc.new(
:name => 'f_test_ins',
:result_type => Fixnum,
:arguments => {
:login =>'asdf',
:password => 'asdf',
:email => '[email protected]'
function.exec
raise function.result.inspect -
Problem in loading "SYSDATE" through the sql loader
Hi experts,
I have problems in inserting the sysdate while loading the data from the flatfile. The details of the control file is as follows:
OPTIONS (ERRORS=100, SILENT=(FEEDBACK))
LOAD DATA
INFILE 'c:\sample.dat'
APPEND
INTO TABLE RTD_TMO_MODEL_SCORES_BI
FIELDS TERMINATED BY ','
--OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(RECORD_ID "SQ_RTD_TMO_MODEL_SCORES_BI.NEXTVAL",
MODEL_ID,
BAN,
MISDN,
INSERT_DT date "SYSDATE",
SCORING_JOB_ID,
SCORE_ENTITY_ID,
MODEL_SCORE_DECIMAL,
MODEL_SCORE_INTEGER,
MODEL_SCORE_CHAR,
ANCHOR_DT date "YYYYMMDD",
RUN_DT date "YYYYMMDD")
The data values for columns RECORD_ID and INSERT_DT are not present in the data file. The first one is planned to insert with the sequence created in database. While the second one is inserted based on the SYSDATE function of the database.
Please guide me how to specify so that I can insert the sysdate for the INSERT_DT column.
Thanks in Advance
VenkatInstead of this
INSERT_DT date "SYSDATE",
Try this
INSERT_DT SYSDATE, -
How to load the international characters by using the SQL*Loader(UNIX)?
Hi Everyone,
I am not able to load the international characters thru SQL*Loader which is calling from Unix. Whenever I load these characters , appears in DB such as Square box. Please help me how to resolve the issue.
Using version is:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production
Thanks in advance.
Regards,
Vissu.....This may help
SQL> CREATE TABLE test_sqlldr_unicode (id INTEGER, name VARCHAR2(100 BYTE));
Table created.Now my data file.
1,"ABóCD"
2,"öXYZó"
3,"EFGÚHIJK"
4,"øøøøøøøøøøøøøøø"My control file.
LOAD DATA
CHARACTERSET WE8ISO8859P1
INFILE 'C:\test_sqlldr_unicode.txt'
REPLACE
INTO TABLE test_sqlldr_unicode
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(id INTEGER EXTERNAL , name )
{code}
Running the sqlldr
{code}
C:\>sqlldr USERID=hr/hr CONTROL=test_sqlldr_unicode.ctl LOG=test_sqlldr_unicode.
log
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Dec 30 19:38:22 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 5
C:\>
{code}
The table
{code}
SQL> SELECT * FROM test_sqlldr_unicode;
ID NAME
1 ABóCD
2 öXYZó
3 EFGÚHIJK
4 øøøøøøøøøøøøøøø
SQL>
{code}
Maybe you are looking for
-
Customer,vendor payment terms
dear sap FI gurus my client needs payment terms to be as the following: if i paid the vendor within the first month with cash payment he deserves discount of x% otherwise if he pay with check he pays the all amount the same for the customer and here
-
Customers have to make multiple attempts to pay
I'm highly embarrassed by how many times some of my customers have to resubmit their form before their Paypal payment is processed. It happens so often that I now have to check my forms every day to make sure I don't miss bookings, and then I have t
-
Keep getting app updates with same version number
I noticed that I keep getting update notifications in the app section in iTunes from the apps I bought and downloaded for free but they have the same version number. Like just now, I checked for updates and there where about 42! I believe it's for ev
-
HT203175 how to fix a damaged library
i get a message that my library is damaged...help!!
-
Conflict with the domain/user management
Unfortunately I configured the domain management twice with the Adobe server. As a result, the edcprincipalentity table has duplicate records (i.e my name appears twice in the table). I removed the duplicate domain and synchronized but I still able t