帮忙看看 pl/sql 存储过程
老是警告:创建的过程带有编译错误。找了半天也看不出问题所在...createPROCEDURENASYearisv_cursorBINARY_INTEGER;v_sqlv...
老是警告: 创建的过程带有编译错误。
找了半天也看不出问题所在...
create PROCEDURE NASYear
is
v_cursor BINARY_INTEGER;
v_sql varchar2(3000);
v_Number BINARY_INTEGER;
v_ErrCode NUMBER;
v_ErrText VARCHAR2(200);
BEGIN
v_cursor := DBMS_SQL.OPEN_CURSOR;
v_sql := 'insert into t_nasyear select SEQ_NASYAER.nextval,NAS_ip,ondate,time_duration,userNum (select NAS_ip,max(ondate) as ondate,sum(time_duration) as time_duration,sum(userNum) as userNum from t_nasmonth where ondate>(trunc(ADD_MONTHS(sysdate,-1),''mm'')) and ondate<=trunc(sysdate,''mm'') group by NAS_ip)';
DBMS_SQL.PARSE(v_cursor,v_sql,DBMS_SQL.NATIVE);
v_Number := DBMS_SQL.EXECUTE(v_cursor);
DBMS_SQL.CLOSE_CURSOR(v_cursor);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
v_ErrCode := SQLCODE;
v_ErrText := SUBSTR(SQLERRM,1,200);
INSERT INTO woss_log(code,message,info) VALUES(v_ErrCode,v_ErrText,'NASYear ERROR');
IF DBMS_SQL.IS_OPEN(v_cursor) THEN
DBMS_SQL.CLOSE_CURSOR(v_cursor);
END IF;
END NASYear;
知道了,原来本来就没问题,
log表的名字写错了,晕.. 展开
找了半天也看不出问题所在...
create PROCEDURE NASYear
is
v_cursor BINARY_INTEGER;
v_sql varchar2(3000);
v_Number BINARY_INTEGER;
v_ErrCode NUMBER;
v_ErrText VARCHAR2(200);
BEGIN
v_cursor := DBMS_SQL.OPEN_CURSOR;
v_sql := 'insert into t_nasyear select SEQ_NASYAER.nextval,NAS_ip,ondate,time_duration,userNum (select NAS_ip,max(ondate) as ondate,sum(time_duration) as time_duration,sum(userNum) as userNum from t_nasmonth where ondate>(trunc(ADD_MONTHS(sysdate,-1),''mm'')) and ondate<=trunc(sysdate,''mm'') group by NAS_ip)';
DBMS_SQL.PARSE(v_cursor,v_sql,DBMS_SQL.NATIVE);
v_Number := DBMS_SQL.EXECUTE(v_cursor);
DBMS_SQL.CLOSE_CURSOR(v_cursor);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
v_ErrCode := SQLCODE;
v_ErrText := SUBSTR(SQLERRM,1,200);
INSERT INTO woss_log(code,message,info) VALUES(v_ErrCode,v_ErrText,'NASYear ERROR');
IF DBMS_SQL.IS_OPEN(v_cursor) THEN
DBMS_SQL.CLOSE_CURSOR(v_cursor);
END IF;
END NASYear;
知道了,原来本来就没问题,
log表的名字写错了,晕.. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询