CREATE OR REPLACE Trigger trig_solr_index_el_lesson
After Update of lessonid, lessonname, lessongoal, note, teachername, teacherid, classidname, classid, crtime, status Or Delete or insert On el_lesson
For Each Row
declare
-- local variables here
new_status number;
begin
new_status := :NEW.status;
if inserting then
begin
INSERT INTO solr_index
(id, docid, type)
VALUES
(solr_index_seq.NEXTVAL, :NEW.lessonid, 'add');
end;
end if; if updating then
--对比老的状态和新的状态
if new_status = -1 and :OLD.status != -1 then INSERT INTO solr_index
(id, docid, type)
VALUES
(solr_index_seq.NEXTVAL, :OLD.lessonid, 'delete'); else
INSERT INTO solr_index
(id, docid, type)
VALUES
(solr_index_seq.NEXTVAL, :OLD.lessonid, 'update'); end if;
end if; if deleting then
begin
INSERT INTO solr_index
(id, docid, type)
VALUES
(solr_index_seq.NEXTVAL, :OLD.lessonid, 'delete');
end;
end if;
end;

oracle触发器--if else demo的更多相关文章

  1. oracle触发器应用

    首先给大家推荐两篇我看后的博文,我已经内容转载过来: 1.对触发器的讲解 本篇主要内容如下: 8.1 触发器类型 8.1.1 DML触发器 8.1.2 替代触发器 8.1.3 系统触发器 8.2 创建 ...

  2. Oracle 触发器(二)

    Oracle触发器详解   触发器是许多关系数据库系统都提供的一项技术.在oracle系统里,触发器类似过程和函数,都有声明,执行和异常处理过程的PL/SQL块. 8.1 触发器类型 触发器在数据库里 ...

  3. 问题:Oracle出发器;结果:1、Oracle触发器详解,2、Oracle触发器示例

    ORACLE触发器详解 本篇主要内容如下: 8.1 触发器类型 8.1.1 DML触发器 8.1.2 替代触发器 8.1.3 系统触发器 8.2 创建触发器 8.2.1 触发器触发次序 8.2.2 创 ...

  4. 【database】oracle触发器基础

    一.oracle触发器基本语法 CREATE [OR REPLACE] TRIGGER trigger_name {BEFORE | AFTER } {INSERT | DELETE | UPDATE ...

  5. 2014/11/06 Oracle触发器初步 2014-11-06 09:03 49人阅读 评论(0) 收藏

    触发器我就不多解释了,保证数据的完整性的神器,嗯..也是减少程序员工作托管给数据库操作的好帮手.就不讲一些大道理了.通俗点,我们对数据库的操作,无非就是增 删 改 查. 触发器就是在删,改,增的时候( ...

  6. oracle触发器加条件判断

    oracle触发器加条件判断,如果某个字段,isnode=0,那么不执行下面的方法,数据如下: create or replace trigger tr_basestation_insert_emp ...

  7. [转]连续创建多个Oracle触发器失败,单个创建才成功的解决方法

    连续创建多个Oracle触发器失败,单个创建才成功的解决方法   1.当我连续执行创建多个触发器时,总是报编译通过,但存在警告或错误.如下:   create or replace trigger t ...

  8. Oracle 触发器在日志管理开发中的应用

    摘要: 本文讨论了利用数据库中的触发器对日志管理进行设计与实现的方法, 是对原来在客户端软件中编写日志管理方法的一种改进, 并给出了 Oracle9i 中的实例演示.关键词: Oracle; 触发器; ...

  9. Mybatis 插入操作时获取主键 (Oracle 触发器与SEQ)

    1.通过Oracle序列 -- Create sequence create sequence SEQ_DW_EWSYSTEM minvalue 1 maxvalue 9999999999999999 ...

随机推荐

  1. nginx默认的配置文件详解

    # For more information on configuration, see:# * Official English Documentation: http://nginx.org/en ...

  2. ZetCode PyQt4 tutorial widgets I

    #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, ...

  3. test20181024 kun

    题意 分析 考场做法 任意状态只有两种决策,进栈或出栈. 由于元素互不相同,所以选择的关键在于栈顶元素是否在它和带插入元素组成的集合中是最大的. 用stack和set维护.时间复杂度\(O(n \lo ...

  4. Oracle数据库导入导出(备份还原)

    一.数据库的导出 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中(全库导出) exp system/manager@TEST file=d:\ ...

  5. phpstorm 光标设置

    1.是否允许光标定位在行尾之后的任意位置Allow placement of caret after end of line 这个设置是上下换行的时候,光标可以定位在任意位置,只能通过方向键移动光标, ...

  6. angularJS的ng-repeat-start

    使用angularJS的同学对ng-repeat都不会陌生,他是用来进行数据循环的,一般用于数组或者对象.但是今天我们用到了一个ng-repeat-start. ng-repeat-start,与ng ...

  7. 使用正则表达式去除html标签

    不知道大家遇到这话总情况没有,从数据库读取数据,数据参杂着html标记<p>等,在显式的时候控制字符个数,这个时候就会出现页面样式串行,使用正则表达式去除html标记就不会有还这个问题. ...

  8. T4模板批量生成代码文件

    <#@ template debug="false" hostspecific="true" language="C#" #> ...

  9. bzoj4891: [Tjoi2017]龙舟

    求$\frac{b_1b_2b_3...b_m}{a_1a_2a_3...a_m}\%M$ M<=1e18,m<=100000,数据组数<=50 用pollard-rho分解M的质因 ...

  10. 教你判断一个APP页面是原生的还是H5页面 。(还没看)

    来源:https://www.25xt.com/appdesign/11851.html 刚好是周末,无意之间学堂君在收集相关资料的时候,发现有部分童鞋在问<如何判断一个APP页面是不是H5页面 ...