怎么用sql语句将字段内容拆分后统计

如何用sql语句将字段内容拆分后统计
oracle数据库,一个字段book_name,内容如下
id                             book_name
1                              雷雨,安徒生童话,家
2                              家
3                              春;
4                               家;春;秋;

由于系统升级修改过,所以这个字段内容的分割有逗号和分号两种,逗号分隔的末尾无符号,分号分隔的末尾有分号。
怎样将这个字段的内容拆分成单个书名,并且统计各书名的出现次数。
------解决方案--------------------
引用:
有高手在SQL SERVER数据库编出了代码,oracle怎么用?
--创建函数
create   function   [dbo].[f_splitstr](@SourceSql   Nvarchar(MAX),@StrSeprate   Nvarchar(100))   
  returns   @temp   table(F1  Nvarchar(100))   
  as     
  begin   
  declare   @ch   as  Nvarchar(100)   
  set   @SourceSql=@SourceSql+@StrSeprate     
  while(@SourceSql<>'')   
                  begin   
                  set   @ch=left(@SourceSql,charindex(@StrSeprate,@SourceSql,1)-1)   
  insert   @temp   values(@ch)   
  set   @SourceSql=stuff(@SourceSql,1,charindex(@StrSeprate,@SourceSql,1),'')   
                  end   
  return   
  end  
GO

--执行查询
SELECT * FROM test AS t CROSS APPLY dbo.f_splitstr(replace(t.book_name , ',' , ';') , ';') AS fs WHERE FS.F1 <> ''

/*执行结果
 id          book_name            F1
----------- -------------------- ----------------------------------------------------------------------------------------------------
1           雷雨,安徒生童话,家           雷雨
1           雷雨,安徒生童话,家           安徒生童话
1           雷雨,安徒生童话,家           家
2           家                    家
3           春;                   春
4           家;春;秋;               家
4           家;春;秋;               春
4           家;春;秋;               秋

(8 行受影响)
 */



with t as
 (select 1 id, 'leiyu,tonghua,jia' book_nm
    from dual
  union all
  select 2 id, 'jia' book_nm
    from dual
  union all
  select 3 id, 'chun;' book_nm
    from dual
  union all
  select 4 id, 'jia;chun;qiu' book_nm
    from dual)
select *
  from (select id, REGEXP_SUBSTR(book_nm, '[^,]+', 1, LEVEL) STR
          from (select id, replace(book_nm, ';', ',') book_nm from t) t1
        connect by level <= REGEXP_COUNT(book_nm, ',') + 1
               and id = prior id
               and prior dbms_random.value is not null) t2