Oracle: remove first 4 characters from string

So, I want to remove the first 4 characters from a string in oracle. These characters can be different every time. In my case, I need to pick up the first 4 characters of IBAN and put them at the end of the line. I got part of their completion to the end of the line, but I cannot delete the first 4 characters. Each solution I found on the Internet removes the specified characters, not characters from a specific position in the string (1 to 4). I used the code below to get the first 4 characters at the end of the line and wanted to try something similar to remove them from the front, but without success.

SELECT SUBSTR(iban_nummer, 1, 4) INTO iban_substring FROM dual; iban_nummer := iban_nummer || iban_substring; 
+6
source share
3 answers

See the docs :

substring_length ... If you do not specify a value for this argument, the function will return all characters to the end of the string. When you specify a value less than 1, the function returns NA.

So iban_nummer := substr(iban_nummer, 5) || substr(iban_nummer, 1,4) iban_nummer := substr(iban_nummer, 5) || substr(iban_nummer, 1,4) should work. The first part selects all characters starting from the 5th, second character number 1..4.

+10
source
 update table_name set col_name=substr(col_name,5); 
+5
source

try regexp for example:

 SELECT regexp_replace(t.iban_nummer,'(.{4})(.*)','\2\1') FROM t; 
+1
source

All Articles