Not updating correctly

Database
Enthusiast

Not updating correctly

Hi ,

I have field "child_cd" of VARCHAR(5).

It has values like W14,W15 etc. I wanted to increase the count by 1..i.e wanted to make it W15,W16 etc.
But then I noticed that the update qry didn't work correctly. What I got as result was..W1,W1..etc.

The query I used :

UPDATE table_1
SET child_cd='W'||trim(CAST(SUBSTRING(child_cd FROM 2) AS INTEGER)+1)

Anything wrong here?
1 REPLY
Senior Apprentice

Re: Not updating correctly

Nothing wrong, this should work as expected.

Did you double check everything?

Can you provide a script (+ output) reproducing this result?
Then you should open an incident.

Dieter