Skip to content

Instantly share code, notes, and snippets.

View jsranko's full-sized avatar

Juraj Sranko jsranko

View GitHub Profile
CREATE or replace function siiia.select_spool_data (in_user char(10), in_file char(10), in_startdatum char(8), in_enddatum char(8))
Returns Table (spooldata Varchar(32656))
Language Sql
Specific siiia/SISFSSD
Not Deterministic
modifies sql data
Returns Null On Null Input
Set Option Dbgview = *Source
Begin
Declare Continue Handler For Sqlexception
Create or Replace Function siiia.getQueryDefinition (qrylibrary char(10), qryfile char(10))
Returns Table(qrylib char(10),
qryfile char(10),
qrydef varchar(500))
language sql
Modifies Sql Data
not fenced
begin
declare clstmt varchar(1000);
@jsranko
jsranko / si_all sources_of_the_system_with_sql.sql
Last active August 4, 2020 12:50
All sources of the system with SQL
select a.table_schema, a.table_name, b.table_partition, c.recorddata
from systables a
join syspartitionstat b
on a.table_name = b.table_name
and a.table_schema = b.table_schema
join table(siiia/SIPFM_ListData(a.table_schema, a.table_name, b.table_partition)) c
on 1 = 1
where a.file_type = 'S'
;
@jsranko
jsranko / VIEWDEPS.sql
Last active June 8, 2020 10:49
Get View dependencies (DB2 for IBM i)
-- UDTF:VIEW_DEPENDENCIES determines view dependencies
Create or Replace Function SI_VIEW_DEPENDENCIES(File Varchar(10),
Library Varchar(10))
Returns Table (Level Integer,
File Varchar(10),
Library Varchar(10))
Language Sql
Specific SIVWDEPS