Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2015
    Posts
    2

    Unanswered: Query conversion from Oracle

    I have one oracle query and i want to have the same functionality in DB2 version 10.5.5.
    The query is
    select * from (
    SELECT trunc(sysdate+LEVEL-1) w_date
    FROM dual
    where to_char((sysdate+LEVEL-1),'DY') not in ('SAT','SUN')
    CONNECT BY LEVEL <= 2100)


    The problem is DB2 is not allowing to have arithmatic operation with dates.

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Code:
    with t(level) as (
    values 1
      union all
    select level+1
    from t
    where level<2100
    )
    select current date + (level - 1) days
    from t
    where dayofweek_iso(current date + (level - 1) days) not in (6, 7)
    Regards,
    Mark.

Posting Permissions

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