[Home] [Help]
287: or
288: (nvl(x_old_proj_start_org_id,x_new_proj_start_org_id +1) <> x_new_proj_start_org_id )
289: ) then
290:
291: insert into pa_all_organizations
292: (organization_id,
293: org_id,
294: pa_org_use_type )
295: ( (select se.organization_id_child
323: minus
324: (select organization_id,
325: org_id,
326: pa_org_use_type
327: from pa_all_organizations
328: where pa_org_use_type = 'PROJECTS'
329: and org_id = x_org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
330: )
331: );
397: or
398: (nvl(x_old_exp_start_org_id,x_new_exp_start_org_id +1) <> x_new_exp_start_org_id )
399: ) then
400:
401: insert into pa_all_organizations
402: (organization_id,
403: org_id,
404: pa_org_use_type)
405: ( (select se.organization_id_child
433: minus
434: (select organization_id,
435: org_id,
436: pa_org_use_type
437: from pa_all_organizations
438: where pa_org_use_type = 'EXPENDITURES'
439: and org_id = x_org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
440: )
441: );
879:
880: IF org_exists_flag = TRUE THEN
881: /* Bug 2139709 End */
882:
883: insert into pa_all_organizations
884: (organization_id,
885: org_id,
886: pa_org_use_type)
887: (select
896: and info.org_information_context||'' = 'CLASS'
897: and info.org_information2 = 'Y')
898: and not exists
899: (select 'X'
900: from pa_all_organizations
901: where organization_id = x_organization_id_child
902: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
903: and pa_org_use_type = 'PROJECTS')
904: ) ;
904: ) ;
905:
906: /* Added for bug 1550990 */
907: if(sql%rowcount=0) then
908: Update pa_all_organizations
909: set inactive_date = NULL
910: where organization_id = x_organization_id_child
911: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
912: and pa_org_use_type = 'PROJECTS'
991:
992: IF org_exists_flag = TRUE THEN
993: /* Bug 2139709 End */
994:
995: insert into pa_all_organizations
996: (organization_id,
997: org_id,
998: pa_org_use_type)
999: (select
1008: and info.org_information_context||'' = 'CLASS'
1009: and info.org_information2 = 'Y')
1010: and not exists
1011: (select 'X'
1012: from pa_all_organizations
1013: where organization_id = x_organization_id_child
1014: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1015: and pa_org_use_type = 'EXPENDITURES')
1016: ) ;
1016: ) ;
1017:
1018: /* Added for bug 1550990 */
1019: if(sql%rowcount=0) then
1020: Update pa_all_organizations
1021: set inactive_date=NULL
1022: where organization_id =x_organization_id_child
1023: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1024: and pa_org_use_type = 'EXPENDITURES'
1156: where proj_org_structure_version_id = x_org_version_id
1157: )
1158:
1159: loop
1160: update pa_all_organizations
1161: set inactive_date = trunc(sysdate)
1162: where organization_id = x_organization_id_child
1163: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1164: and pa_org_use_type = 'PROJECTS'
1172: from pa_implementations_all imp
1173: where exp_org_structure_version_id = x_org_version_id
1174: )
1175: loop
1176: update pa_all_organizations
1177: set inactive_date = trunc(sysdate)
1178: where organization_id = x_organization_id_child
1179: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1180: and pa_org_use_type = 'EXPENDITURES'
1310: IF(v_start_org_id <> x_organization_id) THEN --made changes as Suggested
1311: open check_org_exists;
1312: fetch check_org_exists into v_org_child_id;
1313: if check_org_exists%found then /* Added org is below the start project org */
1314: insert into pa_all_organizations
1315: (organization_id,
1316: org_id,
1317: pa_org_use_type)
1318: (select x_organization_id,
1318: (select x_organization_id,
1319: imp_rec.org_id, 'PROJECTS'
1320: from sys.dual
1321: where not exists ( select 'X'
1322: from pa_all_organizations
1323: where organization_id = x_organization_id
1324: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1325: and pa_org_use_type = 'PROJECTS' ));
1326:
1326:
1327: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1328: ---- Earlier, IN This case set inactive_date to
1329: --- NULL.
1330: update pa_all_organizations
1331: set inactive_date = null
1332: where organization_id = x_organization_id
1333: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1334: and pa_org_use_type = 'PROJECTS' ;
1351: end if;
1352: close check_org_exists;
1353: ELSE
1354: ---- If Current Organization is Start Organizations then Record has to be
1355: ---- Created in PA_ALL_ORGANIZATIONS.
1356: insert into pa_all_organizations
1357: (organization_id,
1358: org_id,
1359: pa_org_use_type)
1352: close check_org_exists;
1353: ELSE
1354: ---- If Current Organization is Start Organizations then Record has to be
1355: ---- Created in PA_ALL_ORGANIZATIONS.
1356: insert into pa_all_organizations
1357: (organization_id,
1358: org_id,
1359: pa_org_use_type)
1360: (select x_organization_id,
1360: (select x_organization_id,
1361: imp_rec.org_id, 'PROJECTS'
1362: from sys.dual
1363: where not exists ( select 'X'
1364: from pa_all_organizations
1365: where organization_id = x_organization_id
1366: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1367: and pa_org_use_type = 'PROJECTS' ));
1368: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1367: and pa_org_use_type = 'PROJECTS' ));
1368: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1369: ---- Earlier, IN This case set inactive_date to
1370: --- NULL.
1371: update pa_all_organizations
1372: set inactive_date = null
1373: where organization_id = x_organization_id
1374: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1375: and pa_org_use_type = 'PROJECTS' ;
1390: org_id
1391: from pa_implementations_all )
1392: loop
1393:
1394: update pa_all_organizations
1395: set inactive_date = trunc(sysdate)
1396: where organization_id = x_organization_id
1397: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1398: and pa_org_use_type = 'PROJECTS'
1431: IF(v_start_org_id<>x_organization_id) THEN
1432: open check_org_exists;
1433: fetch check_org_exists into v_org_child_id;
1434: if check_org_exists%found then /* Added org is below the start project org */
1435: insert into pa_all_organizations
1436: (organization_id,
1437: org_id,
1438: pa_org_use_type)
1439: (select x_organization_id,
1439: (select x_organization_id,
1440: imp_rec.org_id, 'EXPENDITURES'
1441: from sys.dual
1442: where not exists ( select 'X'
1443: from pa_all_organizations
1444: where organization_id = x_organization_id
1445: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1446: and pa_org_use_type = 'EXPENDITURES' ));
1447:
1447:
1448: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1449: ---- Earlier, IN This case set inactive_date to
1450: --- NULL.
1451: update pa_all_organizations
1452: set inactive_date = null
1453: where organization_id = x_organization_id
1454: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1455: and pa_org_use_type = 'EXPENDITURES' ;
1471: end if;
1472: close check_org_exists;
1473: ELSE
1474: ---- If Current Organization is Start Organizations then Record has to be
1475: ---- Created in PA_ALL_ORGANIZATIONS.
1476: insert into pa_all_organizations
1477: (organization_id,
1478: org_id,
1479: pa_org_use_type)
1472: close check_org_exists;
1473: ELSE
1474: ---- If Current Organization is Start Organizations then Record has to be
1475: ---- Created in PA_ALL_ORGANIZATIONS.
1476: insert into pa_all_organizations
1477: (organization_id,
1478: org_id,
1479: pa_org_use_type)
1480: (select x_organization_id,
1480: (select x_organization_id,
1481: imp_rec.org_id, 'EXPENDITURES'
1482: from sys.dual
1483: where not exists ( select 'X'
1484: from pa_all_organizations
1485: where organization_id = x_organization_id
1486: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1487: and pa_org_use_type = 'EXPENDITURES' ));
1488: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1487: and pa_org_use_type = 'EXPENDITURES' ));
1488: if sql%rowcount = 0 then --- Means Row was not inserted as it was there
1489: ---- Earlier, IN This case set inactive_date to
1490: --- NULL.
1491: update pa_all_organizations
1492: set inactive_date = null
1493: where organization_id = x_organization_id
1494: and org_id = imp_rec.org_id--MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1495: and pa_org_use_type = 'EXPENDITURES' ;
1510: org_id
1511: from pa_implementations_all )
1512: loop
1513:
1514: update pa_all_organizations
1515: set inactive_date = trunc(sysdate)
1516: where organization_id = x_organization_id
1517: and org_id = imp_rec.org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1518: and pa_org_use_type = 'EXPENDITURES'
1628: /* Update all Organizations (Projects or Expenditures)
1629: in the old hierarchy with inactive date as Sysdate.
1630: Union is to include the start organization id in the update */
1631:
1632: UPDATE pa_all_organizations
1633: SET Inactive_Date = TRUNC(SYSDATE)
1634: WHERE Pa_Org_Use_Type = x_org_use_type
1635: AND Org_id = x_Org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1636: AND Organization_id = rec_all_old_org.organization_id
1636: AND Organization_id = rec_all_old_org.organization_id
1637: and inactive_date is null ; -- Bug Ref # 6367868
1638:
1639: /* In case there are no corresponding records for the new
1640: Organization hierarchy in the Pa_all_Organizations, then,
1641: create these records in the Pa_All_Organizations
1642: with Inactive_Date as SYSDATE */
1643:
1644: IF SQL%NOTFOUND THEN
1637: and inactive_date is null ; -- Bug Ref # 6367868
1638:
1639: /* In case there are no corresponding records for the new
1640: Organization hierarchy in the Pa_all_Organizations, then,
1641: create these records in the Pa_All_Organizations
1642: with Inactive_Date as SYSDATE */
1643:
1644: IF SQL%NOTFOUND THEN
1645: INSERT INTO Pa_All_Organizations
1641: create these records in the Pa_All_Organizations
1642: with Inactive_Date as SYSDATE */
1643:
1644: IF SQL%NOTFOUND THEN
1645: INSERT INTO Pa_All_Organizations
1646: (organization_id,
1647: org_id,
1648: pa_org_use_type,
1649: inactive_date)
1663: /* Update all Organizations (Expenditures)
1664: in the new hierarchy with inactive date as NULL.
1665: Union is to include the start organization id in the update */
1666:
1667: UPDATE pa_all_organizations
1668: SET Inactive_Date = NULL
1669: WHERE Pa_Org_Use_Type = x_org_use_type
1670: AND Org_id = x_Org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1671: AND Organization_id = rec_exp_new_org.organization_id;
1670: AND Org_id = x_Org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1671: AND Organization_id = rec_exp_new_org.organization_id;
1672:
1673: /* In case there are no corresponding records for the new
1674: Organization hierarchy in the Pa_all_Organizations, then,
1675: create these records in the Pa_All_Organizations
1676: with Inactive_Date as NULL */
1677:
1678: IF SQL%NOTFOUND THEN
1671: AND Organization_id = rec_exp_new_org.organization_id;
1672:
1673: /* In case there are no corresponding records for the new
1674: Organization hierarchy in the Pa_all_Organizations, then,
1675: create these records in the Pa_All_Organizations
1676: with Inactive_Date as NULL */
1677:
1678: IF SQL%NOTFOUND THEN
1679: INSERT INTO Pa_All_Organizations
1675: create these records in the Pa_All_Organizations
1676: with Inactive_Date as NULL */
1677:
1678: IF SQL%NOTFOUND THEN
1679: INSERT INTO Pa_All_Organizations
1680: (organization_id,
1681: org_id,
1682: pa_org_use_type,
1683: inactive_date)
1700: /* Update all Organizations (Projects)
1701: in the new hierarchy with inactive date as NULL.
1702: Union is to include the start organization id in the update */
1703:
1704: UPDATE pa_all_organizations
1705: SET Inactive_Date = NULL
1706: WHERE Pa_Org_Use_Type = x_org_use_type
1707: AND Org_id = x_Org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1708: AND Organization_id = rec_proj_new_org.organization_id;
1707: AND Org_id = x_Org_id --MOAC Changes: Bug 4363092: Removed nvl usage with org_id
1708: AND Organization_id = rec_proj_new_org.organization_id;
1709:
1710: /* In case there are no corresponding records for the new
1711: Organization hierarchy in the Pa_all_Organizations, then,
1712: create these records in the Pa_All_Organizations
1713: with Inactive_Date as NULL */
1714:
1715: IF SQL%NOTFOUND THEN
1708: AND Organization_id = rec_proj_new_org.organization_id;
1709:
1710: /* In case there are no corresponding records for the new
1711: Organization hierarchy in the Pa_all_Organizations, then,
1712: create these records in the Pa_All_Organizations
1713: with Inactive_Date as NULL */
1714:
1715: IF SQL%NOTFOUND THEN
1716: INSERT INTO Pa_All_Organizations
1712: create these records in the Pa_All_Organizations
1713: with Inactive_Date as NULL */
1714:
1715: IF SQL%NOTFOUND THEN
1716: INSERT INTO Pa_All_Organizations
1717: (organization_id,
1718: org_id,
1719: pa_org_use_type,
1720: inactive_date)
3524: END maintain_projexp_org_update;
3525:
3526:
3527: /* Bug 5934849 - This procedure will be called for maintaining project and expenditure
3528: data in pa_all_organizations table. */
3529:
3530: Procedure maintain_pa_all_org(x_org_version_id in number,
3531: x_err_code in out NOCOPY number,
3532: x_err_stage in out NOCOPY varchar2,
3595: loop
3596: v_start_org_id := imp_rec.proj_start_org_id;
3597: v_org_id := imp_rec.org_id;
3598:
3599: UPDATE pa_all_organizations
3600: SET Inactive_Date = TRUNC(SYSDATE)
3601: WHERE Pa_Org_Use_Type = 'PROJECTS'
3602: AND NVL(Org_id, -99) = NVL(v_org_id, -99);
3603:
3606: /* Update all Organizations (Projects)
3607: in the hierarchy with inactive date as NULL.
3608: Union is to include the start organization id in the update */
3609:
3610: UPDATE pa_all_organizations
3611: SET Inactive_Date = NULL
3612: WHERE Pa_Org_Use_Type = 'PROJECTS'
3613: AND NVL(Org_id, -99) = NVL(v_org_id, -99)
3614: AND Organization_id = rec_proj_new_org.organization_id;
3613: AND NVL(Org_id, -99) = NVL(v_org_id, -99)
3614: AND Organization_id = rec_proj_new_org.organization_id;
3615:
3616: /* In case there are no corresponding records for the
3617: Organization hierarchy in the Pa_all_Organizations, then,
3618: create these records in the Pa_All_Organizations
3619: with Inactive_Date as NULL */
3620:
3621: IF SQL%NOTFOUND THEN
3614: AND Organization_id = rec_proj_new_org.organization_id;
3615:
3616: /* In case there are no corresponding records for the
3617: Organization hierarchy in the Pa_all_Organizations, then,
3618: create these records in the Pa_All_Organizations
3619: with Inactive_Date as NULL */
3620:
3621: IF SQL%NOTFOUND THEN
3622: INSERT INTO Pa_All_Organizations
3618: create these records in the Pa_All_Organizations
3619: with Inactive_Date as NULL */
3620:
3621: IF SQL%NOTFOUND THEN
3622: INSERT INTO Pa_All_Organizations
3623: (organization_id,
3624: org_id,
3625: pa_org_use_type,
3626: inactive_date)
3642: loop
3643: v_start_org_id := imp_rec.exp_start_org_id;
3644: v_org_id := imp_rec.org_id;
3645:
3646: UPDATE pa_all_organizations
3647: SET Inactive_Date = TRUNC(SYSDATE)
3648: WHERE Pa_Org_Use_Type = 'EXPENDITURES'
3649: AND NVL(Org_id, -99) = NVL(v_org_id, -99);
3650:
3653: /* Update all Organizations (Projects)
3654: in the hierarchy with inactive date as NULL.
3655: Union is to include the start organization id in the update */
3656:
3657: UPDATE pa_all_organizations
3658: SET Inactive_Date = NULL
3659: WHERE Pa_Org_Use_Type = 'EXPENDITURES'
3660: AND NVL(Org_id, -99) = NVL(v_org_id, -99)
3661: AND Organization_id = rec_exp_new_org.organization_id;
3660: AND NVL(Org_id, -99) = NVL(v_org_id, -99)
3661: AND Organization_id = rec_exp_new_org.organization_id;
3662:
3663: /* In case there are no corresponding records for the new
3664: Organization hierarchy in the Pa_all_Organizations, then,
3665: create these records in the Pa_All_Organizations
3666: with Inactive_Date as NULL */
3667:
3668: IF SQL%NOTFOUND THEN
3661: AND Organization_id = rec_exp_new_org.organization_id;
3662:
3663: /* In case there are no corresponding records for the new
3664: Organization hierarchy in the Pa_all_Organizations, then,
3665: create these records in the Pa_All_Organizations
3666: with Inactive_Date as NULL */
3667:
3668: IF SQL%NOTFOUND THEN
3669: INSERT INTO Pa_All_Organizations
3665: create these records in the Pa_All_Organizations
3666: with Inactive_Date as NULL */
3667:
3668: IF SQL%NOTFOUND THEN
3669: INSERT INTO Pa_All_Organizations
3670: (organization_id,
3671: org_id,
3672: pa_org_use_type,
3673: inactive_date)