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
&
相关文档:
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 ......
import java.net.url;
import java.sql.*;
public class javaoracle {
public javaoracle() {
}
public static void main(string[] args){
try
{
try{
class.forname("oracle.jdbc.driver.oracledriver");
}
catch(java.lang.classnotfoundexception e)
{
system.err.print(e.getmessage());
} ......
折腾了两个晚上的linux和oralce,总算出来点东西了。Oralce安装要选用适用的版本,不然安装不会成功,最后我的决定是linux选用centos 5.0,oracle选用10。
一、 准备工作:
1. 使用root用户登录
我使用的是在本机装,所以直接打开终端就 ......
一、启动
1.#su - oracle 切换到oracle用户且切换到它的环境
2.$lsnrctl status 查看监听及数据库状态
3.$lsnrctl start &nb ......
原文地址:http://tech.e800.com.cn/articles/2009/710/1247207067745_1.html
处理方法一 :
检查哪个表被锁
select sess.sid,sess.serial#,
lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from
v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id =
lo.object_id
......