Datagrip:带参数在oracle中执行sql条语句
Datagrip: execute sql statements in oracle with a parameter
我经常在 datagrip 中使用 Ctrl
- Shift
- F10
执行此语句。
有什么方法可以创建包含变量的 SQL 或 pl/SQL 语句集,并使用 DataGrip 执行文件。
Datagrip 的变量处理不是很好 - 或者我遗漏了一些东西。
// somehow set $(jobName?) to a value in the file and re-use it.
update t_msg_log l
set l.job_status = 'FinishedSuccess'
where l.source_detail = $(jobName?)
and created =
(select max(created) from t_msg_log li where li.source_detail = l.source_detail);
这叫做用户参数。默认情况下,DataGrip 中未描述您使用的参数模式。你需要自己做。
- 转到Settings/Preferences |数据库 |用户参数
- 使用此正则表达式添加新参数:
$\([^\)\?]+\?\)
- 不要忘记检查 'Enable in console'、'In scripts'。
- 尽情享受吧!
我经常在 datagrip 中使用 Ctrl
- Shift
- F10
执行此语句。
有什么方法可以创建包含变量的 SQL 或 pl/SQL 语句集,并使用 DataGrip 执行文件。
Datagrip 的变量处理不是很好 - 或者我遗漏了一些东西。
// somehow set $(jobName?) to a value in the file and re-use it.
update t_msg_log l
set l.job_status = 'FinishedSuccess'
where l.source_detail = $(jobName?)
and created =
(select max(created) from t_msg_log li where li.source_detail = l.source_detail);
这叫做用户参数。默认情况下,DataGrip 中未描述您使用的参数模式。你需要自己做。
- 转到Settings/Preferences |数据库 |用户参数
- 使用此正则表达式添加新参数:
$\([^\)\?]+\?\)
- 不要忘记检查 'Enable in console'、'In scripts'。
- 尽情享受吧!