substitution variables in db2

substitution variables in db2

 

  

hi
i like to know how to pass runtime values in db2

Example
select * from emp where deptno=?

i like to pass the value for deptno at runtime.

if it is oracle i will do in this way

select * from emp where deptno=&deptno.
how to do the same in db2

Regards,
A.Ramakrishna
DBA
Four Soft Ltd


----- Original Message -----
From: <arul.[Email Address Removed] <[Email Address Removed] Wednesday, March 31, 2004 10:16 AM
Subject: RE: Managing development environments with DB2


As far as I know....

1. You can use "ALTER TABLE tblName ALTER COLUMN " statement only if you
want to INCREASE the size.Decreasing the size is not allowed, even if
table/coulmn is empty.
2. You can alter only the column of type VARCHAR.

For all other datatypes, you have to drop the table and re-create it.

Workaround is that since your requirement asks for changing the table
structure at run-time. Use the "DECLAREd GLOBAL TEMPORARY TABLE" for
your needs. In this case also you need to drop and create the
tempTables, but I believe it will be faster, and also CREATE TABLE and
COMMIT only when you are through with defining the table structure.

Rgds
Arul Prakasam
Iflex solutions Ltd,
India.


-----Original Message-----
From: Stephane Paquette [mailto:stephane.[Email Address Removed] Wednesday, March 31, 2004 2:34 AM
To: [Email Address Removed] Managing development environments with DB2

Hi,

I'm an Oracle DBA switching to DB2 UDB (8.1.3) I want to know how
experienced DB2 DBA are managing development environments.

With Oracle 8i I can :
drop a column
increase the size of a number column
add a not null column to an empty table
decrease the size of a column (varchar2 and number)) if the
table is empty.
With Oracle 9i I can
rename a column even if it is part of an index
....

With DB2 UDB I must drop and recreate the table, I hope that's because I
do not know the product well yet.
Is there another way around or any tool that would make this work less
time consuming ?

Thanks


Stephane Paquette
Administrateur de bases de donnees
Database Administrator
Standard Life
www.standardlife.ca
Tel. (514) 499-7999 7470 stephane.[Email Address Removed] CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE Get today's cartoon:
http://www.LazyDBA.com To unsubscribe, e-mail:
db2udbdba-[Email Address Removed] For additional commands, e-mail:
db2udbdba-[Email Address Removed] message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended recipient
you should not disseminate,distribute,store,print, copy or deliver this
message.Please notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or
contain viruses.The sender therefore does not accept liability for any
errors or omissions in the contents of this message which arise as a result
of e-mail transmission. If verification is required please request a
hard-copy version.

---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: db2udbdba-[Email Address Removed] additional commands, e-mail: db2udbdba-[Email Address Removed]DB2 & UDB email list listserv db2-l LazyDBA home page