PLS-00103:在预期以下情况之一时遇到符号:



我无法删除错误

第18行错误:PLS-00103:预期时遇到符号"="以下之一:常量异常表LONG_双参考字符时间戳间隔日期二进制国家字符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 ;
/

您有一些错误(ARCHAR2参数,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 ;
/

相关内容

  • 没有找到相关文章

最新更新