Hi,
I our site we encapsulates all the database access using plsql packages. This works fine until we got to using perl and clob/blob-s.
There does not seem to be an option to call a stored procedure from perl with clob as inout bind param and then write to it from perl (lob_write or so).
My code in the database looks like:
CREATE TABLE LOB_PERL_TEST (
ID NUMBER,
CLB CLOB);
procedure lob_perl_testp(id in number, clb in out clob) is
begin
insert into lob_perl_test(id, clb)
values(id, empty_clob())
returning clb
into clb;
end;
/
The perl code:
#!/usr/local/bin/perl
use DBI;
$ENV{"ORACLE_HOME"} = "E:\Oracle\Ora81";
connectToDB("orcl","scott","tiger");
insertElement(10, "clob");
#######################
sub insertElement {
my($id,$clob)=@_;
my $st = qq{
begin
lob_perl_testp( $id, :vclob);
end;};
print "$st\n";
$sth = $db->prepare($st);
$sth->bind_param_inout(":vclob", \$vclob , {ora_type => ORA_CLOB},0
+);
$rv = $sth->execute;
}
sub connectToDB {
my($dbname,$user,$passwd) = @_;
print "connectToDB $user/$passwd\n";
$db = DBI->connect("dbi:Oracle:" . $dbname, $user, $passwd)
|| die "Unable to connect to $dbname: $DBI::errstr\n";
print "connected $user/$passwd\n";
}
Any ideas ?
Hadar Paiss
hadar@net-post.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.