473,387 Members | 1,904 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,387 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 6907
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.