SUMSEN

Oracle&Sql爱好者,用友NC管理员

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

随笔分类 -  ORACLE

上一页 1 2 3 4 5 6 下一页

TRIGGER
摘要:引用一、显式cursor 显式是相对与隐式cursor而言的,就是有一个明确的声明的cursor。显式游标的声明类似如下(详细的语法参加plsql ref doc ): cursor cursor_name (parameter list) is select ... 游标从declare、open、fetch、close是一个完整的生命旅程。当然了一个这样的游标是可以被多次open进行使用的,显式cursor是静态cursor,她的作用域是全局的,但也必须明白,静态cursor也只有pl/sql代码才可以使用她。下面看一个简单的静态显式cursor的示例:declare cursor ge. 阅读全文
posted @ 2012-09-03 16:39 sumsen 阅读(510) 评论(0) 推荐(0)

摘要:写出自己的函数,输入公司编码得到公司名称。command窗口:create or replace function get_corp(corpcode varchar2) return varchar2asv_name bd_corp.unitname%type;begin select unitname into v_name from bd_corp where unitcode=corpcode; return v_name; end;执行的时候可以直接调用9.3 15:27更新 例外create or replace function get_corp(corpcode varc... 阅读全文
posted @ 2012-09-03 15:13 sumsen 阅读(313) 评论(0) 推荐(0)

摘要:课程内容: 一、SQL 1、.使用SQLSELECT语句检索数据 2、对数据进行限制和排序 3、使用单行函数自定义输出 4、使用转换函数和条件表达式 5、使用组函数报告汇总数据 6、显示多个表中的数据 7、使用子查询来解析查询 8、使用SET运算符 9、处理数据 10、使用DDL语句创建和管理表 11、创建其他Schema对象 12、管理方案对象 13、使用高级子查询搜索数据 二、OracleDatabase11g管理I 1、Oracle数据库体系结构 2、安装Oracle软件 3、创建... 阅读全文
posted @ 2012-08-29 10:07 sumsen 阅读(440) 评论(0) 推荐(0)

摘要:NC群小米需求:select name from bd_corp where name='ab' 显示结果为“ab”,需求是name='ab'条件下显示为“cd”我的sql是select substr(name||'cd',-2,2 )name from bd_corp where name='ab'怎解感觉都很麻烦,请大家讨论一下,是不是有更好的办法itpub dingjun123直接写'cd'select 'cd'name frombd_corp where name='ab'小 阅读全文
posted @ 2012-08-27 14:31 sumsen 阅读(12056) 评论(0) 推荐(0)

摘要:原文地址:PRAGMAAUTONOMOUS_TRANSACTION作者:于士博的视频教程数据库事务是一种单元操作,要么是全部操作都成功,要么全部失败。在Oracle中,一个事务是从执行第一个数据管理语言(DML)语句开始,直到执行一个COMMIT语句,提交保存这个事务,或者执行一个ROLLBACK语句,放弃此次操作结束。事务的“要么全部完成,要么什么都没完成”的本性会使将错误信息记入数据库表中变得很困难,因为当事务失败重新运行时,用来编写日志条目的INSERT语句还未完成。针对这种困境,Oracle提 供了一种便捷的方法,即自治事务。自治事务从当前事务开始,在其自身的语境中执行。它们能独立地被 阅读全文
posted @ 2012-08-20 11:49 sumsen 阅读(459) 评论(0) 推荐(0)

摘要:使用正规表达式编写更好的 SQL作者:Alice RischertOracle Database 10g中的正规表达式特性是一个用于处理文本数据的强大工具Oracle Database 10g的一个新特性大大提高了您搜索和处理字符数据的能力。这个特性就是正规表达式,是一种用来描述文本模式的表示方法。很久以来它已在许多编程语言和大量 UNIX 实用工具中出现过了。Oracle 的正规表达式的实施是以各种 SQL 函数和一个WHERE子句操作符的形式出现的。如果您不熟悉正规表达式,那么这篇文章可以让您了解一下这种新的极其强大然而表面上有点神秘的功能。已经对正规表达式很熟悉的读者可以了解如何在 Or 阅读全文
posted @ 2012-08-01 14:53 sumsen 阅读(12318) 评论(0) 推荐(1)

摘要:SQL> show parameter open_cursors --每个session(会话)最多能同时打开多少个cursor(游标) NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ open_cursors integer 300 SQL> show parameter session... 阅读全文
posted @ 2012-07-19 14:28 sumsen 阅读(13478) 评论(0) 推荐(0)

摘要:create or replace trigger ADDCSUTSAME before insert on bd_cubasdoc for each rowdeclare -- local variables here pk_bas varchar2(200); cursor basjob(id varchar2)is select custname from bd_cubasdoc where custname=id and nvl(dr,0)=0 and custname in (select custname from bd_cubasdoc) /*and len... 阅读全文
posted @ 2012-07-09 17:24 sumsen 阅读(303) 评论(0) 推荐(0)

摘要:create or replace trigger S_UPDATE_CUSTBANK before update on bd_custbank for each rowdeclare -- local variables here pk_bas char(20); cursor basjob(id char) is select pk_custbank from ncv5.bd_custbank /*目标数据库表*/ where pk_custbank = id and nvl(dr, 0) = 0;begin /*判断数据是否在目标数... 阅读全文
posted @ 2012-07-09 10:57 sumsen 阅读(537) 评论(0) 推荐(0)

摘要:最初的思路是在or后面直接增加付过款的pk,如下create or replace trigger CSpcace_ACCBANKbefore insert or update on bd_accbankfor each rowdeclare-- local variables herebegin if regexp_like(:new.bankacc,'[[:space:]]') or regexp_like(:new.combineaccnum,'[[:space:]]') or regexp_like(:new.unitname,'[[:space 阅读全文
posted @ 2012-07-05 14:29 sumsen 阅读(353) 评论(0) 推荐(0)

摘要:http://blog.sina.com.cn/s/blog_676015470100ntvw.htmlconnect by prior 是结构化查询中用到的,其基本语法是:select ... from tablename start with 条件1connect by prior 条件2where 条件3;例:select * from tablestart with org_id = 'AAA'connect by prior org_id = parent_id;简单说来是将一个树状结构存储在一张表里,比如一个表中存在两个字段:org_id,parent_id那么通过 阅读全文
posted @ 2012-06-26 22:11 sumsen 阅读(673) 评论(0) 推荐(0)

摘要:转http://moonsoft.bokee.com/4242018.htmlPL/SQL 中的select ..into.. 以及 游标(Cursor) Select empno, ename from emp;返回的是多于一条数据, 这个是肯定的.但是我们声明两个变量来依次获得每条数据的话, 我们只能获得一条记录,因为他们不是数组.这种不匹配的现象在电子线路中类似于阻抗不匹配.如果只是检索一条数据,那么我们可以用declare var_empno number(10); var_ename varchar2(32);begin select empno , ename into var_e 阅读全文
posted @ 2012-06-19 14:23 sumsen 阅读(9310) 评论(0) 推荐(0)

摘要:if.. then.. else用法create or replace trigger DELETE_CUSTBANK before delete on bd_custbank for each rowdeclare -- local variables here pk_bas char(20); cursor basjob(id char) is select pk_custbank from ncv5.bd_custbank /*目标数据库表*/ where pk_custbank = id and nv... 阅读全文
posted @ 2012-06-19 13:13 sumsen 阅读(577) 评论(0) 推荐(0)

摘要:create or replace trigger AUTOLHH before insert on bd_cubasdoc for each rowdeclare -- local variables here vcombineaccnum char(15); vpk_custbank char(20);begin select accaddr,pk_custbank into vcombineaccnum,vpk_custbank from bd_custbank where pk_cubasdoc=:new.pk_cubasdoc; insert into b... 阅读全文
posted @ 2012-06-15 18:00 sumsen 阅读(853) 评论(0) 推荐(0)

摘要:在这里先感谢一下itpub高手的帖子答复Q:看到的oracle中的for循环or i in 1..100 loop,i都是从1,2,3这样递增的,可是我这里需要i从01,02,03这样递增,9开始是09,10,11,12.请问这样的for循环怎么写。具体问题可见http://www.itpub.net/thread-1620912-1-1.html,我想在触发器中加入循环变量,精简我的触发器长度。ps:我是新手,谢谢大家的帮助A:lpad('tech', 7); would return ' tech'lpad('tech', 2); would 阅读全文
posted @ 2012-06-13 11:07 sumsen 阅读(8699) 评论(0) 推荐(0)

摘要:1,http://topic.csdn.net/u/20110402/11/5ef40d65-de73-47cd-bb9e-6e7cb781bc59.html触发器可以调用存储过程;触发器 是在insert update delete触发的时候调用的 其他地方怎么调用?你可以在存储过程中调用存储过程 但是不能调用触发器trigger中的存储过程不能含有commit/rollback语句举例create or replace trigger HVM_ZTPJ_BYQ after insert or update or delete on Xftpj_Pjjl_Byqdeclarebegin .. 阅读全文
posted @ 2012-06-13 08:20 sumsen 阅读(10615) 评论(0) 推荐(0)

摘要:Oracle触发器调用存储过程资料收集整理触发器:Trigger存储过程:Stored Procedure// ******************** 收集1 ********************1.触发器写法create or replace trigger HVM_ZTPJ_BYQ after insert or update or delete on Xftpj_Pjjl_Byqdeclarebegin --直接写存储过程名称+; hvm_byq_tj(1); end HVM_ZTPJ_BYQ; 2.触发器的控制alter table xftpj_pjjl_byq disable. 阅读全文
posted @ 2012-06-13 08:17 sumsen 阅读(5490) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/yxc369/article/details/14707801,简单的循环 以loop关键字开始,exit when子句确定何时推出循环,end loop子句为循环结束标志。 declare pi constant NUMBER(9,7) :=3.1415727 radius INTEGER(5); area NUMBER(14,2); begin radius:=3; loop area:=pi*power(radius,2); insert into AREAS values (radius,area); radius:=radius+1; ex. 阅读全文
posted @ 2012-06-12 23:44 sumsen 阅读(386) 评论(0) 推荐(0)

摘要:之前一直写触发器,期间一直接触和听说了存储过程,好多天过去了,今天才第一次使用了存储过程。一,问题提出:http://zhidao.baidu.com/question/113921713.html求一个oracle程序块,循环插入A表一百行数据.就是定义一个变量,然后让人他循环一百次,往数据库里插入数据.插入的行只有一列是不一样的,就是这个变量,其它一样.请问如何写.表结构就二列.一个是放这个变量 a列,一个是名称列. create table A( a numeric, b varchar2(50))有会的请赐教 ,谢谢二,解决过程1,创建表,需要在plsql中的command窗口cre. 阅读全文
posted @ 2012-06-12 23:20 sumsen 阅读(921) 评论(2) 推荐(0)

摘要:CONN / AS SYSDBA give ORA-01031In windows, If you have such error:SQL> conn / as sysdbaERROR:ORA-01031: insufficient privilegesCheck the sqlnet.ora firstSQLNET.AUTHENTICATION_SERVICES = (NTS)This allows any privileged user defined in the NT user group (named ORA_<sid>_DBA or ORA_DBA) to log 阅读全文
posted @ 2012-06-12 22:43 sumsen 阅读(10773) 评论(0) 推荐(1)

上一页 1 2 3 4 5 6 下一页