sal

Oracle触发器用法及介绍

喜欢而已 提交于 2019-12-11 18:58:42
1、触发器简介 触发器的定义就是说某个条件成立的时候,触发器里面所定义的语句就会被自动的执行。因此触发器不需要人为的去调用,也不能调用。然后,触发器的触发条件其实在你定义的时候就已经设定好了。这里面需要说明一下,触发器可以分为语句级触发器和行级触发器。详细的介绍可以参考网上的资料,简单的说就是语句级的触发器可以在某些语句执行前或执行后被触发。而行级触发器则是在定义的了触发的表中的行数据改变时就会被触发一次。 具体举例: 1、 在一个表中定义的语句级的触发器,当这个表被删除时,程序就会自动执行触发器里面定义的操作过程。这个就是删除表的操作就是触发器执行的条件了。 2、 在一个表中定义了行级的触发器,那当这个表中一行数据发生变化的时候,比如删除了一行记录,那触发器也会被自动执行了。 2、触发器语法 触发器语法: create [or replace] tigger 触发器名 触发时间 触发事件 on 表名 [for each row] begin pl/sql语句 end 其中: 触发器名:触发器对象的名称。由于触发器是数据库自动执行的,因此该名称只是一个名称,没有实质的用途。 触发时间:指明触发器何时执行,该值可取: before:表示在数据库动作之前触发器执行; after:表示在数据库动作之后触发器执行。 触发事件:指明哪些数据库动作会触发此触发器: insert

why _Printf_format_string_ macro doesn't produce any warnings?

非 Y 不嫁゛ 提交于 2019-12-11 02:27:47
问题 In the following snippet the wrong usage of format specifiers inside the MyFormat() call should produce a warning, according to SAL specifications, and if I uncomment the identical call of printf(), I really will receive all these warnings, but my code is compiled silently even with /W4. What am I doing wrong? I'm using MSVC 2017 15.9.7 Community edition. #include <stdio.h> #include <stdarg.h> void MyFormat(_Printf_format_string_ const char *fmt, ...) { va_list va; va_start(va, fmt); vprintf

Strange SAL annotation warning

牧云@^-^@ 提交于 2019-12-10 21:25:41
问题 I'm trying to use Micosoft's SAL annotation for my project, however I get the following warning, and I don't know why. As an example, I created a new C++ console application, and have this code: #include <sal.h> class Whatever { public: _Check_return_ int Method(__in int number) ; }; int main() { return 0; } When I compile using Visual Studio 2008, I get the following warning: warning C6540: The use of attribute annotations on this function will invalidate all of its existing __declspec

Oracle数据库SELECT语句的使用

谁都会走 提交于 2019-12-10 07:56:26
SELECT语句是数据库中使用频率非常高的语句,就像进入淘宝,京东百度这样的网站往往首先做的事情就是查询;所以查询语句十分重要,需要好好学习,熟练掌握; SELECT基本语句格式: SELECT 查询字段 FROM 数据源 WHERE 条件语句 ORDER BY 排序字段 SELECT的具体使用: --查询所有的员工信息 --查询的数据: * 所有的员工信息 --数据的来源: 员工表 emp --条件: select * from emp ; select * from dept ; SELECT多字段的查询: --select 字段1,字段2... from 数据源; select ename , comm from emp where comm is not null ; SELECT别名: 直接在字段后添加别名即可,中文直接添加,小写的字母需要使用" “英文双引号包裹,”"表示原样输出 --select 字段1,字段2... from 数据源; select ename 员工姓名 , comm 奖金 from emp where comm is not null ; SELECT条件查询WHERE的使用: --条件查询 select 数据 from 数据源 where 行过滤条件; --条件比较符: = > < >= <= != <> --逻辑连接符:and or not -

《SQL CookBook》 简单查询汇总

寵の児 提交于 2019-12-10 05:15:11
下载了《SQL CookBook》 ,认真专研一下,基础是很重要的,是时候拾回那些悄悄溜走的知识了。 1. 查询结果排序 1.1 显示部门 10 中的员工名字、职位和工资,并按照工资的升序排列。 select ename,job,sal from emp order by sal asc; 1.2 在 EMP 表中,首先按照 DEPTNO 的升序排序,然后按照工资的降序排列。 select empno,deptno,sal,ename,job from emp order by deptno asc,sal desc 1.3 从 EMP 表中返回员工名字和职位,并且按照职位字段的最后两个字符排序。 select ename,job from emp order by substr(job,length(job)-2); 1.3 在 EMP 中根据 COMM 排序结果,处理控制排在最后。 select ename,sal,comm from ( select ename,sal,comm ,case when comm is null then 1 else 0 end as is_null from emp) x order by is_null,comm; 1.4 如果 JOB 是“ SALESMAN ” , 要根据 COMM 来排序。否则,根据 SAL 排序。 select

oracle表查询

妖精的绣舞 提交于 2019-12-07 02:23:02
2014-04-07 1.查询每个员工对应的部门 SQL>conn hr/hr; ##查询表 SQL>select object_name from user_objects where object_type='TABLE'; ##查看两张表结构 SQL>desc employees; SQL>desc departments; ##关联查询 SQL>select a.first_name || ' ' ||a.last_name name,employee_id,b.department_name from employees a join departments b on a.department_id=b.department_id; 2.连接 等值连接:inner join 左连接:left join 右连接:right join 自连接:self join 3.查询员工对应的部门和城市 ##查询表 SQL>select object_name from user_objects where object_type='TABLE'; ##查看三张表结构 SQL>desc employees; SQL>desc departments; HR@orcl> desc locations; ##关联查询 HR@orcl> select a.employee_id,a

mysql的查询

喜夏-厌秋 提交于 2019-12-06 16:25:27
/********************************部门表dept********************************/ /*创建表*/ DROP TABLE IF EXISTS DEPT; CREATE TABLE DEPT( DEPTNO INT PRIMARY KEY, DNAME VARCHAR(14) , LOC VARCHAR(13) ); /*插入数据*/ INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK'), (20,'RESEARCH','DALLAS'), (30,'SALES','CHICAGO'), (40,'OPERATIONS','BOSTON'); /*查询数据*/ SELECT * FROM DEPT; /********************************员工表emp********************************/ /*创建表*/ DROP TABLE IF EXISTS EMP; CREATE TABLE EMP( EMPNO INT PRIMARY KEY, ENAME VARCHAR(14) , JOB VARCHAR(9), MGR INT, HIREDATE DATE, SAL DECIMAL(7,2), COMM DECIMAL

sql server查询(SELECT 简单)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 13:03:38
基本查询: 实例表 1 示例表 2 --部门表 3 4 create table dept( 5 6 deptno int primary key,--部门编号 7 8 dname nvarchar(30),--部门名 9 10 loc nvarchar(30)--地址 11 12 ); 13 14 15 16 --雇员表 17 18 create table emp( 19 20 empno int primary key,--雇员号 21 22 ename nvarchar(30),--员工姓名 23 24 job nvarchar(30),--雇员工作 25 26 mrg int,--雇员上级 27 28 hiredate datetime,--入职时间 29 30 sal numeric(10,2),--薪水 31 32 comm numeric(10,2),--奖金 33 34 deptno int foreign key references dept(deptno)--设置外键 35 36 ); 37 38 39 40 insert into dept values (10,'ACCOUNTING','NEW YORK'); 41 42 insert into dept values (20,'RESEARCH','DALLAS'); 43 44 insert

What is the purpose of SAL (Source Annotation Language) and what is the difference between SAL 1 and 2?

ⅰ亾dé卋堺 提交于 2019-12-06 02:03:46
问题 As asked in the title: What is the purpose of SAL (Source Annotation Language) and what is the difference between SAL 1 and SAL 2? I understand the basics of the usage, and that is serves to highlight the purpose of each of the variables passed to functions along with various other things for static code analysis, but how much difference does it actually make (ignoring increasing clarity of parameter requirements for other programmers on the project)? If I was to have the following prototype:

pl/sql--基本的语法及操作

醉酒当歌 提交于 2019-12-05 23:47:34
一:plsql总内容概括 1.pl/sql基本的语法结构  declare,begin,exception,end,:=,=,等关键字 字符 2.记录类型 type ... is record( , , );(相当于java的成员变量) 3.流程控制 3.1 条件判断(两种) 方式一: if ... then ... elsif ... then ... else ... end if; 方式二: case ... when ... then ... end; 3.2 循环结构(三种) 方式一: loop ... exit when... end loop; 方式二: while ... end loop; 方式三: for i in ... loop ... end loop; 3.3 关键字 goto 跳出循环 相当于 java(break) exit 退出 4.游标的使用(类似于java中的Iterator迭代器,用于集合的遍历) 5.异常的处理(三种方式) 6.存储 6.1存储函数:有返回值 6.2存储过程:没有返回值 7.触发器 8.索引 9.视图 二:变量的声明方式 1.指定类型声明,以及长度(类型与表中的类型一致,长度要大于等于表中字段长度) v_sal number(10,2); v_email varchar2(20); v_hire_date date; 2