update statement to update the rate column
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.