On Thu, Nov 20, 2003 at 09:29:23PM -0500, Jeff Urlwin wrote: > > > > > > I don't think LOB Locators have a string representation. > > They're objects. So using a typed placeholder is essential. > > Right. So I'm suggesting that we avoid it by putting all the code in an > anonymous PL/SQL block
Ah, I'd missed that. > -- just as a suggestion. And a good one. Tim. > Regards, > > Jeff > > > > Tim. > > > > On Tue, Nov 18, 2003 at 06:36:16PM -0500, Jeff Urlwin wrote: > > > Maybe I'm missing something, but how about something like: > > > > > > $xx->prepare("declare lob_loc BLOB; > > > Begin > > > SELECT msg into lob_loc FROM hub_messages where msg_id > > = ? FOR UPDATE > > > ; > > > dbms_lob.trim(lob_loc, 0); > > > end;"); > > > > > > $xx->execute('17210'); > > > > > > Regards, > > > > > > Jeff > > > > > > > > > > > > > > > You'd certainly need to use a placeholder, and you'd need to > > > > specify and ora_type for it. Not sure what type, offhand, and > > > > I'm not sure if it'll work anyway. I've not tried it. Head in > > > > that direction and let me know how it goes :) > > > > > > > > Tim. > > > > > > > > On Tue, Nov 18, 2003 at 01:56:41PM -0800, Steve Main wrote: > > > > > Hello all, > > > > > > > > > > I have been searching doc/google and have not been able > > to come up > > > > > with the correct way to get a lob locator from an > > Oracle table and > > > > > pass it to dbms_trim ( or even if there is a way ). Can > > > > anyone push > > > > > me in the right direction or have a working example? > > > > > > > > > > Some of the things I have been trying..... > > > > > > > > > > $lob_loc = $dbh1->selectrow_array(qq{ > > > > > SELECT msg FROM hub_messages where msg_id = '17210' > > > > FOR UPDATE > > > > > }, { ora_auto_lob=>0 }); > > > > > > > > > > # $sth1 = $dbh1->prepare( <<"SQL", {ora_auto_lob => 0 } ); > > > > > # SELECT msg > > > > > # FROM hub_messages > > > > > # WHERE msg_id = '17210' > > > > > # FOR UPDATE > > > > > #SQL > > > > > > > > > > $sth1->execute(); > > > > > > > > > > ($lob_loc) = $sth1->fetchrow_array(); > > > > > print "lobloc: $lob_loc\n"; > > > > > $sth2 = $dbh1->prepare("BEGIN > > > > > sys.dbms_lob.trim( > > > > > lob_loc => '$lob_loc', > > > > > newlen => '0'); > > > > > END;"); > > > > > $sth2->execute(); > > > > > > > > > > # ($message_list) = $sth1->fetchall_arrayref(); > > > > > > > > > > # foreach $row (@$message_list) { > > > > > # ( $message_id ) = @$row; > > > > > # oraMSG "INFO: Truncating message id: $message_id...."; > > > > > # $sth2 = $dbh1->prepare("BEGIN > > > > > # sys.DBMS_LOB.TRIM( > > > > > # lob_loc => > > '$message_id', > > > > > # newlen => 0); > > > > > # END;"); > > > > > # $sth2->execute(); > > > > > # oraMSG "Done.\n"; > > > > > # > > > > > > > > > > Thanks > > > > > > > > > > Steve > > > > > > > > > > > > > > > > > > > > > > > >