繁体   English   中英

pentaho报表设计器中某个月的天数

[英]days of certain month in pentaho report designer

我正在使用 Pentaho Report Designer 版本:7.0.0.0-25。

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

分层查询有帮助。

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

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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM