开发者

pl/sql string ouestion

开发者 https://www.devze.com 2023-01-05 09:50 出处:网络
Q.accrept any string having any no.of comma in the string and display all the words seperated by commas in seperate lin开发者_如何转开发es?

Q.accrept any string having any no.of comma in the string and display all the words seperated by commas in seperate lin开发者_如何转开发es?

example: delhi,mumbai,pune,puri

i want output like this

outpt: delhi mumbai pune puri


from here

DECLARE
  lv_Str_List       VARCHAR2(1000) := 'delhi,mumbai,pune,puri';
  lb_cnt             BINARY_INTEGER;
  la_Tab_Str       DBMS_UTILITY.UNCL_ARRAY;
BEGIN
  -- parse the string into comma separated table
  DBMS_UTILITY.COMMA_TO_TABLE(lv_Str_List, lb_cnt, la_Tab_Str);
  FOR i IN 1 .. la_Tab_Str.COUNT LOOP
    -- display substring
    DBMS_OUTPUT.PUT_LINE(TRIM(la_Tab_Str(i)));
  END LOOP;
END;
/
0

精彩评论

暂无评论...
验证码 换一张
取 消