•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 391,186 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,667 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser:
Views: 1278 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I'm trying to retrieve data (CLOB, string, integer) from a stored function.
My example code looks like:
###########
$dbh = DBI->connect(....) or die "can't connect";
$stmt = 'BEGIN :cursor := foo; END;';
$sth = $dbh->prepare ($stmt);
$sth->bind_param_inout(":cursor", \$refCursor, 0, { ora_type => ORA_RSET } );
$sth->execute();
while ( my ($clob, $str, $num)= $refCursor->fetchrow_array ) {
print "$clob, $str, $num\n";
}
$sth->finish();
--------
When I run my perl script, I get:
OCILobLocatorPtr=SCALAR(0x4cbdec), hello there, 1
OCILobLocatorPtr=SCALAR(0x4cbe4c), bye now, 2
How can I get the value of the CLOB data?
################################################################
The stored function foo() looks like:
FUNCTION foo
RETURN ref_cursor_type
IS
/* ---- TYPE ref_cursor_type is REF CURSOR; */
ref_cursor ref_cursor_type;
BEGIN
OPEN ref_cursor
FOR SELECT clob_col, string_col, int_col FROM foo_table ;
RETURN ref_cursor;
END;
################################################################
The foo_table looks like:
CREATE TABLE foo_table
(
clob_col CLOB,
string_col VARCHAR2 (100),
int_col NUMBER
);
Contents of foo_table are:
CLOB_COL STRING_COL INT_COL
-----------------------------------------
testing hello there 1
another test bye now 2
################################################################
Thanks
--Andrew
I'm trying to retrieve data (CLOB, string, integer) from a stored function.
My example code looks like:
###########
$dbh = DBI->connect(....) or die "can't connect";
$stmt = 'BEGIN :cursor := foo; END;';
$sth = $dbh->prepare ($stmt);
$sth->bind_param_inout(":cursor", \$refCursor, 0, { ora_type => ORA_RSET } );
$sth->execute();
while ( my ($clob, $str, $num)= $refCursor->fetchrow_array ) {
print "$clob, $str, $num\n";
}
$sth->finish();
--------
When I run my perl script, I get:
OCILobLocatorPtr=SCALAR(0x4cbdec), hello there, 1
OCILobLocatorPtr=SCALAR(0x4cbe4c), bye now, 2
How can I get the value of the CLOB data?
################################################################
The stored function foo() looks like:
FUNCTION foo
RETURN ref_cursor_type
IS
/* ---- TYPE ref_cursor_type is REF CURSOR; */
ref_cursor ref_cursor_type;
BEGIN
OPEN ref_cursor
FOR SELECT clob_col, string_col, int_col FROM foo_table ;
RETURN ref_cursor;
END;
################################################################
The foo_table looks like:
CREATE TABLE foo_table
(
clob_col CLOB,
string_col VARCHAR2 (100),
int_col NUMBER
);
Contents of foo_table are:
CLOB_COL STRING_COL INT_COL
-----------------------------------------
testing hello there 1
another test bye now 2
################################################################
Thanks
--Andrew
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- How to print to file (Perl)
- Generate Thumbnail images on the fly. (PHP)
- Problem while inserting into oracle date values frm vb (Visual Basic 4 / 5 / 6)
- What is sleep function (Perl)
- Program to automatically convert from C++ to matlab? (Legacy and Other Languages)
- using OCI to call a ORACLE stored function (C++)
- Calling Oracle Stored Procedures with ASP (ASP)
Other Threads in the Perl Forum
- Previous Thread: how to use % variables i perl
- Next Thread: Client File Download Management


Linear Mode