plsql - Parsing string in PL/SQL and insert values into database with RESTful web service -


i reading values want insert database. reading them lines. 1 line this:

string line = "6, ljubljana, slovenija, 28"; 

web service needs separate values comma , insert them database. in pl/sql language. how do that?

here pl/sql have used parse through delimited strings , extract individual words. may have mess bit when using web service works fine when running right in oracle.

declare   string_line varchar2(4000);   str_cnt number;   parse_pos_1 number := 1;   parse_pos_2 number;   parsed_string varchar2(4000); begin   --counting number of commas in string know how many times loop   select regexp_count(string_line, ',') str_cnt dual;    in 1..str_cnt + 1   loop       --grabbing position of comma       select regexp_instr(string_line, ',', parse_pos_1) parse_pos_2 dual;        --grabbing individual words based of comma positions using substr function       --handling last loop       if = str_cnt + 1         select substr(string_line, parse_pos_1, length(string_line)+1 - parse_pos_1) parsed_string dual;          execute immediate 'insert your_table_name (your_column_name) values (' || parsed_string || ' )';         execute immediate 'commit';       --handles rest       else         select substr(string_line, parse_pos_1, parse_pos2 - parse_pos_1) parsed_string dual;         execute immediate 'insert your_table_name (your_column_name) values (' || parsed_string || ' )';         execute immediate 'commit';       end if;        parse_pos_1 := parse_pos_2+1;     end loop; end; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -