- 背景:日常工作中使用 DataGrip,有时需要将查的列值作为下一张表的 in 查询条件,借助下面的脚本可以提供效率
1、借助 sdkman 安装 Groovy SDK
2、将 Groovy SDK 添加至 IntelliJ IDEA (参考链接:Add Groovy SDK to IntelliJ IDEA)
3、在 IntelliJ IDEA 中编写 Groovy(参考链接:官方示例)
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
* DataRow