Skip to content

Instantly share code, notes, and snippets.

@master-bob
Created August 18, 2016 19:52
Show Gist options
  • Select an option

  • Save master-bob/e57b7a6f4cd3dd7d828cc3860e56ebb8 to your computer and use it in GitHub Desktop.

Select an option

Save master-bob/e57b7a6f4cd3dd7d828cc3860e56ebb8 to your computer and use it in GitHub Desktop.
Oracle PL/SQL Create Samigo metadata, WIP - doesn't work ...
set serveroutput on;
DECLARE
CURSOR c1 IS SELECT DISTINCT ASSESSMENTID FROM SAM_PUBLISHEDMETADATA_T;
CURSOR c2(p_ass_id in NUMBER) is SELECT LABEL FROM SAM_PUBLISHEDMETADATA_T WHERE ASSESSMENTID = p_ass_id;
l_found NUMBER(1);
total NUMBER(38);
found NUMBER(38);
BEGIN
total := 0;
found := 0;
FOR ass_id IN c1 LOOP
total := total + 1;
l_found := 0;
FOR r2 in c2(ass_id.ASSESSMENTID) LOOP
IF 'instructorNotification_isInstructorEditable' = r2.LABEL THEN
l_found := 1;
found := found +1;
END IF;
END LOOP;
if(l_found = 0) THEN
INSERT INTO SAM_PUBLISHEDMETADATA_T (ASSESSMENTMETADATAID,ASSESSMENTID, LABEL, ENTRY) VALUES (SAM_PUBLISHEDMETADATA_ID_S.NEXTVAL, ass_id.ASSESSMENTID,'instructorNotification_isInstructorEditable','true');
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Total:');
DBMS_OUTPUT.PUT_LINE(total);
DBMS_OUTPUT.PUT_LINE('Found:');
DBMS_OUTPUT.PUT_LINE(found);
END;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment