in reply to How to select/insert/update on Oracle clob column

Not sure if you meant pl/sql or if you meant perl/sql, so here goes.

When using Perl and the DBD::Oracle module you are able to select LOBs, CLOBs, and BLOBs as a normal field. No special treatment. You will need to tell DBD that you are inserting a LOB, similar to this: $sth->bind_param($field_num, $lob_value, { ora_type => ORA_CLOB }); If you meant you wanted to run PL/SQL from Perl, then you'd do something similar to this example, from the docs:
$csr = $db->prepare(q{ BEGIN PLSQL_EXAMPLE.PROC_NP; END; }); $csr->execute;
According to the docs you cannot use LOBs and PL/SQL together in Perl.

HTH

Replies are listed 'Best First'.
Re: Re: How to select/insert/update on Oracle clob column
by Starky (Chaplain) on Apr 21, 2001 at 07:17 UTC
    Though this is a bit off topic, note that the
    { ora_type => ORA_CLOB }
    
    while seemingly trivial, can be terribly important.

    DBD::Oracle by default binds CLOBs to Oracle datatype VARCHAR2, which truncates whitespace; that is, if you do a

    UPDATE users SET firstname='Bob   ' WHERE userid='bob'
    
    then later do a
    $db->prepare("SELECT firstname FROM users WHERE userid='bob');
    $db->execute();
    my ($firstname) = $db->fetchrow_array()
    
    you will get
    $firstname eq 'Bob'
    
    While this seems trivial, if you ever put something like a frozen data structure (via the FreezeThaw module) in a CLOB, you'll end up getting errors all over the place when you later try to thaw it if the frozen structure happens to have whitespace at the end.

    elwarren is obviously wise in the ways of Perl and Oracle ;-)