963: WHERE period_type = x_period_type
964: AND org_id = x_org_id;
965: CURSOR c2 IS
966: SELECT period_set_id
967: FROM cn_period_sets
968: WHERE period_set_name = x_period_set_name
969: AND org_id = x_org_id;
970:
971: l_period_set_id NUMBER;
1010: x_org_id);
1011: END IF;
1012: CLOSE c1;
1013:
1014: -- get the period_set_id from cn_period_sets.
1015: -- if there is no matching record, create one
1016: OPEN c2;
1017: FETCH c2 INTO x_period_set_id;
1018:
1016: OPEN c2;
1017: FETCH c2 INTO x_period_set_id;
1018:
1019: IF (c2%NOTFOUND) THEN
1020: SELECT cn_period_sets_s.NEXTVAL
1021: INTO x_period_set_id
1022: FROM dual;
1023: INSERT INTO cn_period_sets
1024: (period_set_id,
1019: IF (c2%NOTFOUND) THEN
1020: SELECT cn_period_sets_s.NEXTVAL
1021: INTO x_period_set_id
1022: FROM dual;
1023: INSERT INTO cn_period_sets
1024: (period_set_id,
1025: period_set_name,
1026: org_id)
1027: VALUES