程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> 關於Oracle數據庫 >> ORACLE 截斷字符串

ORACLE 截斷字符串

編輯:關於Oracle數據庫

create or replace procedure ModifyLadingItemPack
(
  ASoditemguid varchar2,                  --合同電子倉單明細GUID
  ALadingitemGUID varchar2,               --提單子項GUID
  ACDResID varchar2,                      --電子倉單號
  APackageIDList varchar2,                --倉單捆包具體GUID列表
  Aladingnum float,
  Aladingpieces float,
  AReturnValue out integer                --返回值:
)
is
  ALadingItem_PackagesGUID varchar(32);
  ATempIDList varchar2(4000);
  AID varchar2(32);
  APackageWeight float;
  APackagePiece float;
  ATotalPackWeight float;
begin
  AReturnValue := 1;
  ATempIDList := APackageIDList;
  APackageWeight :=0;
  APackagePiece :=0;    ---------------------------------更新合同電子倉單明細---------------------------
  while ( INSTR(ATempIDList,':' ) > 0 ) or ( LENGTH(ATempIDList ) > 0 ) loop
        if INSTR(ATempIDList,':' ) > 0 then            select sys_guid() into ALadingItem_PackagesGUID from dual;
           AID := SUBSTR(ATempIDList ,1,INSTR( ATempIDList,':') - 1 );
           ATempIDList := SUBSTR(ATempIDList,INSTR( ATempIDList,':') + 1 , LENGTH(ATempIDList) - INSTR(ATempIDList,':'));            ---------------------------------提單捆包明細----------------------------------
           insert into HT_LadingItem_packages(sGUID, sLadingItemGUID, sCDResID, sPackageID)
          values(ALadingItem_PackagesGUID, ALadingitemGUID, ACDResID,AID);            ---------------------------------更新倉單捆包明細狀態---------------------------
           UPDATE ZY_Packages SET state = 5 WHERE SGUID = AID;            select fWeight into ATotalPackWeight from ZY_Packages where sGUID=AID;            APackageWeight:=APackageWeight+ATotalPackWeight;
           APackagePiece:=APackagePiece+1;
        else
           AID := ATempIDList;
           ATempIDList := '';
        end if;
   end loop;    update HT_SODItem set fLadingNum=fLadingNum+APackageWeight,fLadingPieces=fLadingPieces+APackagePiece
   where sGUID=ASoditemguid;   COMMIT;
EXCEPTION
  WHEN OTHERS THEN BEGIN
    AReturnValue := 99;
    ROLLBACK;
  END;
end;

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved