call portal.puserbyusername('kutklwano2');

                SELECT personid FROM dbo.personhasprogramme 
                WHERE username = 'kutklwano2';

 ALTER TABLE dbo.PersonHasProgramme SET (SYSTEM_VERSIONING = OFF);
/*Optionally, DROP PERIOD if you want to revert temporal table to a non-temporal*/
ALTER TABLE dbo.PersonHasProgramme
DROP PERIOD FOR SYSTEM_TIME;                


raise notice 'insert tbl1 done!';


1208957



BEGIN;
    CALL test_get_data_single(2);
    FETCH ALL FROM "rs_resultone";
END;

BEGIN;
    call portal.puserbyusername('kutklwano2');
    FETCH ALL FROM "rs_resultone";
END;

BEGIN;
    SELECT show_cities('cities_cur');
    -- Returns: cities_cur
    FETCH ALL IN "cities_cur";
COMMIT;

BEGIN;
    SELECT show_cities('cities_cur');
    -- Returns: cities_cur
    FETCH ALL IN "cities_cur";
COMMIT;

BEGIN;
    call portal.puserbyusername('kutklwano2');
    FETCH ALL FROM "rs_result";
END;

BEGIN;
    select portal.puserbyusernamefunc('rs_result', 'kutklwano2');
    FETCH ALL in "rs_result";
END;

BEGIN;
    select portal.puserbyusername('p_refcur', 'kutklwano2');
    FETCH ALL in "p_refcur";
END;

BEGIN;
    select portal.puserbyuserid('p_refcur', '26A04E04-C8F3-49C6-AE85-004B61CAAD4A');
    FETCH ALL in "p_refcur";
END;

BEGIN;
    select portal.puserredirectto('p_refcur', '26A04E04-C8F3-49C6-AE85-004B61CAAD4A');
    FETCH ALL in "p_refcur";
END;

BEGIN;
    select portal.puserbyusernamefunc('kutklwano2');
    FETCH ALL in "unnamed portal 7";
END;

SELECT test_ret('foo','barbaz');

SELECT * from portal.test_ret('foo','barbaz');

select * from portal.puserbyusername('kutklwano2');

select * from portal.puserbyuserid('26A04E04-C8F3-49C6-AE85-004B61CAAD4A');

select * from portal.puserredirectto('26A04E04-C8F3-49C6-AE85-004B61CAAD4A');

select * from portal.pschoollistprovinceregiondistrictfilter('663BE25F-2F53-40B6-8684-6CFACEFDA395');

select * from dbo.pnewdataimportid('Learner - DDD', 'Click Foundation Extract 2021-0-7-12.csv', '7/12/2021', 'Click Foundation Extract 2021-07-12.csv', '08273A82-7DB5-47A0-9BC7-D92E9E156981')

select * from dbo.pupdatedataimport(3712, 'Success', 'message')

select * from internal.pupdatedddids(3712)

select * from internal.pnewdataimportid(3712, 'Update DDD IDs')

call internal.pdataimportloginsert(3712, 'dddd')

call internal.pupdatesourcelearner(3712, 2)

call dbo.fgetsystemparameter('Processing', 'Rollover', 'Usable Data Friday', 0, '4')

call internal.pupdatelearnerfromsourcelearnerfirstusabledata(3712)

call internal.ptemporalstatus

CALL internal.pdataimportloginsertcount(3712, 'Learner has left school (previous year): %d', var_RowCount)

------------------------
call internal.pupdatesourcelearner(3712, 2)

call internal.pupdatelearnerfromsourcelearnerfirstusabledata(3712)

call internal.ptemporalstatus('dbo.SchoolLearner', 0, NULL, 1)

call internal.pupdatelearnerfromsourcelearner(3712, 2021, 0, 0, 1);

call internal.pupdatelearnerfromsourcelearner(?, null, 0, 0, 0, 0, ?, ?);

CALL internal.pdataimportloginsertcount(3712, 'Learner has left school (previous year): %d', 100);

CALL dbo.plearnersregisterfromsourcelearner(null, 'DDD', 'ALL');

CALL internal.pTransferLearner(3712);

CALL internal.pgenerateusernames('DDD', 'ALL');

CALL internal.pgenerateusernamesmatific('DDD');

select * from reporting.pvalidatecemislearner(3712, 1, 1);

CALL dbo.pupdatelearnercemis(3712);

CALL internal.pupdateschooldatasource();

select dbo.fgetrelatedhierarchyrootentityid(522, 'Click Foundation Report Regions Home Learning');

select * from reporting.pgeneratereports('School Last Submission Extract', 'South Africa','Organization', 'Click Foundation Report Regions');

User::Report - 'School Last Submission Extract'
User::ReportParamByEntityType - 'Organization'
User::ReportParamByEntity - 'Click Foundation Report Regions'
User::ReportExportFormat - 'XLSX'
User::ReportEmailSend - True
User::ReportEmailOverrideTo - ''
User::ReportEmailEntityRole - 'School Submission Report'
User::ReportParamByHierarchy - 'South Africa'

CALL internal.ptransferparentconsenthomelearning(4084, 0, 0, 1);

select * from  internal.pdataimportlogtext(3690, 'log-text');

select * from reporting.pgeneratereports(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

CALL internal.plearnerregistrationcheck(<par_schools character varying>,<par_programmes character varying>);

CALL internal.plearnerregistrationcheck('DDD','ALL');

CALL internal.pCompleteDDDFileImport();

SELECT * FROM dbo.plearnersregisterfromsourcelearnerf(NULL, 'DDD', 'ALL');

CALL internal.pUpdateLearnerFromSourceLearner(5567, 2021, 0, 0, 0, 0, 'CEMIS','ALL');

SELECT * FROM internal.pnewdataimportid(5690,'New');

CALL internal.pActivateSchoolReadingEggs(${newImportId})

SELECT * FROM internal.pgetprogrammeregistrationregionlistf(4267,'RE',NULL,0, 0)

SELECT * FROM internal.pgetprogrammeregistrationregionlistf(4267,'RE',NULL,1, 1)