小编mil*_*s55的帖子

将字符串日期转换为java.sql.Date

是否有可能将string"20110210"转换为java.sql.Date2011-02-10?

我试过了SimpleDateFormat,我得到了java.text.ParseException: Unparseable date: "20110210"

我究竟做错了什么?

我有新的SimpleDateFormat("yyyy-MM-dd")而不是新的SimpleDateFormat("yyyyMMdd")

java sql

28
推荐指数
1
解决办法
14万
查看次数

Oracle 数据库中存储的未知长度文本字段的数据类型

长度未知的文本字段的首选数据类型是什么?文本字段可以很小也可以很大。例如,我正在收集论坛评论,并且不知道特定评论(字段)的长度。首选什么数据类型?

database oracle

4
推荐指数
1
解决办法
3162
查看次数

最佳实践:Oracle SQL连接

以下哪个例子是内连接的最佳实践?以下示例非常简单,但如果涉及多个表,该怎么办?你会选择哪种方法?

示例查询:

简单

SELECT suppliers.supplier_id, suppliers.supplier_name, orders.order_date
FROM suppliers, orders
WHERE suppliers.supplier_id = orders.supplier_id;
Run Code Online (Sandbox Code Playgroud)

使用关键字INNER JOIN

SELECT suppliers.supplier_id, suppliers.supplier_name, orders.order_date
FROM suppliers
INNER JOIN orders
ON suppliers.supplier_id = orders.supplier_id;
Run Code Online (Sandbox Code Playgroud)

sql oracle

3
推荐指数
1
解决办法
4588
查看次数

Apache POI 3.9 条件格式(字符串值)

我在 servlet 中设置了以下代码,以根据字符串值格式化列,但是在尝试编译时出现错误(org.apache.poi.ss.formula.FormulaParseException:指定的命名范围“绿色”不存在于当前工作簿中。)。我应该如何测试字符串值?

SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

    // Condition 1: Cell Value is equal to green (Green Fill)
    ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "green");
    PatternFormatting fill1 = rule1.createPatternFormatting();
    fill1.setFillBackgroundColor(IndexedColors.GREEN.index);
    fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);

    // Condition 2: Cell Value Is  equal to yellow   (Yellow Fill)
    ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "yellow");
    PatternFormatting fill2 = rule2.createPatternFormatting();
    fill2.setFillBackgroundColor(IndexedColors.YELLOW.index);
    fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);


    CellRangeAddress[] regions = {
            CellRangeAddress.valueOf("B1:B44")
    };

    sheetCF.addConditionalFormatting(regions, rule1, rule2);
Run Code Online (Sandbox Code Playgroud)

conditional-formatting apache-poi

2
推荐指数
1
解决办法
3743
查看次数

oracle sql left join and count,sum,group by

我想计算限制在给定资助者和会计年度的每个问题的项目数量,金额和百分比.出于某种原因,当我运行下面的查询时,我没有看到左连接的空值.

项目和问题之间的关系是一个问题可以有很多项目.问题表由目标表链接.

更新

select 
   q.sp_question_id,
   count(p.project_id) as projectCount,
   sum(p.funding) as amount,
   round(sum(p.funding)/sum(sum(p.funding)) over() *100) as percentTotal 
from questions q 
   left join projects p on p.fiscal_year = q.fiscal_year  
   join objectives o on o.sp_objective_id = p.sp_objective_id 
     and o.sp_question_id = q.sp_question_id 
     and o.fiscal_year = p.fiscal_year 
     and o.fiscal_year = 2014  
   join funders f on p.funder_id = f.funder_id 
where f.funder_short_name ='foo' 
   and q.fiscal_year = 2014  
group by q.sp_question_id 
order by q.sp_question_id;
Run Code Online (Sandbox Code Playgroud)
 questionId   projectCount  amount          percentTotal
 q1           14            54510           4
 q2           29            1083598.72      76
 q3           1 …
Run Code Online (Sandbox Code Playgroud)

sql oracle left-join

1
推荐指数
1
解决办法
8868
查看次数