473,320 Members | 1,856 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,320 software developers and data experts.

DB2 Execute Immediate

17
My environment
DB2 9.1.4 on Sun OS

I write a C embedded SQL to load data.

I declare host vars as:
EXEC SQL BEGIN DECLARE SECTION;
SQL TYPE IS CLOB(599999) sqlStr;
EXEC SQL END DECLARE SECTION;

then set sqlStr and execute sqlStr as

sprintf(sqlStr.data, "%s, %d, %d, '%s')", staticStr, recId, seqno, data);
sqlStr.length = strlen(sqlStr.data);
EXEC SQL EXECUTE IMMEDIATE :sqlStr;

my staticStr contains table name, column names in run time and "data" can contains very long string. "data" is also inserted into a clob column in the table specified inside staticStr.

The compilation is OK but in execution I get this error:

EXECUTE IMMEDIATE ERROR: SQLCODE: -805 SQLSTATE 51002: The package corresponding to an SQL statement execution request
was not found.

Does this mean I am missing a DB2 library in during compilation ??
I check and -805 means "The DBRM or package name not found in plan"

What does this mean ????
Please help. Thanks
Feb 6 '08 #1
3 6896
nghivo
17
I figured it out. It has something to do with the BIND process.
To solve the problem, deverlopers have to make sure that:

1. the makefile points to the right database.
2. correct db id/ password uses to connect to database during compilation.
3. in C code, the EXEC SQL CONNECT must also have the USER id USING pwd portion.

That will solve the mysterious -805 and 51002 code.
Please correct if I am wrong
Feb 6 '08 #2
sakumar9
127 Expert 100+
I am not sure if you have binded the package. (this is what the error says).
After precompilation, there will be one *.bnd file. You need to bind this package with DB2. You can use "db2 BIND <bindfilename.bnd>" command to bind the package.


Let me know if you still have this error,


Regards
-- Sanjay
Feb 7 '08 #3
nghivo
17
I did bind but bound to the wrong objects. The error message is quite ambiguous.
Everything is all right now.
Feb 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: michi | last post by:
Hello there... Can anybody tell me what is the difference when I excecute a sql statement within pl sql with/without "execute immediate" statement Thanks Michi :)
4
by: finlma | last post by:
I'm trying to run an EXECUTE IMMEDIATE within a PL/SQL if loop but it doesn't work for me. I'm trying to create a column conditionally but it doesn't work. It fails because there are apostrophes...
3
by: Agoston Bejo | last post by:
I am looking for the PL/SQL equivalent of the VBScript Exec and/or Eval functions, i.e. I want to be able to dynamically create a statement, then execute it in the current PL/SQL context, e.g. ...
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
0
by: vijay | last post by:
hai every bady.. this is vijay from india. I want execute "shutdown immediate" command on oracle database from perl script. I was trying to execute through connect(), prepare() & execute()..But It's...
1
by: lakon15 | last post by:
Dear all, I'll try to convert from SQL server Store Procedure to DB2 Store Procedure. I've make SP under DB2 like this CREATE PROCEDURE GetSearchedRecords (pKeyWords VARCHAR(1000), ...
5
by: umesh049 | last post by:
Hello, I want to delete all the date of all the table in a scheman. but i got error at execute immediate statement. can any body help me. thanks
3
by: Rahul Babbar | last post by:
Hi, I have the following doubt. Suppose I use the execute immediate statement and the statement to be executed is a Select statement from the sysibm.sysdummy1 table which will always return...
6
by: Oliver | last post by:
I'm fairly new to DB2. I have been assigned to build a delete trigger that finds the data type of each of the table's fields so that the trigger can then build a string consisting of OLD values...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.