Hello, I have to change codes in my Oracle database: I have to extract the codes beginning with 02 and having a length of 4 and 6 characters of the 59,350 community. Once extracted I must replace 02 of the top 3 by letters LVB. The problem with this request and if for example a 4 digit code is '0202'; the request will turn into 'LVBLVB' but I want it as 'LVB02'.
The query works for codes 02XX or type 02XXXX, X is different from '02 'and between 2 or 4 characters.
SELECT REPLACE (or.CODE, '02', 'LVB')
FROM ORGANIZATION or
WHERE or.COL = '59350'
AND SubStr(or.CODE, 1, 2) = '02'
AND (or.LGCODE = '4' OR or.LGCODE = '6')
I tried in the first row to SELECT REPLACE (or.CODE, '02%', 'LVB') the percentage here is not caught in the LIKE expression. So I am stuck.
Bookmarks