我正在尝试创建过程以创建序列(如果它不存在)并返回序列名称以便我可以使用它
create or replace
PROCEDURE CREATESEQ
(
TableName IN VARCHAR2
, CloumnName IN VARCHAR2
, pSeq_name out VARCHAR2
) AS
Seq_name varchar2(100);
vCounter number;
BEGIN
Seq_name:=tablename||cloumnname;
vCounter :=0;
-- dbms_output.put_line(Seq_name);
SELECT count(1)
INTO vCounter
FROM user_sequences
WHERE sequence_name = Seq_name;
IF vCounter > 0 THEN
pSeq_name:=seq_name;
else
EXECUTE IMMEDIATE 'create sequence '||Seq_name;
pSeq_name:=seq_name;
END IF ;
END CREATESEQ;
当我尝试像这样执行 CREATESEQ 程序时
DECLARE
TABLENAME VARCHAR2(200);
CLOUMNNAME VARCHAR2(200);
PSEQ_NAME VARCHAR2(200);
BEGIN
TABLENAME := 'Sections';
CLOUMNNAME := 'SectionID';
CREATESEQ(
TABLENAME => TABLENAME,
CLOUMNNAME => CLOUMNNAME,
PSEQ_NAME => PSEQ_NAME
);
:PSEQ_NAME := PSEQ_NAME;
END;
我得到这个错误
ORA-01031:权限不足
ORA-06512:在“TRAINING_AKHADIER.CREATESEQ”,第 23 行
ORA-06512:在第 9 行
感谢任何建议