Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    6

    Unanswered: Need this Oracle logic converted to DB2

    Hi all,
    I have written following query in Oracle.
    Here is the code:
    Code:
    (SELECT replace(REGEXP_SUBSTR (domainList001, '[^,]+', 1, LEVEL),'''','' ) FROM DUAL CONNECT BY REGEXP_SUBSTR (domainList001, '[^,]+', 1, LEVEL) IS NOT NULL)


    Here domainList001 is a string like 'domain1,domain2,domain3,domain4'
    and the above code breaks individual elements and I get following output:
    domain1
    domain2
    domain3
    domain4
    i.e one row for each element.

    Now I have to port it to DB2 syntax.

    Any help is appreciated.


    Thanks,
    Raghvendra

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    It looks same as
    Quote Originally Posted by Raghvendra View Post
    Hi all,
    I have written following query in Oracle.
    Here is the code:
    Code:
    (SELECT replace(REGEXP_SUBSTR (domainList001, '[^,]+', 1, LEVEL),'''','' ) FROM DUAL CONNECT BY REGEXP_SUBSTR (domainList001, '[^,]+', 1, LEVEL) IS NOT NULL)


    Here domainList001 is a string like 'domain1,domain2,domain3,domain4'
    and the above code breaks individual elements and I get following output:
    domain1
    domain2
    domain3
    domain4
    i.e one row for each element.

    Now I have to port it to SQL Server.

    Any help is appreciated.


    Thanks,
    Raghvendra
    Do you want to port an Oracle sysem to DB2 and SQL Server?

  3. #3
    Join Date
    Sep 2012
    Posts
    6
    Yes I need to port to DB2 and SQL server

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I think it might be better to construct a query from scratch rather than modifying the Oracle query.
    Because, it was asked repeatedly to split a string into elements by a delimitter.

    Search this forum by "split string" or "tokenizer".
    For example, see http://www.dbforums.com/db2/1677358-...sible-sql.html

Posting Permissions

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