diff --git a/api/src/main/resources/scripts/SPM_Migration_1 - School-Districts-Authorities.sql b/api/src/main/resources/scripts/SPM_Migration_1 - School-Districts-Authorities.sql index 20d0b60b..1584d19b 100644 --- a/api/src/main/resources/scripts/SPM_Migration_1 - School-Districts-Authorities.sql +++ b/api/src/main/resources/scripts/SPM_Migration_1 - School-Districts-Authorities.sql @@ -369,29 +369,7 @@ SELECT 'SPM_MIGRATION' as UPDATE_USER, sysdate as UPDATE_DATE FROM SCHOOL_MASTER schl_mast -WHERE TRIM(schl_mast.GRADE_12_IND ) = 'Y' -UNION -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_GRADE_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE schl_mast.SCHLNO = schl.SCHOOL_NUMBER AND schl_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - 'ELEMUNGR' as SCHOOL_GRADE_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_MASTER schl_mast -WHERE TRIM(schl_mast.GRADE_EU_IND ) = 'Y' -UNION -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_GRADE_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE schl_mast.SCHLNO = schl.SCHOOL_NUMBER AND schl_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - 'SECUNGR' as SCHOOL_GRADE_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_MASTER schl_mast -WHERE TRIM(schl_mast.GRADE_SU_IND ) = 'Y'; +WHERE TRIM(schl_mast.GRADE_12_IND ) = 'Y'; CREATE TABLE NEIGHBORHOOD_LEARNING as diff --git a/api/src/main/resources/scripts/SPM_Migration_2 - SLD Student Load.sql b/api/src/main/resources/scripts/SPM_Migration_2 - SLD Student Load.sql deleted file mode 100644 index 51885ec6..00000000 --- a/api/src/main/resources/scripts/SPM_Migration_2 - SLD Student Load.sql +++ /dev/null @@ -1,229 +0,0 @@ -CREATE INDEX STUDENT_LINK_PEN_INDX -ON STUDENT_LINK(PEN); - -CREATE INDEX STUDENT_PEN_REP_DATE_INDX -ON STUDENT(PEN,REPORT_DATE); - -CREATE INDEX STUDENT_PROGRAMS_PEN_INDX -ON STUDENT_PROGRAMS(PEN); - -CREATE INDEX STUDENT_PROGRAMS_REPORT_DATE_INDX -ON STUDENT_PROGRAMS(REPORT_DATE); - -CREATE INDEX STUDENT_PROGRAMS_CAREER_PROGRAM_INDX -ON STUDENT_PROGRAMS(CAREER_PROGRAM); - -CREATE TABLE COLLECTION_TYPE_CODE -( - COLLECTION_TYPE_CODE VARCHAR(10) NOT NULL, - LABEL VARCHAR(30) NOT NULL, - DESCRIPTION VARCHAR(255) NOT NULL, - DISPLAY_ORDER NUMERIC DEFAULT 1 NOT NULL, - EFFECTIVE_DATE TIMESTAMP NOT NULL, - EXPIRY_DATE TIMESTAMP NOT NULL, - OPEN_DATE TIMESTAMP NOT NULL, - CLOSE_DATE TIMESTAMP NOT NULL, - CREATE_USER VARCHAR(32) NOT NULL, - CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - UPDATE_USER VARCHAR(32) NOT NULL, - UPDATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT COLLECTION_TYPE_CODE_PK PRIMARY KEY (COLLECTION_TYPE_CODE) -); - -INSERT INTO COLLECTION_TYPE_CODE (COLLECTION_TYPE_CODE, LABEL, DESCRIPTION, DISPLAY_ORDER, EFFECTIVE_DATE, - EXPIRY_DATE, OPEN_DATE, CLOSE_DATE, CREATE_USER, CREATE_DATE, - UPDATE_USER, UPDATE_DATE) -VALUES ('SEPTEMBER', 'September', 'September collection', '10', TO_DATE('20230210', 'YYYYMMDD'), - TO_DATE('99991231', 'YYYYMMDD'), TO_DATE('20230929', 'YYYYMMDD'), - TO_DATE('20231115', 'YYYYMMDD'), 'API_STUDENT_DATA_COLLECTION', - TO_DATE('20230210', 'YYYYMMDD'), - 'API_STUDENT_DATA_COLLECTION', TO_DATE('20230210', 'YYYYMMDD')); - -INSERT INTO COLLECTION_TYPE_CODE (COLLECTION_TYPE_CODE, LABEL, DESCRIPTION, DISPLAY_ORDER, EFFECTIVE_DATE, - EXPIRY_DATE, OPEN_DATE, CLOSE_DATE, CREATE_USER, CREATE_DATE, - UPDATE_USER, UPDATE_DATE) -VALUES ('FEBRUARY', 'February', 'February collection', '10', TO_DATE('20230210', 'YYYYMMDD'), - TO_DATE('99991231', 'YYYYMMDD'), TO_DATE('20230201', 'YYYYMMDD'), - TO_DATE('20230307', 'YYYYMMDD'), 'API_STUDENT_DATA_COLLECTION', - TO_DATE('20230210', 'YYYYMMDD'), - 'API_STUDENT_DATA_COLLECTION', TO_DATE('20230210', 'YYYYMMDD')); - -INSERT INTO COLLECTION_TYPE_CODE (COLLECTION_TYPE_CODE, LABEL, DESCRIPTION, DISPLAY_ORDER, EFFECTIVE_DATE, - EXPIRY_DATE, OPEN_DATE, CLOSE_DATE, CREATE_USER, CREATE_DATE, - UPDATE_USER, UPDATE_DATE) -VALUES ('MAY', 'May', 'May collection', '10', TO_DATE('20230210', 'YYYYMMDD'), - TO_DATE('99991231', 'YYYYMMDD'), TO_DATE('20230501', 'YYYYMMDD'), - TO_DATE('20230530', 'YYYYMMDD'), 'API_STUDENT_DATA_COLLECTION', - TO_DATE('20230210', 'YYYYMMDD'), - 'API_STUDENT_DATA_COLLECTION', TO_DATE('20230210', 'YYYYMMDD')); - -INSERT INTO COLLECTION_TYPE_CODE (COLLECTION_TYPE_CODE, LABEL, DESCRIPTION, DISPLAY_ORDER, EFFECTIVE_DATE, - EXPIRY_DATE, OPEN_DATE, CLOSE_DATE, CREATE_USER, CREATE_DATE, - UPDATE_USER, UPDATE_DATE) -VALUES ('JUNE', 'June', 'June collection', '10', TO_DATE('20230210', 'YYYYMMDD'), - TO_DATE('99991231', 'YYYYMMDD'), TO_DATE('20230601', 'YYYYMMDD'), - TO_DATE('20230630', 'YYYYMMDD'), 'API_STUDENT_DATA_COLLECTION', - TO_DATE('20230210', 'YYYYMMDD'), - 'API_STUDENT_DATA_COLLECTION', TO_DATE('20230210', 'YYYYMMDD')); - -INSERT INTO COLLECTION_TYPE_CODE (COLLECTION_TYPE_CODE, LABEL, DESCRIPTION, DISPLAY_ORDER, EFFECTIVE_DATE, - EXPIRY_DATE, OPEN_DATE, CLOSE_DATE, CREATE_USER, CREATE_DATE, - UPDATE_USER, UPDATE_DATE) -VALUES ('JULY', 'July', 'July Collection', '10', TO_DATE('20230210', 'YYYYMMDD'), - TO_DATE('99991231', 'YYYYMMDD'), TO_DATE('20230707', 'YYYYMMDD'), - TO_DATE('20230730', 'YYYYMMDD'), 'API_STUDENT_DATA_COLLECTION', - TO_DATE('20230210', 'YYYYMMDD'), - 'API_STUDENT_DATA_COLLECTION', TO_DATE('20230210', 'YYYYMMDD')); - -CREATE TABLE COLLECTION -as -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as COLLECTION_ID, - (SELECT COLLECTION_TYPE_CODE FROM COLLECTION_TYPE_CODE ctc - WHERE TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD')),2,'0') || LPAD(EXTRACT(DAY FROM TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD')),2,'0'), 'YYYYMMDD') - BETWEEN TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM ctc.OPEN_DATE),2,'0') || LPAD(EXTRACT(DAY FROM ctc.OPEN_DATE),2,'0'), 'YYYYMMDD') - AND TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM ctc.CLOSE_DATE),2,'0') || LPAD(EXTRACT(DAY FROM ctc.CLOSE_DATE),2,'0'), 'YYYYMMDD')) AS COLLECTION_TYPE_CODE, - TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD') as OPEN_DATE, - (SELECT TO_DATE(EXTRACT(YEAR FROM TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD')) || LPAD(EXTRACT(MONTH FROM ctc.CLOSE_DATE),2,'0') || LPAD(EXTRACT(DAY FROM ctc.CLOSE_DATE),2,'0'),'YYYYMMDD') FROM COLLECTION_TYPE_CODE ctc - WHERE TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD')),2,'0') || LPAD(EXTRACT(DAY FROM TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD')),2,'0'), 'YYYYMMDD') - BETWEEN TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM ctc.OPEN_DATE),2,'0') || LPAD(EXTRACT(DAY FROM ctc.OPEN_DATE),2,'0'), 'YYYYMMDD') - AND TO_DATE('1900' || LPAD(EXTRACT(MONTH FROM ctc.CLOSE_DATE),2,'0') || LPAD(EXTRACT(DAY FROM ctc.CLOSE_DATE),2,'0'), 'YYYYMMDD')) as CLOSE_DATE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM STUDENT sld_student -GROUP BY REPORT_DATE; - -CREATE TABLE SDC_SCHOOL_COLLECTION -as -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SDC_SCHOOL_COLLECTION_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT dist.DISTRICT_ID from DISTRICT dist WHERE dist.DISTRICT_NUMBER = SUBSTR( sld_student.DISTNO||'' ||SCHLNO, 0 , 3)) as DISTRICT_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE SUBSTR( DISTNO||'' ||SCHLNO, 4) = schl.SCHOOL_NUMBER AND SUBSTR( sld_student.DISTNO||'' ||SCHLNO, 0 , 3) = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - 'COMPLETED' AS SDC_SCHOOL_COLLECTION_STATUS_CODE, - TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD') AS UPLOAD_DATE, - 'NOT_AVAILABLE' AS UPLOAD_FILE_NAME, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM STUDENT sld_student -GROUP BY DISTNO||'' ||SCHLNO, REPORT_DATE; - -CREATE TABLE SDC_SCHOOL_COLLECTION_HISTORY -as -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SDC_SCHOOL_COLLECTION_HISTORY_ID, - sdc.* -FROM SDC_SCHOOL_COLLECTION sdc; - -CREATE INDEX SDC_SCHOOL_COLLECTION_COLLECTION_ID_INDX -ON SDC_SCHOOL_COLLECTION(COLLECTION_ID); - -CREATE INDEX SDC_SCHOOL_COLLECTION_SCHOOL_ID_INDX -ON SDC_SCHOOL_COLLECTION(SCHOOL_ID); - -CREATE TABLE SDC_STUDENT_ELL -AS -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SDC_STUDENT_ELL_ID, - (SELECT LOWER(REGEXP_REPLACE(STUDENT_ID, '(.{8})(.{4})(.{4})(.{4})(.*)', '\1-\2-\3-\4-\5')) - FROM STUDENT_LINK stud_link - WHERE stud_link.PEN = TRIM(sld_student.PEN)) AS STUDENT_ID, - sld_student.ESL_YRS AS YEARS_IN_ELL, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -from STUDENT sld_student -WHERE sld_student.ESL_YRS IS NOT NULL -AND sld_student.ESL_YRS != 0 -order by row_number() over (partition by sld_student.PEN order by ESL_YRS desc) -fetch first 1 row with ties; - -CREATE TABLE SDC_SCHOOL_COLLECTION_STUDENT -as -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SDC_SCHOOL_COLLECTION_STUDENT_ID, - (SELECT sdc_coll.SDC_SCHOOL_COLLECTION_ID - FROM SDC_SCHOOL_COLLECTION sdc_coll, COLLECTION coll - WHERE sdc_coll.COLLECTION_ID = coll.COLLECTION_ID - AND sdc_coll.SCHOOL_ID = (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE SUBSTR( DISTNO||'' ||SCHLNO, 4) = schl.SCHOOL_NUMBER AND SUBSTR( sld_student.DISTNO||'' ||SCHLNO, 0 , 3) = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) - AND TO_DATE(sld_student.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS SDC_SCHOOL_COLLECTION_ID, - 'VERIFIED' AS SDC_SCHOOL_COLLECTION_STUDENT_STATUS_CODE, - TRIM(sld_student.LOCAL_STUDENT_ID) AS LOCAL_ID, - TRIM(sld_student.PEN) AS STUDENT_PEN, - TRIM(sld_student.LEGAL_GIVEN_NAME) AS LEGAL_FIRST_NAME, - TRIM(sld_student.LEGAL_MIDDLE_NAME) AS LEGAL_MIDDLE_NAMES, - TRIM(sld_student.LEGAL_SURNAME) AS LEGAL_LAST_NAME, - TRIM(sld_student.USUAL_GIVEN_NAME) AS USUAL_FIRST_NAME, - TRIM(sld_student.USUAL_MIDDLE_NAME) AS USUAL_MIDDLE_NAMES, - TRIM(sld_student.USUAL_SURNAME) AS USUAL_LAST_NAME, - TRIM(sld_student.BIRTH_DATE) AS DOB, - TRIM(sld_student.SEX) AS GENDER_CODE, - TRIM(sld_student.SPED_CAT) AS SPECIAL_EDUCATION_CATEGORY_CODE, - TRIM(sld_student.SCHOOL_FUNDING_CODE) AS SCHOOL_FUNDING_CODE, - TRIM(sld_student.NATIVE_ANCESTRY_IND) AS NATIVE_ANCESTRY_IND, - TRIM(sld_student.HOME_LANGUAGE_SPOKEN) AS HOME_LANGUAGE_SPOKEN_CODE, - TRIM(sld_student.OTHER_COURSES) AS OTHER_COURSES, - TRIM(sld_student.NUMBER_OF_SUPPORT_BLOCKS) AS SUPPORT_BLOCKS, - TRIM(sld_student.ENROLLED_GRADE_CODE) AS ENROLLED_GRADE_CODE, - (SELECT LISTAGG(stud_prog.ENROLLED_PROGRAM_CODE, '') WITHIN GROUP (ORDER BY 1) - FROM STUDENT_PROGRAMS stud_prog - WHERE stud_prog.REPORT_DATE = sld_student.REPORT_DATE - AND stud_prog.PEN = sld_student.PEN - AND sld_student.DISTNO = STUD_PROG.DISTNO - AND sld_student.SCHLNO = STUD_PROG.SCHLNO - GROUP BY PEN) AS ENROLLED_PROGRAM_CODES, - (SELECT CAREER_PROGRAM - FROM STUDENT_PROGRAMS stud_prog - WHERE stud_prog.REPORT_DATE = sld_student.REPORT_DATE - AND stud_prog.PEN = sld_student.PEN - AND sld_student.DISTNO = STUD_PROG.DISTNO - AND sld_student.SCHLNO = STUD_PROG.SCHLNO - AND CAREER_PROGRAM IS NOT NULL - AND CAREER_PROGRAM != ' ') AS CAREER_PROGRAM_CODE, - TRIM(sld_student.NUMBER_OF_COURSES) AS NUMBER_OF_COURSES, - TRIM(sld_student.BAND_CODE) AS BAND_CODE, - TRIM(sld_student.POSTAL) AS POSTAL_CODE, - TRIM(sld_student.PEN) AS ASSIGNED_PEN, - (SELECT LOWER(REGEXP_REPLACE(STUDENT_ID, '(.{8})(.{4})(.{4})(.{4})(.*)', '\1-\2-\3-\4-\5')) - FROM STUDENT_LINK stud_link - WHERE stud_link.PEN = TRIM(sld_student.PEN)) AS ASSIGNED_STUDENT_ID, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM STUDENT sld_student; - -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET LOCAL_ID = replace(LOCAL_ID, unistr('\0000')) WHERE instr(LOCAL_ID, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET STUDENT_PEN = replace(STUDENT_PEN, unistr('\0000')) WHERE instr(STUDENT_PEN, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET LEGAL_FIRST_NAME = replace(LEGAL_FIRST_NAME, unistr('\0000')) WHERE instr(LEGAL_FIRST_NAME, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET LEGAL_MIDDLE_NAMES = replace(LEGAL_MIDDLE_NAMES, unistr('\0000')) WHERE instr(LEGAL_MIDDLE_NAMES, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET LEGAL_LAST_NAME = replace(LEGAL_LAST_NAME, unistr('\0000')) WHERE instr(LEGAL_LAST_NAME, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET USUAL_FIRST_NAME = replace(USUAL_FIRST_NAME, unistr('\0000')) WHERE instr(USUAL_FIRST_NAME, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET USUAL_MIDDLE_NAMES = replace(USUAL_MIDDLE_NAMES, unistr('\0000')) WHERE instr(USUAL_MIDDLE_NAMES, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET USUAL_LAST_NAME = replace(USUAL_LAST_NAME, unistr('\0000')) WHERE instr(USUAL_LAST_NAME, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET DOB = replace(DOB, unistr('\0000')) WHERE instr(DOB, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET GENDER_CODE = replace(GENDER_CODE, unistr('\0000')) WHERE instr(GENDER_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET SPECIAL_EDUCATION_CATEGORY_CODE = replace(SPECIAL_EDUCATION_CATEGORY_CODE, unistr('\0000')) WHERE instr(SPECIAL_EDUCATION_CATEGORY_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET SCHOOL_FUNDING_CODE = replace(SCHOOL_FUNDING_CODE, unistr('\0000')) WHERE instr(SCHOOL_FUNDING_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET NATIVE_ANCESTRY_IND = replace(NATIVE_ANCESTRY_IND, unistr('\0000')) WHERE instr(NATIVE_ANCESTRY_IND, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET HOME_LANGUAGE_SPOKEN_CODE = replace(HOME_LANGUAGE_SPOKEN_CODE, unistr('\0000')) WHERE instr(HOME_LANGUAGE_SPOKEN_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET OTHER_COURSES = replace(OTHER_COURSES, unistr('\0000')) WHERE instr(OTHER_COURSES, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET SUPPORT_BLOCKS = replace(SUPPORT_BLOCKS, unistr('\0000')) WHERE instr(SUPPORT_BLOCKS, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET ENROLLED_GRADE_CODE = replace(ENROLLED_GRADE_CODE, unistr('\0000')) WHERE instr(ENROLLED_GRADE_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET ENROLLED_PROGRAM_CODES = replace(ENROLLED_PROGRAM_CODES, unistr('\0000')) WHERE instr(ENROLLED_PROGRAM_CODES, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET CAREER_PROGRAM_CODE = replace(CAREER_PROGRAM_CODE, unistr('\0000')) WHERE instr(CAREER_PROGRAM_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET NUMBER_OF_COURSES = replace(NUMBER_OF_COURSES, unistr('\0000')) WHERE instr(NUMBER_OF_COURSES, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET BAND_CODE = replace(BAND_CODE, unistr('\0000')) WHERE instr(BAND_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET POSTAL_CODE = replace(POSTAL_CODE, unistr('\0000')) WHERE instr(POSTAL_CODE, unistr('\0000')) > 0; -UPDATE SDC_SCHOOL_COLLECTION_STUDENT SET ASSIGNED_PEN = replace(ASSIGNED_PEN, unistr('\0000')) WHERE instr(ASSIGNED_PEN, unistr('\0000')) > 0; - -drop index sdc_coll_student_sdc_school_collection_student_status_code_idx; -drop index sdc_coll_student_sdc_school_collection_id_idx; -CREATE INDEX sdc_coll_student_sdc_school_collection_student_status_code_idx ON api_student_data_collection.sdc_school_collection_student USING btree (sdc_school_collection_student_status_code); -CREATE INDEX sdc_coll_student_sdc_school_collection_id_idx ON api_student_data_collection.sdc_school_collection_student USING btree (sdc_school_collection_id); - diff --git a/api/src/main/resources/scripts/SPM_Migration_3 - Independent School Funding Groups.sql b/api/src/main/resources/scripts/SPM_Migration_3 - Independent School Funding Groups.sql deleted file mode 100644 index 5126cb80..00000000 --- a/api/src/main/resources/scripts/SPM_Migration_3 - Independent School Funding Groups.sql +++ /dev/null @@ -1,494 +0,0 @@ -CREATE TABLE INDEPENDENT_SCHOOL_FUNDING_GROUP -( - SCHOOL_FUNDING_GROUP_ID VARCHAR(255) NOT NULL, - SCHOOL_ID VARCHAR(255) NOT NULL, - SCHOOL_GRADE_CODE VARCHAR(10) NOT NULL, - SCHOOL_FUNDING_GROUP_CODE VARCHAR(10) NOT NULL, - CREATE_USER VARCHAR(32) NOT NULL, - CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - UPDATE_USER VARCHAR(32) NOT NULL, - UPDATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - CONSTRAINT SCHOOL_FUNDING_GROUP_ID_PK PRIMARY KEY (SCHOOL_FUNDING_GROUP_ID) -); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'KH') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '01' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'KF') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '01' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '01') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '01' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '02') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '01' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '03') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '01' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '04') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '04' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '05') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '04' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '06') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '04' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '07') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '04' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'EU') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '04' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '08') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '08' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '09') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '08' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '10') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '08' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'SU') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '08' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '11') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '11' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP (SCHOOL_FUNDING_GROUP_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE fund_mast.SCHLNO = schl.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '12') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = fund_mast.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_MASTER fund_mast, SCHOOL schl_table -WHERE fund_mast.FUNDING_GROUP_SUBCODE = '11' -AND fund_mast.SCHLNO = schl_table.SCHOOL_NUMBER AND fund_mast.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID); - -CREATE TABLE INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT -as -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'KH') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '01' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'KF') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '01' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '01') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '01' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '02') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '01' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '03') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '01' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '04') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '04' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '05') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '04' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '06') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '04' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '07') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '04' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'EU') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '04' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '08') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '08' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '09') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '08' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '10') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '08' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = 'SU') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '08' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '11') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '11' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD'); - - -INSERT INTO INDEPENDENT_SCHOOL_FUNDING_GROUP_SNAPSHOT (SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, COLLECTION_ID, SCHOOL_ID, SCHOOL_GRADE_CODE, SCHOOL_FUNDING_GROUP_CODE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE) -SELECT - LOWER(REGEXP_REPLACE(dbms_crypto.randombytes(16), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5')) as SCHOOL_FUNDING_GROUP_SNAPSHOT_ID, - (SELECT COLLECTION_ID FROM COLLECTION coll WHERE TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') BETWEEN coll.OPEN_DATE AND coll.CLOSE_DATE) AS COLLECTION_ID, - (SELECT schl.SCHOOL_ID from SCHOOL schl WHERE sfc.SCHLNO = schl.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl.DISTRICT_ID = dist.DISTRICT_ID)) as SCHOOL_ID, - (SELECT grade_code_tbl.SCHOOL_GRADE_CODE from SCHOOL_GRADE_CODE grade_code_tbl where grade_code_tbl.LEGACY_CODE = '12') as SCHOOL_GRADE_CODE, - (SELECT fund_code_tbl.SCHOOL_FUNDING_GROUP_CODE from SCHOOL_FUNDING_GROUP_CODE fund_code_tbl where fund_code_tbl.LEGACY_CODE = sfc.FUNDING_GROUP_CODE) as SCHOOL_FUNDING_GROUP_CODE, - 'SPM_MIGRATION' as CREATE_USER, - sysdate as CREATE_DATE, - 'SPM_MIGRATION' as UPDATE_USER, - sysdate as UPDATE_DATE -FROM SCHOOL_FUNDING_CENSUS sfc, SCHOOL schl_table -WHERE sfc.FUNDING_GROUP_SUBCODE = '11' -AND sfc.SCHLNO = schl_table.SCHOOL_NUMBER AND sfc.DISTNO = (SELECT dist.DISTRICT_NUMBER from DISTRICT dist WHERE schl_table.DISTRICT_ID = dist.DISTRICT_ID) -AND TO_DATE(sfc.REPORT_DATE,'YYYYMMDD') < TO_DATE('CHANGEME','YYYYMMDD');