× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Either CAST(LEFT(C15, 12) AS CHAR(12)) or use SUBSTR(C15, 1, 12) will effect a CHAR(12) result versus the VARCHAR(15) as seen [correctly, according to the LEFT scalar documentation].

http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/index.jsp?topic=/db2/rbafzmstscale.htm

>>-LEFT--(--expression--,-- /integer/ --)--------------------------><

The LEFT function returns the leftmost integer characters of /expression/. <<SNIP>> The result of the function is a _varying-length_ string _with a length_ attribute that is the _same as_ the length attribute of _expression_ and a data type that depends on the data type of expression:

Data type of expression Data type of the Result
CHAR or VARCHAR VARCHAR
<<SNIP>>

The actual length of the result is /integer/
<<SNIP>>
The CCSID of the result is the same as that of expression.

create table qtemp.c15 (c15 char (15) default '123456789012345')
insert into qtemp.c15 values(default)
select c15,length(char(left(c15, 12))) from qtemp.c15

....+....1....+....2....+....3.
C15 LENGTH
123456789012345 15

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.