【问题标题】:Datagrip: execute sql statements in oracle with a parameterDatagrip:带参数在oracle中执行sql语句
【发布时间】:2019-03-06 09:24:18
【问题描述】:

我经常在 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


    【解决方案1】:

    这称为用户参数。默认情况下,您使用的参数模式未在 DataGrip 中描述。你需要自己做。

    1. 转到设置/首选项|数据库 |用户参数
    2. 使用此正则表达式添加新参数:\$\([^\)\?]+\?\)
    3. 不要忘记选中“在控制台中启用”、“在脚本中”。
    4. 享受吧!

    【讨论】:

    • 我接受这个答案,因为 get 有点接近。我希望有更像 SQL Server (SSMS) CMD 模式的东西。
    • 作为参考 - 另请参阅 DataGrip 文档中的 UserParameters 文档。 jetbrains.com/help/datagrip/2018.2/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-27
    • 1970-01-01
    相关资源
    最近更新 更多