我无法删除错误
第18行的错误:PLS-00103:遇到符号" ="什么时候期待 以下之一:常数异常 table LONG_ double ref char time timestamp interval date二进制国家字符nchar
我的程序:
CREATE OR REPLACE PROCEDURE create_schedule( id IN VARCHAR2,ac1st IN ARCHAR2,ac2nd IN VARCHAR2,ac3rd IN VARCHAR2 ,sleeper IN VARCHAR2)
AS
BEGIN
DECLARE
query_str VARCHAR2(512);
ac1 VARCHAR2(10);
ac2 VARCHAR2(10);
ac3 VARCHAR2(10);
slp VARCHAR2(10);
ac1 := 'ac1st'||id;
ac2 := 'ac2nd'||id;
ac3 := 'ac3rd'||id;
slp := 'sleeper'||id;
query_str := 'alter table schedule
add( :1 number default ( :2) not null ,
:3 number default ( :4 ) not null ,
:5 number default ( :6) not null ,
:7 number default ( :8) not null )';
EXECUTE IMMEDIATE query_str using ac1,ac1st,ac2,ac2nd,ac3,ac3rd,slp,sleeper ;
commit;
END create_schedule ;
/
答案 0 :(得分:1)
您有一些错误(BEGIN
参数,DECLARE
的位置,不需要的CREATE OR REPLACE PROCEDURE create_schedule( id IN VARCHAR2,ac1st IN VARCHAR2,ac2nd IN VARCHAR2,ac3rd IN VARCHAR2 ,sleeper IN VARCHAR2)
AS
query_str VARCHAR2(512);
ac1 VARCHAR2(10);
ac2 VARCHAR2(10);
ac3 VARCHAR2(10);
slp VARCHAR2(10);
begin
ac1 := 'ac1st'||id;
ac2 := 'ac2nd'||id;
ac3 := 'ac3rd'||id;
slp := 'sleeper'||id;
query_str := 'alter table schedule
add( :1 number default ( :2) not null ,
:3 number default ( :4 ) not null ,
:5 number default ( :6) not null ,
:7 number default ( :8) not null )';
EXECUTE IMMEDIATE query_str using ac1,ac1st,ac2,ac2nd,ac3,ac3rd,slp,sleeper ;
commit;
END create_schedule ;
/
):
request({url:formQuery(query), encoding:"utf8"}, (err, res, body) => {
if (err) handleErr(err)
let json = JSON.parse(body);
console.log(JSON.stringify(json, null, 3))
})