View previous topic :: View next topic
|
Author |
Message |
vverma9
New User
Joined: 20 Jun 2007 Posts: 2 Location: noida
|
|
|
|
Hi,
Define host variables for VARCHAR cols in DB2 as fallows:
01 varchar.
49 len pic 9(4) comp.
49 data pic x(200).
My Question's are:
1) Can I define the length variable other than 'COMP' picture clause mentioned above in Sql DB2?
2) What happened If I have not given the length parameter in the Varchar definition?? What abend code it will send?? Should it will take the default length??
vverma9,Mumbai |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1) no
2) won't work.
don't know,don't care.
no |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
I have seen few working codes handling varchar without the length variable. This would work only for selects. I had to modify one such program and I followed the variable definitions. The update and inserts were not appropriate without the length variable. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you can not reference the 49 levels in sql, you must reference the group item.
and as Bharath Bhat said,
with select, db2 sets the length-variable.
UPDATE, INSERT you have to set the host variable to an appropriate value
before invoking the SQL |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
On an update or insert DB2 will use the first 2 bytes as the length! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
dbz wrote: |
you can not reference the 49 levels in sql, you must reference the group item |
|
|
Back to top |
|
|
|