ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Dynamically enable/disable commitment control on SQL statements at runtime?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamically enable/disable commitment control on SQL statements at runtime?

    I know I can set the default commit option for a program at compile time with "exec sql set option = ???;" or with the appropriate compile command option.

    I know that an individual embedded SQL statement can have its own commit setting by ending it with "with xx;" (e.g. "with CS;")

    Is there a way to programatically condition the commitment option, so that the same embedded SQL statement can run with commitment option *NONE or *CS depending on the value of some variable at runtime?

    The only way I can think of to do this is to duplicate the SQL statement (one with *NONE, the other other with *CS) and run one or the other - but I would really prefer if it could be one statement.

  • #2
    Declare and Prepare.

    Walt

    Comment


    • #3
      I was hoping there would be a way that lets the statement stay embedded, as opposed to having to put it in a string

      Comment


      • #4
        Have you had a look at the SET TRANSACTION Statement?
        SET TRANSACTION Statement:
        https://www.ibm.com/support/knowledg...afzsettraj.htm
        Last edited by B.Hauser; August 17, 2018, 12:16 AM.

        Comment


        • #5
          I haven't but I will, thanks.

          Comment

          Working...
          X