请问这段PL/SQL程序怎样改成一个SQL命令呢?
因为用C#只能传递SQL命令,不能传递PL/SQL程序,所以要改:DECLEARE
[color=Red]BEGINTIME[/color] DATE:=TO_DATE('2008-11-07 12:00:00','YYYY-MM-DD HH24:MI:SS');
[color=Red]ENDTIME[/color] DATE:=TO_DATE('2008-11-07 12:00:00','YYYY-MM-DD HH24:MI:SS');
BEGIN
SELECT CREATETIME INTO [color=Red]BEGINTIME[/color] FROM DEVICEPROINFO WHERE OPERATIONID=0 AND ROWNUM=1 ORDER BY CREATETIME DESC ;
SELECT CREATETIME INTO [color=Red]ENDTIME[/color] FROM DEVICEPROINFO WHERE DEVICENO= 1 AND OPERATIONID=1 ;
INSERT INTO DEVICEUSE(DEVICENO,STARTTIME) VALUES (1,MOD(MOD([color=Red]ENDTIME[/color]-[color=Red]BEGINTIME[/color],365),30)*24*3600);
UPDATE DEVICEUSE SET PROTIME= 0,WORKTIME=1 WHERE DEVICENO=1;//这一句可以看做是上一句insert into 的补充,希望能改成用一个insert into命令来完成
END;
[[it] 本帖最后由 jqc304 于 2008-11-7 17:24 编辑 [/it]]