一直都没写过Oracle的存储过程,今天突然来了一个需求:计算指定日期的前N个工作日或者后N个工作日日期(去除周末,法定节假日无
一直都没写过Oracle的存储过程,,今天突然来了一个需求:计算指定日期的前N个工作日或者后N个工作日日期(去除周末,法定节假日无法计算),然后研究了一下 Oracle的时间函数和循环方法。具体实现方法如下,也没啥难的,对数据库没研究过,也不知道下面的写法效率怎么样。
或者有没有更好的写法。o(︶︿︶)o 唉!
create or replace procedure proc_CalculationWorkDate
(
plan_date in date,--登录日期
flag in number,--1 往前日期,0往后日期
date_number in number,--天数
out_date out date--计算出的日期
)
is
dayOfWeek number:=0;--星期的数字
dates number:=date_number;--往前或者往后的天数(包含工作日的)初始化给他等于天数
i int:=0;
j int:=0;
begin
if flag=1 then--计算往前日期
while i
if dayOfWeek=1 or dayOfWeek=7 then --周六 周日
dates:=dates+1;
i:=i;
j:=j+1;
else
i:=i+1;
end if;
end loop;
select plan_date+dates into out_date from dual;
--DBMS_OUTPUT.PUT_LINE(dates);
end if;
if flag=0 then --计算往后日期
while i
if dayOfWeek=1 or dayOfWeek=7 then
dates:=dates+1;
i:=i;
j:=j+1;
else
i:=i+1;
end if;
end loop;
select plan_date-dates into out_date from dual;
--DBMS_OUTPUT.PUT_LINE(dates);
end if;
end;
本文永久更新链接地址:

mysqloffersvariouscharactersetsetStringDatatypes:1)latin1forwesterneuropeanlanguages、2)utf8formultilingualsupport、3)utf8mb4f orextendedunicodeincludingemojis、4)ucs2forfixed-widthencoding、and5)asciiforbasiclatin.choososingtherightsetensuresdategrity

ストリーミングブロブは、メモリの使用量を削減し、パフォーマンスを向上させるため、実際に直接ストレージよりも優れています。 1)ファイルを徐々に読み取り、処理することにより、データベースの膨満感とパフォーマンスの劣化は回避されます。 2)ストリーミングには、より複雑なコードロジックが必要であり、I/O操作の数が増加する場合があります。

mysqlstringTypesimpactStorageandperformanceAseasfollows:1)churisfixed-regents、whuscanbasterbutlessspace-efficient.2)varcharisvariaible、morespace-efficient-butpotentiallyslower.3)Textisforgergetext、storedoutext、

mysqlstringTypesincludevarchar、テキスト、char、列挙、およびセット。1)varcharisSatileforvariaible-lengthstringsuptoaspoecifedlimit.2)TextisidealforLargetExtStorageWithDeinLength.3)charispixed-consinterconsistentalikodes.4)

mysqloffersvariousstringdatatypes:1)charfixed-lengthstrings、2)varcharforvariable-lengthtext、3)binaryandvartyforbinarydata、4)blobandtextforlargedata、and5)enumandsetforControlledinput.

tograntpermissionstonewmysqlusers、フォローステープ:1)Accessmysqlasauserwithsufthiveerprivileges、2)createanewuser withthecreateusercommand、3)usethegrantcommandtospecifypermissionsionsionsionsionsionsionsionsionsionsionselect、挿入、挿入、挿入、更新、4)

toadduusersinmysqucrectivally andcurally、soflowthesteps:1)usethecreateuserstatementtoaddanewuser、指定するhostandastrongpassword.2)補助金を使用して、補助金を使用して、補助すること、

toaddanewuserwithpermissionsinmysql、followthesesteps:1)createtheuserwithcreateuser'newuser '@' localhost'identifiedifiedifiedifiedby'pa ssword ';。2)grantreadacestoalltablesin'mydatabase'withgrantselectonmydatabase.to'newuser'@'localhost';。3)grantwriteaccessto '


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SAP NetWeaver Server Adapter for Eclipse
Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

メモ帳++7.3.1
使いやすく無料のコードエディター

EditPlus 中国語クラック版
サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境
