in reply to stdout and special characters

Setting binmode on $sqlldr (opened to the pipe, i.e. what you're calling stdout) and FILE should take care of the Perl side (to prevent linefeed translations otherwise done on Windows), but I'm not sure what sqlldr would do with the binary stream...  In other words, it seems more like a sqlldr issue than a Perl one.

BTW, we're talking about Oracle's sqlldr, aren't we? Also, are you using a control file? If so, what does it look like? — Some more details might help.

Replies are listed 'Best First'.
Re^2: stdout and special characters
by chuckd (Scribe) on Dec 16, 2008 at 18:54 UTC
    Hi,
    Yes Oracle's sqlldr..
    I tried setting binmode(FILE) to open data in bin mode but it didn't seem to change the stream data.
    Here's the thing..what boggles me is that I can load the data correctly from a dat file into sqlldr, but not through stdout when I stream it like in the example. That's why I think it's a stdout issue and not a sqlldr issue.
    My .ctl file looks like this
    ---------------------
    LOAD DATA
    INFILE "-" "str '<endrec>\r\n'"
    APPEND

    INTO TABLE DOC_TMP_TEST
    FIELDS TERMINATED BY 'Ø'
    TRAILING NULLCOLS
    (

    document_id,
    text VARCHARC(9,100000000)
    )
      I tried setting binmode(FILE)...

      Have you also set "binmode $sqlldr;"? (Both in- and output must operate in binary mode.)

      As you have a .ctl file, how are you telling sqlldr about it? There's no "control=..." argument in your pipe command in open(), and the reference docs say "default: none".

        Yes I did set binmode on both FILE and $sqlldr. I didn't display the .ctl arguments in the open call. I left many of the arguments out because I felt it was trivial to the problem.