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

hi.

i'm working with oracle 8i databases running on winnt. to read from 'long' type fields, i define a variable in my script called LongReadLen which makes it work perfect. But now, i need to write into a 'long' type field in the database.

Is there like a LongWriteLen that will do what LongReadLen does but inversely, for writting into the database table?

Ralph :)

Replies are listed 'Best First'.
Re: writting into databases
by jptxs (Curate) on Oct 27, 2000 at 16:08 UTC

    from  perldoc DBI in the Handling BLOB / LONG / Memo Fields section:

    When trying to insert long or binary values, placeholders should be used since there are often limits on the maximum size of an (insert) statement and the the quote entry elsewhere in this documentmethod generally can't cope with binary data. See the section on /Placeholders and Bind Values.

    in general, longs and lobs suck to deal with. in Perl or anywhere else. If you can avoid them in any way you can think of, do.

    "sometimes when you make a request for the head you don't
    want the big, fat body...don't you go snickering."
                                             -- Nathan Torkington UoP2K a.k.a gnat

Re: writting into databases
by Jonathan (Curate) on Oct 27, 2000 at 16:11 UTC
    It appears to be possible if you use placeholders (and hope your DBD driver supports it).
    From the DBI documentation
    When trying to insert long or binary values, placeholders should be used since there are often limits on the maximum size of an (insert) statement and the the quote entry elsewhere in this documentmethod generally can't cope with binary data. See the section on Placeholders and Bind Values.

    Never tried it myself and don't have access to Oracle at present. For more information 'perldoc DBI' and perhaps this node

    I could lie down like a tired child,
    And weep away the life of care
    Which I have borne, and yet must bear.
    Shelley 1792-1822
Re: writting into databases
by elwarren (Priest) on Oct 30, 2000 at 04:38 UTC
    No, LongWriteLen is not an option. It is not needed.

    Try not to use LONGs, oracle handles the newer LOBs much better. The change should be transparent in your code as the DBD::Oracle driver handles them the same.