使用perl将blob插入oracle DB

Laz*_*man 0 oracle perl oracle10g

这有可能吗?我在'网上看到了关于指示应该使用存储过程的引用,但是我有一个脚本需要将gzip压缩数据插入到数据库中.如果有的话,我怎么能这样做呢?谢谢

Mig*_*Prz 11

你需要使用DBD :: Oracle模块,

use DBD::Oracle qw(:ora_types);
Run Code Online (Sandbox Code Playgroud)

当你绑定params时,不要忘记指定ora_type

$sth = $dbh->prepare("insert ...");
$sth->bind_param($field_num, $lob_value, { ora_type => ORA_LOB });
$sth->execute
Run Code Online (Sandbox Code Playgroud)

$ lob_value是一个带有文件内容的标量变量.