sql - How to use INSTR() and SUBSTR() -
i have small example, of how use instr()
, substr()
example:
string = 'test = "2"'; apostrophe1:= instr(string,'"',1,1); apostrophe2:= instr(string,'"',1,2); equal:= instr(string,'=',1,1); f_property_name:= substr(v1,1,equal-2); f_property_value:= substr(v1,(apostrophe1)+1,(apostrophe2)-2); dbms_output.put_line(f_property_name||' = '||f_property_value);
i wish have result like: test = 3
. result is: test = 3"
can explain mistake?
f_property_value:= regexp_replace(substr(v1,(apostrophe1)+1,(apostrophe2)-2),'"','');
it working this.
Comments
Post a Comment