Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As documented under <a href="http://dev.mysql.com/doc/en/data-type-defaults.html" rel="nofollow noreferrer">Data Type Default Values</a>:</p> <blockquote> <p>The <code>DEFAULT <strong><em>value</em></strong></code> clause in a data type specification indicates a default value for a column. With one exception, the default value must be a constant; it cannot be a function or an expression. This means, for example, that you cannot set the default for a date column to be the value of a function such as <a href="http://dev.mysql.com/doc/en/date-and-time-functions.html#function_now" rel="nofollow noreferrer"><code>NOW()</code></a> or <a href="http://dev.mysql.com/doc/en/date-and-time-functions.html#function_current-date" rel="nofollow noreferrer"><code>CURRENT_DATE</code></a>. The exception is that you can specify <a href="http://dev.mysql.com/doc/en/date-and-time-functions.html#function_current-timestamp" rel="nofollow noreferrer"><code>CURRENT_TIMESTAMP</code></a> as the default for a <a href="http://dev.mysql.com/doc/en/datetime.html" rel="nofollow noreferrer"><code>TIMESTAMP</code></a> column. See <a href="http://dev.mysql.com/doc/en/timestamp-initialization.html" rel="nofollow noreferrer">Section 11.3.5, “Automatic Initialization and Updating for <code>TIMESTAMP</code>”</a>.</p> </blockquote> <p>Instead, you can define an insertion trigger:</p> <pre><code>CREATE TRIGGER foo BEFORE INSERT ON TSM_TRANSACTION_TBL FOR EACH ROW IF NEW.REMAINING IS NULL THEN SET NEW.REMAINING := NEW.MAX_VALUE - NEW.BOOKED_UNITS; END IF;; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload