当前位置:数据库 > Oracle >>

ORACLE数据库存储过程:下边的存储过程在执行的时候提示错误信息是怎么回事 啊?请大家帮忙啊!谢谢!

CREATE OR REPLACE PROCEDURE "TEST"."PROC_INSMONTH_JL" AS STRDATE1 VARCHAR2(50); stryear VARCHAR2(10); MYSTR VARCHAR2(2000); BEGIN STRDATE1:=TO_CHAR(SYSDATE,'YYYY-MM-DD'); stryear:=TO_CHAR(SYSDATE,'YYYYMM'); MYSTR:='INSERT INTO Report_Month_JL'||stryear|| ' SELECT SID,PID,sum(newvalue) as Rvalue,sum(newvalue) as Newvalue,||STRDATE1|| as Ddate'|| ' FROM REPORT_JL'||stryear|| ' WHERE (PTIME BETWEEN SYSDATE-1 and SYSDATE)'|| ' GROUP BY SID,PID'; EXECUTE IMMEDIATE MYSTR; COMMIT; ---EXCEPTION --- WHEN OTHERS THEN ---NULL; END;
追问:提示:缺少表达式的错误信息!就是要把从一个表中查询出的数据写到另一个表中,表是带有年月的表。要把select语句查询出的符合条件的信息插入到insert语句对应的表中,是ORACLE数据库。
答案:CREATE OR REPLACE  PROCEDURE "TEST"."PROC_INSMONTH_JL"  AS
   STRDATE1 VARCHAR2(50);
   stryear VARCHAR2(10);
   MYSTR VARCHAR2(2000);
  BEGIN
    STRDATE1:=TO_CHAR(SYSDATE,'YYYY-MM-DD');
    stryear:=TO_CHAR(SYSDATE,'YYYYMM');
    MYSTR:='INSERT INTO Report_Month_JL'||stryear||
    ' SELECT SID,PID,sum(newvalue) as Rvalue,sum(newvalue) as Newvalue,||STRDATE1|| as Ddate'||
    ' FROM REPORT_JL'||stryear||
    ' WHERE (PTIME BETWEEN SYSDATE-1 and SYSDATE)'||
    ' GROUP BY SID,PID';
    EXECUTE IMMEDIATE MYSTR;
  COMMIT;g
  ---EXCEPTION
  --- WHEN OTHERS THEN
  ---NULL;
END;
其他:提示什么错误信息了呢? 什么意思?要把这个SELECT语句放到存储过程里面?SQLSERVER吗?给存储过程传个参数就行
 select  fybm  from  zf_fy  where  zf_fy.nodeid=@v_arg  @v_arg就是存储过程的参数

上一个:我在用微软的SSMA链接oracle (远程的)现在跳出一个框,说是要oracle客户端软件8.1或更高版本。请求帮助
下一个:oracle pl/sql连接的问题

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,