English 中文(简体)
新旧触发代码
原标题:new and old trigger code

请解释:

<代码>:新:old instart Code.

最佳回答

<代码>:新:old为便于查阅特定栏目中新的和旧数值的假记录。 如果我有一张桌子的话,我会有一个桌子。

CREATE TABLE foo (
  foo_id NUMBER PRIMARY KEY,
  bar    VARCHAR2(10),
  baz    VARCHAR2(10)
);

页: 1

INSERT INTO foo( foo_id, bar, baz ) 
  VALUES( 1,  Bar 1 ,  Baz 1  );

之后再加插触发器

:new.foo_id will be 1
:new.bar will be  Bar 1 
:new.baz will be  Baz 1 

......

:old.foo_id will be NULL
:old.bar will be NULL
:old.baz will be NULL

如果是的话,你会更新这一行文。

UPDATE foo
   SET baz =  Baz 2 
 WHERE foo_id = 1

然后在之前更新浏览级触发器

:new.foo_id will be 1
:new.bar will be  Bar 1 
:new.baz will be  Baz 2 

......

:old.foo_id will be 1
:old.bar will be  Bar 1 
:old.baz will be  Baz 1 

如果我删除行文

DELETE FROM foo
 WHERE foo_id = 1

之后删除“增长触发器”,

:new.foo_id will be NULL
:new.bar will be NULL
:new.baz will be NULL

......

:old.foo_id will be 1
:old.bar will be  Bar 1 
:old.baz will be  Baz 2 
问题回答

In Plain English:

它们是使你能够从一栏(旧)和一栏(新)如何取用。

rel=“noreferer” 摘自Oracle文件:

旧的和新的数值在贝都因和AFTER增长触发器中都有。 新的一栏值可分配到底盘旋器中,但不能在固定电离层触发器中(因为触发信号在发射气流触发器之前生效)。 如果主角电流引发新哥伦的改变,那么同一声明发射的AFTER输电触发器就看到了BeitFORE输电机的改变。

也可在WHEN条款的“Bolean”表述中使用校正名称。 殖民地必须先于旧的和新的限定性,然后才能在触发体内使用,但在使用WHEN条款或REFERENCING方案中的限定词时,不得允许殖民地。

<代码>:old记录载有触发说明执行前的数值,:new记录载有执行后的价值。

。 价值为<代码>在改动之前和<代码>new。 数值为<代码>拟修改的数值,例如update set col1=<10/code>, 10为new。 该栏的现值和现值为旧数。

插入一个字面,有固定的旧价值,只有新值,删除的是新价值,只有旧价值。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...