By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,236 Members | 1,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,236 IT Pros & Developers. It's quick & easy.

DB2 Length Script

P: n/a
BP
I'm writting a script that needs to deterimine the length of a char
value...its easy enough to put length ('my data value') which
evalulates to 13, but when I concatonate it, it says...

SQL0440N No authorized routine named "||" of "FUNCTION" having
compatible arguments was found....
How can I get this to work?
select (space (1) || repeat('0',7) || length ('Some Data String'))

Aug 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
|| and its twin CONCATENATE expect a string argument. Just wrap, e.g.,
CHAR around your call to LENGTH (i.e., CHAR(LENGTH('Some Data
String'))) and you should be good-to-go.

--Jeff

BP wrote:
I'm writting a script that needs to deterimine the length of a char
value...its easy enough to put length ('my data value') which
evalulates to 13, but when I concatonate it, it says...

SQL0440N No authorized routine named "||" of "FUNCTION" having
compatible arguments was found....
How can I get this to work?
select (space (1) || repeat('0',7) || length ('Some Data String'))
Aug 30 '06 #2

P: n/a
Note also that when using CHAR, some RTRIMing may be in order, e.g.,

VALUES RTRIM(CHAR(LENGTH('SOME DATA STRING')))||' HELLO, WORLD'

1
------------------------
16 HELLO, WORLD

vs.

VALUES CHAR(LENGTH('SOME DATA STRING'))||'HELLO, WORLD'

1
-----------------------
16 HELLO, WORLD

HTH,

--Jeff
jefftyzzer wrote:
|| and its twin CONCATENATE expect a string argument. Just wrap, e.g.,
CHAR around your call to LENGTH (i.e., CHAR(LENGTH('Some Data
String'))) and you should be good-to-go.

--Jeff

BP wrote:
I'm writting a script that needs to deterimine the length of a char
value...its easy enough to put length ('my data value') which
evalulates to 13, but when I concatonate it, it says...

SQL0440N No authorized routine named "||" of "FUNCTION" having
compatible arguments was found....
How can I get this to work?
select (space (1) || repeat('0',7) || length ('Some Data String'))
Aug 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.