發表文章

目前顯示的是 7月, 2015的文章

VBS常用常數變數值

'ADO Status '----------------------------- adStateClosed = 0              'The object is closed adStateOpen = 1                'The object is open adStateConnecting = 2          'The object is connecting adStateExecuting = 4          'The object is executing a command adStateFetching = 8            'The rows of the object are being retrieved '----------------------------- 'ADO Data Types '----------------------------- adEmpty = 0                    'No value adSmallInt = 2                'A 2-byte signed integer. adInteger = 3                  'A 4-byte signed integer. adSingle = 4                  'A single-precision floating-point value. adDouble = 5                  'A double-precision floating-point value. adCurrency = 6                'A currency value adDate = 7                    'The number of days since December 30, 1899 + the fraction of a day. adBSTR = 8        

VBS呼叫Stored Procedure(接Output參數值)

假設有一個Oracle Package Stored Procedure,相關架構如下, 名稱:Package1.StoredProcedure1 參數1:input,料號 參數2:output,成本 VBS可以透過下面的寫法取得Output參數的回傳值, SET con = CreateObject("ADODB.Connection") con.Open DB_Connection_String strItemNo = "ABC00001" curItemCost = 0 SET cmd = CreateObject("ADODB.Command") cmd.CommandText = "Package1.StoredProcedure1" cmd.ActiveConnection = con cmd.NamedParameters = true cmd.CommandType = adCmdStoredProc cmd.Parameters.Append(cmd.CreateParameter("ItemNo", adVarChar, adParamInput, 50, strItemNo)) cmd.Parameters.Append(cmd.CreateParameter("ItemCost", adCurrency, adParamOutput, , curItemCost)) cmd.Execute msgbox "Item Cost: " & cmd.Parameters("ItemCost").Value Reference Web: http://docs.starquest.com/Supportdocs/techStarSQL/StarSQLODBC/Programming/SQ055_VBScript.shtml http://stackoverflow.com/questions/10017872/calling-sql-stored-procedure-with-output-parameter-in-vbscript

MS Batch 建立當天日期的資料夾

使用 @echo off REM 取得日期,並刪除/ FOR /F "tokens=1-4 delims=/ " %%a IN ("%date%") DO SET today=%%a%%b%%c%%d REM 依系統變數windir判斷目前作業系統類別(決定星期是在日期前面還是日期後面),再拆出年月日 REM /I: 比對字串不區分大小寫 if /I %windir%==C:\WINDOWS set bkdate=%today:~0,8% if /I %windir%==C:\WINNT set bkdate=%today:~3,10% mkdir %bkdate%

設定Package讓不同的Schema呼叫執行

Oracle預設是無法直接呼叫執行其他不同Schema的Package/Stored Procedure/Function...的。必需先透過適當的授權才可以,以下使用Package為例。 假設有一個Package "PKG_1"存在SchemaA裡,但SchemaB想要呼叫此Package,該怎麼設定呢? <授權>-單一Schema grant execute on PKG_1 to SchemaB; <授權>-All Schema grant execute on PKG_1 to public; <移除授權> revoke execute on PKG_1 from SchemaB; revoke execute on PKG_1 from public; <瀏覽有哪些授權> select * from DBA_TAB_PRIVS where TABLE_NAME='PKG_1';