0

SQL Console screenshot

select trunc((:FromDate)+1)-rn as date_Val
  from ( select rownum rn 
           from dual
        connect by level <= ((:FromDate)-(:todate))+1)
 order by trunc(:FromDate)-rn 

I want to join this column with other tables. When I write in Sub Query return more than one row error show

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55

1 Answers1

1

Turn it into a cte and write the rest of your query under it:

with dateseq as
(
      select trunc((:FromDate)+1)-rownum as date_val
      from dual 
      connect by level <= ((:FromDate)-(:todate))+1)
)

select * from dateseq inner join ...

ps: simplified your query a bit- you don't need the subquery

Caius Jard
  • 72,509
  • 5
  • 49
  • 80