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

Lpad Equivalent Of Oracle In Db2

P: 3
this is an oracle query SUBSTR(LPAD(xxxxx, 8, 0),3,6)

Please provide me the db2 query for this....
Mar 14 '07 #1
Share this Question
Share on Google+
2 Replies


frozenmist
Expert 100+
P: 179
this is an oracle query SUBSTR(LPAD(xxxxx, 8, 0),3,6)

Please provide me the db2 query for this....
REPEAT('0',6-LENGTH(RTRIM(CAST(xxxxx AS CHAR(6)))))||RTRIM(CAST(xxxxx AS CHAR(6)))
Aug 3 '07 #2

frozenmist
Expert 100+
P: 179
You can also try this

right('000000'||rtrim(cast(<number> as char(6))),6)

This looks good right....

Cheers,
Rahul
Aug 3 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.