× 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.



REPEAT is documented as a Scalar Function.
>>-REPEAT--(--expression--,--integer--)----------><
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/db2/rbafzmstscale.htm

I did not see anything like the described LPAD for an available SQL scalar in the DB2 for i5/OS.

Note that if the given expression is meant to match the ORACLE function, and especially if moved into a UDF, then be sure to use the MIN scalar to avoid errors; i.e. positive integer or zero, is required for REPEAT(). In any case, consider casting the result of the given expression to the desired & expected type/length attributes. The given expression is likely to produce a VARCHAR of a large length.

The given expression uses CHAR() which may be unnecessary.? Perhaps if the "location ID" is numeric, such that the char() might then be perceived as necessary, then try instead, a simpler left-pad with zeros:
DIGITS(CAST(Location_ID as DECIMAL(9, 0)) AS Location_ID

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.