SEQ_NAME这个序列你创建了没有?
看一下你连接的用户是否有权限
看一下你连接的用户是否有权限
解决方案 »
- 怎么设置环境变量才可以安装Oracle数据库?
- merge partition问题
- 关于创建数据表空间的问题
- 问个Oracle基础问题,PLSQL生成的建表SQL后面那段代码的意义?
- 救急,高分相送
- 急,数据库的配置问题 “未处理 System.Data.OracleClient.OracleException”
- 怎么删除“队列表”?????
- 一个字段自动生成+1的值的问题!~~~~~~~~谢谢
- 急啊,救命啊,大侠们,job的问题,高手指点迷津!
- Linux Redhat6.4安装oracle 11g报 INS-20802
- 如何连接 oracle 数据库,请写详细的代码 ,
- 请问在sqlplus里如何显示当前用户可以打开的所有表?
create sequence seq_name
increment by 1
start with 1
maxvalue 99999999
nocycle
cache 10这样才可以调用seq_name.nextval
REM =======關務料件每日使用量信息表======
REM id //自動增1的編號
REM dzzc_id //電子賬冊號
REM gwdm_id //關務代碼
REM cpba_id //成品備案號
REM version_id //成品版本號
REM ljba_id //料件備案號
REM gwyl //關務用量
REM ch_date //出貨日期
REM 本表根據系統中的出貨計劃計算每日的每個料件的關務使用量
drop table gwyl;
create table gwyl(
id number(15,0) not null,
dzzc_id varchar2(15 byte) not null,
gwdm_id varchar2(6 byte) not null,
cpba_id number(4,0) not null,
version_id number(3,0) not null,
ljba_id number(4,0) not null,
gwyl number(15,3) not null,
ch_date date not null,
constraint gwyl_id_pk primary key(id) using index tablespace cpindex
)TABLESPACE "LOGISTIC" PCTFREE 10 PCTUSED 0 INITRANS 1
MAXTRANS 255 STORAGE (
INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0)
LOGGING ;
REM 創建一個自動增1的序列
drop sequence gwyl_id_seq;
create sequence gwyl_id_seq
nocycle
maxvalue 999999999999999
start with 1
order
increment by 1;
REM ==========創建執行自動增加主鍵字段的一個触發器=============
drop trigger gwyl_id_trigger;
create or replace trigger gwyl_id_trigger
before insert on gwyl
for each row
declare
next_id number;
begin
--get the next id from the sequence
select gwyl_id_seq.nextval
into next_id
from dual;
--use the sequence number as primary
--for the record begin inserted
:new.id:=next_id;
end ;
/
REM 創建一個防止ID字段被更新的触發器
drop trigger gwyl_id_upd;
create or replace trigger gwyl_id_upd
before update of id on gwyl
for each row
begin
raise_application_error(-2000,'update column id on table gwyl are not allowed.');
end;
/