Unix Technical Forum

[NEWBIE] SQLLOADER - Load from multiple files

This is a discussion on [NEWBIE] SQLLOADER - Load from multiple files within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi, i've to load data from multiple file (eg. data01.dat data02.dat data03.dat data04.dat ) but i can now these ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-07-2008, 10:02 PM
Emanuele
 
Posts: n/a
Default [NEWBIE] SQLLOADER - Load from multiple files

Hi,
i've to load data from multiple file
(eg.
data01.dat
data02.dat
data03.dat
data04.dat
)

but i can now these file's name only in runtime, when i launch the
sqlloader command. So I cannot specify them on controlfile.

How it works with sqlloader?

Thx!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 10:02 PM
Daniel Morgan
 
Posts: n/a
Default Re: [NEWBIE] SQLLOADER - Load from multiple files

Emanuele wrote:
> Hi,
> i've to load data from multiple file
> (eg.
> data01.dat
> data02.dat
> data03.dat
> data04.dat
> )
>
> but i can now these file's name only in runtime, when i launch the
> sqlloader command. So I cannot specify them on controlfile.
>
> How it works with sqlloader?
>
> Thx!!


Not well unless you use Perl or another scripting language.

--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-07-2008, 10:05 PM
dbman63
 
Posts: n/a
Default Re: [NEWBIE] SQLLOADER - Load from multiple files

To qualify my post - I consider myself a programming "newbie" but am Oracle
8i certified & have 5 years experience using oracle 7.3.4 & 8i. I'm working
on a similar project and had the same question. I'm fortunate that I only
have to deal with one file at runtime, so I'm considering forcing the
output from the other database to consistently use the same file name, or
perhaps copy it to an archive & then rename it (to the consistent name in
the control file) with a batch file that would also call SQLLoader. I'm
still in the conceptual / design stages though...

Regards,
db

"Daniel Morgan" <damorgan@x.washington.edu> wrote in message
news:1091758948.416507@yasure...
> Emanuele wrote:
> > Hi,
> > i've to load data from multiple file
> > (eg.
> > data01.dat
> > data02.dat
> > data03.dat
> > data04.dat
> > )
> >
> > but i can now these file's name only in runtime, when i launch the
> > sqlloader command. So I cannot specify them on controlfile.
> >
> > How it works with sqlloader?
> >
> > Thx!!

>
> Not well unless you use Perl or another scripting language.
>
> --
> Daniel A. Morgan
> University of Washington
> damorgan@x.washington.edu
> (replace 'x' with 'u' to respond)
>




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-07-2008, 10:10 PM
Andy
 
Posts: n/a
Default Re: [NEWBIE] SQLLOADER - Load from multiple files

Daniel and DB,

Why don't you dynamically create the control file at runtime? For example:

echo "LOAD DATA" > dyn_control.ctl
for datafile in `ls *.dat`; do
echo "INFILE $datafile" >> dyn_control.ctl
done
echo "INTO TABLE table1 ...." >> dyn_control.ctl

Andy

"dbman63" <dbman63@yahoo.com> wrote in message news:<DHZSc.876$qB1.170@fe25.usenetserver.com>...
> To qualify my post - I consider myself a programming "newbie" but am Oracle
> 8i certified & have 5 years experience using oracle 7.3.4 & 8i. I'm working
> on a similar project and had the same question. I'm fortunate that I only
> have to deal with one file at runtime, so I'm considering forcing the
> output from the other database to consistently use the same file name, or
> perhaps copy it to an archive & then rename it (to the consistent name in
> the control file) with a batch file that would also call SQLLoader. I'm
> still in the conceptual / design stages though...
>
> Regards,
> db
>
> "Daniel Morgan" <damorgan@x.washington.edu> wrote in message
> news:1091758948.416507@yasure...
> > Emanuele wrote:
> > > Hi,
> > > i've to load data from multiple file
> > > (eg.
> > > data01.dat
> > > data02.dat
> > > data03.dat
> > > data04.dat
> > > )
> > >
> > > but i can now these file's name only in runtime, when i launch the
> > > sqlloader command. So I cannot specify them on controlfile.
> > >
> > > How it works with sqlloader?
> > >
> > > Thx!!

> >
> > Not well unless you use Perl or another scripting language.
> >
> > --
> > Daniel A. Morgan
> > University of Washington
> > damorgan@x.washington.edu
> > (replace 'x' with 'u' to respond)
> >

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-07-2008, 10:11 PM
Daniel Morgan
 
Posts: n/a
Default Re: [NEWBIE] SQLLOADER - Load from multiple files

Andy wrote:

> Daniel and DB,
>
> Why don't you dynamically create the control file at runtime? For example:
>
> echo "LOAD DATA" > dyn_control.ctl
> for datafile in `ls *.dat`; do
> echo "INFILE $datafile" >> dyn_control.ctl
> done
> echo "INTO TABLE table1 ...." >> dyn_control.ctl
>
> Andy


There is a demo of dynamically created control files at http://www.psoug.org

Click on Morgan's Library
Click on UTL_FILE.

--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com