• PHP 调用oracle存储过程


             $orderdate = strtotime($this->input->get('orderdate'));            
                    $today = strtotime(date('Y-m-d',time()));
             $num = ceil(($orderdate - $today)/86400);
    $conn = oci_connect('username','password',"(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=host)(PORT = 1521))(CONNECT_DATA =(SID=sid)))"); $sql = 'BEGIN PROC_CREATEORDERDETAIL(:INPUTNUM); END;'; $stmt = oci_parse($conn,$sql); //编译            oci_bind_by_name($stmt,':INPUTNUM',$num,32); //参数绑定 if(oci_execute($stmt)){ echo "<script>window.alert("已重新生成当日订单明细"),location.href="http://bi.xiaoyou-game.com/order/lists";</script>";

    存储过程:

    create or replace PROCEDURE  PROC_CREATEORDERDETAIL(INPUTNUM IN NUMBER)
    AS
    V_AMOUNT_REMAIN  NUMBER;
    BEGIN
    
    
      DELETE FROM TBL_NEW_PLAN_HOUR T WHERE SUBSTR(T.PLAN_HOUR,0,10)=TO_CHAR(SYSDATE+INPUTNUM,'YYYY-MM-DD');
      INSERT INTO TBL_NEW_PLAN_HOUR(ORDERID,DIM_HOUR,HOUR_AMOUNT,PLAN_HOUR,FINISHED_AMOUNT,SCRIPTPACKAGE)
      SELECT OL.ORDERID,
             T.DIM_HOUR,
             ROUND(OL.ORDERAMOUNT*T.RADIO/100) AS HOUR_AMOUNT,
             TO_CHAR(TO_DATE(OL.ORDERDATE,'YYYY-MM-DD HH24:MI:SS')+T.DIM_HOUR/24,'YYYY-MM-DD HH24:MI:SS') AS PLAN_HOUR,
             0 AS FINISHED_AMOUNT,
             ol.SCRIPTPACKAGE
      FROM   TBL_NEW_RADIO T,ORDERLIST OL
      WHERE  OL.ORDERDATE=TO_CHAR(SYSDATE+INPUTNUM,'YYYY-MM-DD');
      COMMIT;
    
      
    END;
  • 相关阅读:
    SQL Server数据库中批量导入数据
    SQL里面也能用Split()
    MSSQL发送邮件
    Asp.Net简单的发邮件功能
    十大措施保证系统安全性
    WebDriver测试web中遇到的弹出框或不确定的页面
    WebDriver数据驱动模式
    nginx 优化(转)
    配置虚拟目录出错
    14152学期校内岗招聘信息
  • 原文地址:https://www.cnblogs.com/feiwu123/p/5420504.html
Copyright © 2020-2023  润新知