Database Administration (MOSC)

MOSC Banner

update statement to update the rate column

edited Nov 25, 2015 11:13AM in Database Administration (MOSC) 5 commentsAnswered ✓

I want to write an update statement so that the rate column will be updated with the value of reso after the "-"

BEGIN

UPDATE myschema.table

SET T$RATE = SUBSTR(TRIM(T$RESO),INSTR(TRIM(T$RESO),'-',-1)+1);

exception when others then dbms_output.put_line(SQLERRM);

END;

However, when I run this, it is giving me invalid number error.

In the current reso column,

there is value like 011AA-1000 and also value like 0111P-AB-1. I believe the error out because it found the second value and after that - it is letter AB, thus invalid number. How can I modify the update statement, so that for the second value it would take the number after the second dash? Gurus, please advise. Thank you very much.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center