chuckd has asked for the wisdom of the Perl Monks concerning the following question:

HI,
I got sqlldr to stream by the three lines below:
open (my $sqlldr, "|sqlldr usr/pass\@db control=sbteststream.ctl log=sb.log bad=sb.bad direct=true")
|| die "Cannot open sqlldr\n";
print $sqlldr "16107364Ø454370Ø60Ø10eb2b53ea80d0b63e72d8a63e6e1b75Ø3800Ø\n";
close($sqlldr);
Is it possible to stream the .ctl file into sqlldr without having to write it to disk?
  • Comment on streaming a .ctl file into sqlldr with perl

Replies are listed 'Best First'.
Re: streaming a .ctl file into sqlldr with perl
by Fletch (Bishop) on Dec 03, 2008 at 20:27 UTC

    If your OS supports it you could use either a named pipe (see your system's mknod(1) man page); or if it has the support for named file descriptors use a pipe pair and tell it to read from /dev/fd/# (replacing the # with whatever fileno returns for the reader side; see perlipc for more on pipes). Then again it's possible that sqldr wants a seekable file and neither of these approaches will work and you'll be stuck with a temp file.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: streaming a .ctl file into sqlldr with perl
by jfroebe (Parson) on Dec 03, 2008 at 20:27 UTC

    Looks like a continuation of your using stdin with sqlldr post. cmdrake pointed out that you should be able to use mkfifo/mknod to create a named pipe to load the data. Did this work for you?

    Jason L. Froebe

    Blog, Tech Blog

      Hi, I didn't need to create a named pipe. The above code worked for me. I started sqlldr as a file handle and wrote to it like a file. The only addition that was made was a pipe in front of the sqlldr process call in the open function. So yes I guess it does open a pipe, just not the way I thought it would.