DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 11

Thread: query help

Threaded View

  1. #2
    Join Date
    Apr 2006
    Posts
    377
    Code:
    SQL> select * from hosts;
    
    HOSTID
    -----------------------------------------------------------------------------
    host1:12.134.23.45,host2:34.56.76.102
    
    SQL> with t as (
      2       select ltrim(regexp_substr(hostid, '[^,]+', 1, level), ',') str
      3       from hosts
      4       connect by level <= length(hostid)-length(replace(hostid,':')))
      5    select regexp_substr(str, '[^:]+') hostname
      6         , regexp_substr(str, '[^:]+$') ip
      7  from t;
    
    HOSTNAME   IP
    ---------- -------------------
    host1      12.134.23.45
    host2      34.56.76.102
    Last edited by ebrian; 06-12-2010 at 07:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width