unote 書けば書くほどに

2023-02-01から1ヶ月間の記事一覧

20230228

DataRow drResult = dtWord.Select("", "word desc");DataRow drResult = dtWord.As.AsEnumerable() .OrderBy(x => x["word"]) .ToArray();static void Main() { DataTable dt = new DataTable(); dt.Columns.Add("No", typeof(int)); dt.Columns.Add("Name"…

20230226

DataTable dtN = new DataTable();//全ての項目テーブル DataTable dtZ = new DataTable();//検索対象(NAME ALL) //全ての項目テーブル strSQL = "select * from DEPT"; Console.WriteLine(strSQL); dtN = OraTableSelect(strSQL); //検索対象(NAME ALL) str…

20230222

void getString()//CreateWord { string str = dtWord.Rows[X]["chkZ"].ToString(); string tgt = "-"; int tgtidx = str.IndexOf(tgt); if (tgtidx > 1) { Console.WriteLine(str.Substring(0, tgtidx + 5));//ハイフン+5桁を取り出す } else { Console.Wr…

20230219

//2回実行あいまい検索 DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); Console.WriteLine("実行..."); strSQL = "select * from DEPT"; Console.WriteLine(strSQL); dt1 = OraTableSelect(strSQL); //ALL strSQL = "select DNAME from…

20230216

create table RV_BONUS as select * from SCOTT.BONUSselect table_name from user_tables

https://it.notepad-blog.com/tool/db/oracle/293/https://medium-company.com/%E5%86%85%E9%83%A8%E7%B5%90%E5%90%88-%E5%A4%96%E9%83%A8%E7%B5%90%E5%90%88-%E9%81%95%E3%81%84/■WHEREを使った例SELECT 社員.社員ID, 社員.社員名, 社員.部署ID, 部署マスタ…

20230213

void getString() { string str = "9823-kko-A"; string target = "-"; int tgtFirst = str.IndexOf(target); int numFirst = tgtFirst + 1; int tgtSecond = str.IndexOf(target, numFirst); int numLast = tgtSecond - 1; string num = str.Substring(0, 1…

20230213

// 検証 //テーブル関数内に作成:検証関数 void B_TableMarge() { DataTable dt = new DataTable(); TN = "DEPT"; repTN = "R_" + TN + " R"; xbbTN = TN + "@FICUSR X"; bkTN = TN + "_BK"; col1 = "DEPTNO"; whereON = "R." + col1 + " = X." + col1; str…

public void DBA_non_dt(string strSql) { //接続文字列 string strConn = "User Id=SCOTT;" + "Password=tiger;" + "Data Source=" + "(DESCRIPTION = " + "(ADDRESS = (PROTOCOL = TCP)(HOST = mypcwin)(PORT = 1521))" + "(CONNECT_DATA = " + "(SERVER =…

20230209

public void OraDropCreate(string TN) { DataTable dt = new DataTable(); Console.WriteLine("実行...\r\n"); try { //Drop strSql_DRP = "drop table " + TN + "_BK"; Console.WriteLine("drop実行..."); strSql = strSql_DRP; Console.WriteLine(strSql)…

//テーブル関数内に作成:検証関数 public void chkdata() { string repTN_BK = repTN + " _BK"; repTN = repTN + " R"; //_BK strSql = "create " + repTN_BK + " as select * from " + repTN; //dt = dbQ(strSql); //minusで差分を確認 strSql = "select c…

20230207

string repTN_tmp = ""; //一時テーブル作成 strSql = "create table " + repTN_tmp + " as select * from " + xbbTN + " where rownum = 1"; //更新行だけインサート strSql = "insert into " + repTN_tmp + " select * from " + xbbTN + " where R.KOUSHIN…

20230206

//テーブル関数内に作成:検証関数void chkdata() { //_BK strSql = "create " + repTN + "_BK as select * from " + repTN; //dt = dbQ(strSql);minus() { strSql = "select * from " + repTN + "_BK " + "minus select * from " + repTN; //dt = dbQ(strSq…

20230203

public void B_TableMarge() { DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); string repTN = "DEPT_BK R"; string xbbTN = "DEPT X"; col1 = "DEPTNO"; whereON = "R." + col1 + " = X." + col1; string whereDEL_R = "R." + col1; s…

20230202

//全件数カウント chkCNT = CNT(repTN, xbbTN); dt = TableMinus_CNT(); if (dt.Rows[0][0].ToString() == "0") { Console.WriteLine("差分なし"); } else { //MARGE実行(差分抽出→項目更新→日付更新) MRG(repTN, xbbTN, colNum, chkCNT); //削除 DEL(repTN,…