This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stop; | |
-- Publish the data within a table using SQL | |
with json_rows (j) as ( | |
select json_object( | |
key 'EMPNO' value empno, key 'FIRSTNME' value firstnme, | |
key 'MIDINIT' value midinit, key 'LASTNAME' value lastname, | |
key 'WORKDEPT' value workdept, key 'PHONENO' value phoneno, | |
key 'HIREDATE' value hiredate, key 'JOB' value job, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Lets say I have this character data, how do I extract the numeric? | |
-- | |
-- Q: Library . . . . . . : SYSIBM Number of objects . : 65 | |
-- A: Use the TRANSLATE built-in function to convert all the noise characters to blanks | |
values bigint( | |
translate( | |
'Library . . . . . . : SYSIBM Number of objects . : 65', | |
' ', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- setup | |
cl: STRTCPSVR SERVER(*SMTP) ; | |
cl: ADDUSRSMTP USRPRF(SCOTTF); | |
cl: ADDUSRSMTP USRPRF(TIMMR); | |
-- Send SMTP E-mail Message (SNDSMTPEMM) | |
cl:SNDSMTPEMM RCP(('forstie@us.ibm.com' *pri)) SUBJECT('hello world again') NOTE('this is a new note'); | |
cl:SNDSMTPEMM RCP(('forstie@us.ibm.com' *pri)) SUBJECT('hello world again') NOTE('this is a new note'); | |
select * from SQLISFUN00.may17objs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Author: Scott Forstie | |
-- Email: forstie@us.ibm.com | |
create or replace variable coolstuff.decdate dec(6,0); | |
set coolstuff.decdate = '190718'; | |
-- July 18, 2019 (yes, really!) | |
values timestamp_format(varchar(coolstuff.decdate), 'YYMMDD'); | |
-- Wow | |
-- Yowza |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This fails to return data....why? | |
SELECT cusip, issueDate, bidToCoverRatio | |
FROM JSON_TABLE( | |
SYSTOOLS.HTTPGETCLOB('https://www.treasurydirect.gov/TA_WS/securities/announced?format=json&type=FRN&pagesize=5', null), | |
'$.root[*]' | |
COLUMNS(cusip VARCHAR(10) PATH '$.cusip', | |
issueDate Timestamp PATH '$.issueDate', | |
bidToCoverRatio double PATH '$.bidToCoverRatio') | |
) AS X; | |
stop; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create procedure qgpl.values_into (out pout integer) | |
begin | |
declare values_into_stmt varchar(1000) ccsid 37; | |
set values_into_stmt = 'values 1+2+3 into ?'; | |
prepare values_into_query from values_into_stmt; | |
execute values_into_query using pout; | |
end; | |
call qgpl.values_into(?); | |
-- Note that 6 is returned... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Traditional 3-part name SQL would reference a table, view, or procedure | |
-- | |
call otherRDB.schema.procedure123(); | |
stop; | |
insert into localschema.fact_table | |
select * from otherRDB.remoteschema.fact_table; | |
stop; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- | |
-- description: find database files and deploy Temporal over them | |
-- note: The history table will be named <existing-table-name>_HISTORY | |
-- note: Uncomment the LPRINTF's if you've built this procedure or have it from Db2 for i | |
-- minvrm: V7R3M0 | |
-- | |
CREATE OR REPLACE PROCEDURE coolstuff.deploy_temporal(target_library varchar(10)) | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Now that ACS is shipped on the IBM i via PTFs, we no longer need to manually move the | |
-- acsbundle.jar onto the IBM i. Just apply the latest ACS PTFs and reference the jar | |
-- at: /QIBM/proddata/Access/ACS/Base/acsbundle.jar | |
-- | |
-- Initial PTFs of ACS | |
-- V7R4M0 SI71900 | |
-- V7R3M0 SI71934 | |
-- |
NewerOlder