dbTalk Databases Forums  

Static Embedded SQL -- table change

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Static Embedded SQL -- table change in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kevin
 
Posts: n/a

Default Static Embedded SQL -- table change - 08-26-2003 , 11:50 PM






Hi,

I am new to DB2, need help.

I have an application using Static Embedded SQL with C. I need to
change the db schema to satisfy new business requirements by adding an
extra column to an existing table. This new column will be used in new
executables only. However, the changed table IS used in existing
ESQLs.

My question is: Do I need to rebuild (recompile/rebind, etc) all the
existing ESQL C programs that use this table? Is there anyway to
avoid this?

regards,

k.

Reply With Quote
  #2  
Old   
kevin
 
Posts: n/a

Default Re: Static Embedded SQL -- table change - 08-27-2003 , 03:18 PM






we are using MS 2000, with version 7.2 DB2.

I also noticed the following statement from DB2 online doc:

"Adding a column to a table will result in invalidation of all
packages with insert usage on the altered table."

If I have insert statements in the package like:

EXEC SQL
INSERT INTO anExistingTableBeenAltered
(anExistingColumn)
VALUES
(:value)

which does not have anything to do with the added column. Will this
package become invalid because of the insert?

appreciate any input.

k.


"Rhino" <rhino1 (AT) NOSPAM (DOT) sympatico.ca> wrote

Quote:
What OS are you using? What version of DB2 are you using? If you are running
DB2 on OS390, are you using packages and plans or just plans? This can
affect the answers to your question....

Rhino

"kevin" <wctdy2003 (AT) yahoo (DOT) com> wrote in message
news:7632f111.0308262050.2f08e47b (AT) posting (DOT) google.com...
Hi,

I am new to DB2, need help.

I have an application using Static Embedded SQL with C. I need to
change the db schema to satisfy new business requirements by adding an
extra column to an existing table. This new column will be used in new
executables only. However, the changed table IS used in existing
ESQLs.

My question is: Do I need to rebuild (recompile/rebind, etc) all the
existing ESQL C programs that use this table? Is there anyway to
avoid this?

regards,

k.

Reply With Quote
  #3  
Old   
Gert van der Kooij
 
Posts: n/a

Default Re: Static Embedded SQL -- table change - 08-27-2003 , 05:24 PM



In article <7632f111.0308271218.2a325c67 (AT) posting (DOT) google.com>,
wctdy2003 (AT) yahoo (DOT) com says...
Quote:
we are using MS 2000, with version 7.2 DB2.

I also noticed the following statement from DB2 online doc:

"Adding a column to a table will result in invalidation of all
packages with insert usage on the altered table."

If I have insert statements in the package like:

EXEC SQL
INSERT INTO anExistingTableBeenAltered
(anExistingColumn)
VALUES
(:value)

which does not have anything to do with the added column. Will this
package become invalid because of the insert?

The package will become invalid but you can use the command
'db2 rebind package <packagename>' to rebind it. If you do nothing
DB2 will automatically try to rebind the package when it is first
executed but I've seen severe locking problems because of that.


Reply With Quote
  #4  
Old   
kevin
 
Posts: n/a

Default Re: Static Embedded SQL -- table change - 08-28-2003 , 09:34 AM



Gert van der Kooij <gk-ibm-db2 (AT) xs4all (DOT) nl> wrote

Quote:
In article <7632f111.0308271218.2a325c67 (AT) posting (DOT) google.com>,
wctdy2003 (AT) yahoo (DOT) com says...
we are using MS 2000, with version 7.2 DB2.

I also noticed the following statement from DB2 online doc:

"Adding a column to a table will result in invalidation of all
packages with insert usage on the altered table."

If I have insert statements in the package like:

EXEC SQL
INSERT INTO anExistingTableBeenAltered
(anExistingColumn)
VALUES
(:value)

which does not have anything to do with the added column. Will this
package become invalid because of the insert?


The package will become invalid but you can use the command
'db2 rebind package <packagename>' to rebind it. If you do nothing
DB2 will automatically try to rebind the package when it is first
executed but I've seen severe locking problems because of that.
Thanks for the help.

What is the real reason behind this (package becoming invalid)? The
insert statement does not reference the new column. What really
happens behind the scene during bind/rebind for this SQL? Isn't just
the table statistics info needed?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.