ORACLE数据库的基本语法集锦
ORACLE数据库的基本语法集锦
-- 表
create table test (names varchar2(12),
dates date,
num int,
dou double);
-- 视图
create or replace view vi_test as
select * from test;
-- 同义词
create or replace synonym aa
for dbusrcard001.aa;
-- 存储过程
create or replace produce dd(v_id in employee.empoy_id%type)
as
begin
end
dd;
-- 函数
create or replace function ee(v_id in employee%rowtype) return varchar(15)
is
var_test varchar2(15);
begin
return var_test;
exception when others then
end
-- 三种触发器的定义
create or replace trigger ff
alter delete
on test
for each row
declare
begin
delete from test;
if sql%rowcount < 0 or sql%rowcount is null then
rais_replaction_err(-20004,"错误")
end if
end
create or replace trigger gg
alter insert
on test
for each row
declare
begin
if :old.names = :new.names then
raise_replaction_err(-2003,"编码重复");
end if
end
create or replace trigger hh
for update
on test
for each row
declare
begin
if updating then
if :old.names <> :new.names then
reaise_replaction_err(-2002,"关键字不能修改")
end if
end if
end
-- 定义游标
declare
cursor aa is
select names,num from test;
begin
for bb in aa
loop
if bb.names = "ORACLE" then
&
相关文档:
--锁的概念
锁出现在数据共享的场合,用来保证数据的一致性。当多个会话同时修改一个表时,需要对数据进行相应的锁定。
-- 锁的模式,有以下几种模式
0:none
1:null 空
2:Row-S 行共享(RS):共享表锁,sub share
3:Row-X 行独占(RX):用于行的修改,sub ex ......
CREATE OR REPLACE FUNCTION OFFICE.fbill_getbalance (billid NUMBER, total NUMBER)
RETURN NUMBER
IS
paid NUMBER;
balance NUMBER;
BEGIN
balance := total;
--get total paid
SELECT SUM (n_paidamount)
&nb ......
public ActionForward backUpAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
&n ......
一、启动
1.#su - oracle 切换到oracle用户且切换到它的环境
2.$lsnrctl status 查看监听及数据库状态
3.$lsnrctl start &nb ......
http://inthirties.com:90/thread-918-3-1.html
This article describes the installation of
Oracle 10g release 2 (10.2.0.1) RAC on Linux (Oracle Enterprise Linux
4.5) using NFS to provide the shared storage.
Introduction
Download Software
Operating System Installation
Oracle Installation Prereq ......