【问题标题】:days of certain month in pentaho report designerpentaho 报表设计器中某个月份的天数
【发布时间】:2019-12-31 16:45:50
【问题描述】:

我使用的是 Pentaho Report Designer 版本:7.0.0.0-25。

我想显示某个月份的所有天数。但是月份和年份是参数,即月份和年份是动态选择的。我想显示选定月份的所有日期。 请建议我在 Pentaho 报表设计器中使用 oracle 或脚本进行查询。

【问题讨论】:

    标签: oracle pentaho


    【解决方案1】:

    分层查询有帮助。

    只是设置默认日期格式;你不必这样做:

    SQL> alter session set nls_date_format = 'dd.mm.yyyy';
    
    Session altered.
    

    这就是你需要的:输入参数是

    • 月(par_month)
    • 年份(par_year)

    将月份转换为两位数(使用LPAD 函数),以便TO_DATE 的格式掩码正常工作。

    SQL> with test (start_date) as
      2    (select to_date(lpad(&par_month, 2, '0') || &par_year, 'mmyyyy')
      3     from dual
      4    )
      5  select start_date + level - 1 datum
      6  from test
      7  connect by level <= to_number(to_char(last_day(start_date), 'dd'));
    Enter value for par_month: 2
    Enter value for par_year: 2019
    old   2:   (select to_date(lpad(&par_month, 2, '0') || &par_year, 'mmyyyy')
    new   2:   (select to_date(lpad(2, 2, '0') || 2019, 'mmyyyy')
    
    DATUM
    ----------
    01.02.2019
    02.02.2019
    03.02.2019
    04.02.2019
    05.02.2019
    06.02.2019
    07.02.2019
    08.02.2019
    09.02.2019
    10.02.2019
    11.02.2019
    12.02.2019
    13.02.2019
    14.02.2019
    15.02.2019
    16.02.2019
    17.02.2019
    18.02.2019
    19.02.2019
    20.02.2019
    21.02.2019
    22.02.2019
    23.02.2019
    24.02.2019
    25.02.2019
    26.02.2019
    27.02.2019
    28.02.2019
    
    28 rows selected.
    
    SQL>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多