473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Insert Clob using Perl into DB2 v8 on OS/390

Im trying to insert a clob into the database and I get the following
error.
DBD::DB2::st execute failed: [IBM][CLI Driver][DB2] SQL0804N The
application program input parameters for the current request are not
valid. Reason code "103". If a host variable or S
QLVAR in the SQLDA is invalid then: host variable/SQLVAR number = "5",
SQLTYPE = "393", SQLLEN = "33", host variable/SQLVAR type = "INPUT".
SQLSTATE=07002
Below is the perl function doing the insert.

$sql .= "insert into db2p.LOBT_POS_RCPT_IMG(storekey, register_num,
trx_num, sales_date, store_dt_tm, insert_dt_tm, receipt_image) ";
$sql .= "values (?, ?, ?, ?, ?, ?, ?)";

#$sql .= "values ($store1, $reg, $trx, date('$sdate'), $storedt,
current timestamp, $image)";
if ($DBG_LEV > 0){printf "%s\n", $sql;}
local ($sth);
local ($now) = "current timestamp";

$sth = $sel_ldbh->prepare( "$sql");
$sth->bind_param( 1, $store1 );
$sth->bind_param( 2, $reg );
$sth->bind_param( 3, $trx );
$sth->bind_param( 4, $sdate );
$sth->bind_param( 5, $storedt );
$sth->bind_param( 6, $now );
$sth->bind_param( 7, $clob);
$sth->execute();

Nov 12 '05 #1
1 4881
Dark wrote:
Im trying to insert a clob into the database and I get the following
error.
DBD::DB2::st execute failed: [IBM][CLI Driver][DB2] SQL0804N The
application program input parameters for the current request are not
valid. Reason code "103". If a host variable or S
QLVAR in the SQLDA is invalid then: host variable/SQLVAR number = "5",
SQLTYPE = "393", SQLLEN = "33", host variable/SQLVAR type = "INPUT".
SQLSTATE=07002
Below is the perl function doing the insert.

$sql .= "insert into db2p.LOBT_POS_RCPT_IMG(storekey, register_num,
trx_num, sales_date, store_dt_tm, insert_dt_tm, receipt_image) ";
$sql .= "values (?, ?, ?, ?, ?, ?, ?)";
Are you sure that the problem is the CLOB? If host variable number is
"5", that looks to me as it were the store_dt_tm... what is the format
of the $storedt variable? I believe it needs to look like a DB2
timestamp. Last time I bothered to solve this problem in perl, I put
it in a module, and stopped thinking about it. If you look for DB2::db
on CPAN, you'll find my solution. In short, I deal with timestamps in
perl fashion (time since epoch) in perl, and in DB2 fashion (timestamp)
in DB2, and the DB2::db framework does the conversion automatically.

If you look at the DB2::db framework, you'll notice DB2::Row - it has
the time_to_timestamp function which can do the conversion. And, of
course, a timestamp_to_time function for the reverse. Since the
license is the Perl license, you can steal the code and reuse it as
long as you abide by the license (which I'm not a lawyer, so I'm not
sure what quite exactly that means in your situation). Or you can
install DB2::db, and just call the function. Or, I suppose, you could
just use the whole framework. ;-)
#$sql .= "values ($store1, $reg, $trx, date('$sdate'), $storedt,
current timestamp, $image)";
if ($DBG_LEV > 0){printf "%s\n", $sql;}
local ($sth);
local ($now) = "current timestamp";

$sth = $sel_ldbh->prepare( "$sql");
$sth->bind_param( 1, $store1 );
$sth->bind_param( 2, $reg );
$sth->bind_param( 3, $trx );
$sth->bind_param( 4, $sdate );
$sth->bind_param( 5, $storedt );
$sth->bind_param( 6, $now );
$sth->bind_param( 7, $clob);
$sth->execute();

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rabbit | last post by:
Hi all, I want to know, how can i insert the xml data using createXML() with CLOB in the xmltype column? I store the xml data at first in the clob column und want to import these data in the...
1
by: Anoop | last post by:
Hi, I have a table that contains a huge number of fields, out of which 3 are VARCHAR2(2000). I am using a Orcale 9i with UTF8 char set. The data I am trying to insert is ASCII (English). When I...
4
by: Nina via DBMonster.com | last post by:
Hi, I'm trying to insert a clob / blob from the local file system into a basic table. This can be quite easily accomplished in Oracle but I have not found any wquivalent way on how to do this in...
0
by: yoyo | last post by:
DOes anybody have a working example of how do make this work? I've tried everything I could find, Clara patch, many non-working examples using pack, baseencode, addslashes, str_replace, bin2hex,...
1
by: gimme_this_gimme_that | last post by:
Is there a command line trick that inserta ascii text into a CLOB column? Thanks.
0
by: *Davide* | last post by:
Hello, This query (PHP+Oracle) works: global $user,$pass,$sid; $db_charset = 'UTF8'; $db = OCILogon($user, $pass, $sid, $db_charset); $clob = OCINewDescriptor($db, OCI_D_LOB); $txt_clob =...
3
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN...
1
by: Veeru71 | last post by:
When I am SELECT'ing a CLOB column from command prompt, the output is getting truncated after a certail limit (8 K ??) How do I get the full data out of a CLOB column? Are there any string...
7
by: shivapadma | last post by:
I want explanation for CLOB datafield 1.I created clobtable with the query create table clobexample(id number,text CLOB); 2.I tried to insert very large text by the following query insert...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.