Month: June 2018

IBM i talks to WATSON

We can invoke Watson API from IBM i using DB2’s SQL function Httpgetclob. Httpgetclob retrieves a text-based resource from the specified URL through an Http Get Request.Httpgetclob returns the resource as CLOB(5M) data. Example : Calling WATSON language translate Api to convert english to french using httpgetclob. Select Char(Systools.httpgetclob(‘https://watson-api-explorer.mybluemix.net/language-translator/api/v2/translate?model_id=en-fr&text=good+night’, ‘ ‘), 256) From Sysibm/Sysdummy1 Result […]

Sql TRANSLATE function

The Sql TRANSLATE() function replaces a sequence of characters in a string with another sequence of characters. The function replaces a single character at a time. Example: Select TRANSLATE(‘This@is@an@example.’,  ‘ ‘,  ‘@’ ) From Sysibm/Sysdummy1 Result:    This is an example.  

Sql Varchar_Format Function

The VARCHAR_FORMAT function returns a string representation of a timestamp that has been formatted according to a specified character template Example : Select Varchar_Format(Current_Date, ‘YYYYMM’) From Sysibm/Sysdummy1 This query returns 201806