Tractability - ModifiedBy and CreatedBy

Hi,
I have just started a new project, and, I have just discovered that the database implements a 'tractability' requirement whereby every table has "ModifiedBy"
and "CreatedBy" (and ModifiedWhen, CreatedWhen) columns for tracing changes to particular Users, as is standard practice.
However, the database designer has implemented this strictly such that these columns are associated to the User table by Foreign Key constraints.
Effectively, the entire database is connected to the User table by these constraints. And worse than that, there are two constraints per table.
When I approach the database with .NET EntityFramework I was confronted by a mass of associations that were meaningless in business terms.
After speaking with the database designer regarding my concerns, I was told that this was necessary to retain correct tracing information.
I can't see how this is acceptable. I thought that these columns are intended to facilitate concurrency, and tracing of sorts, but not strict tracing, as
it only traces the last user to make changes, which is of little help in data forensics anyway. And, I thought that heavy duty tracing ought to be conducted by Audit Tables using Triggers. 
Moreover, the User table is associated by those fields and constraints to ... yes, the User table. Consequently, the constraints must be dropped to
enter the first User record.
Am I wrong? Is the kind of 'tractability' described above acceptable data architecture?

 the database implements a 'tractability' requirement whereby every table has
"ModifiedBy" and "CreatedBy" (and ModifiedWhen, CreatedWhen) columns for tracing changes to particular Users, as is standard practice.
However, the database designer has implemented this strictly such that these columns are associated to the User table by Foreign Key constraints.
Effectively, the entire database is connected to the User table by these constraints. And worse than that, there are two constraints per table.
Those columns are the best friend of a DBA. Generally helpful in the short term since the previous update info overwritten by the last update info.
However, those are table maintenance columns therefore 3NF requirements do not apply typically.  If the system hw/sw platform robust enough, it can be implemented that way.
I would design it without the constraints and setup audit trail:
http://www.sqlusa.com/bestpractices2005/auditwithoutput/
Kalman Toth Database & OLAP Architect
Free T-SQL Scripts
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • Limitation of row and column in FR report

    Hi all,
    i want to know what is the maximum number of row and column that we can display in FR report.
    and is there any possibility to increase the number of row and column in FR reports,if yes then how?
    Thanks in advance.

    Hi Andy,
    I think your asking if this or something similar could be used to go to another page rather than as a popup? The answer is yes. since you have already done the decode in your query, you can just go to the Report Attributes tab (I'm using version 2.2.1.00.04) and click the edit button for the column. Then, you can simply go to the
    HTML Expression [Insert column value] text area and insert:
    <!--
    <b>#A#<b>
    This will give you everything that is in the column link section, but I find it easier to work with since it's all together (personal preference).
    I reread your post and realized that you wanted to pass the A as a value and not the summary value of the column. I simply removed the #'s. I think this should work. I also kept the summary value using the #A# as the link. I belive that you can copy and paste this into each column (replacing the A with the appropriate column header of course...).
    If I were doing this I might create a CASE statement in the query and evaluate for null before creating the link. Here is an example of using that approach:
    CASE WHEN "STATUS" = 'U' AND ("CREATEDBY"=:APP_USER OR :APP_USER='MY_USER')
    THEN ''
    || '<img src="#WORKSPACE_IMAGES#edit.gif" border="0" alt="Click here to Edit">'
    || ''
    ELSE ''
    END LINK,
    Neil

  • Merging Multiple Rows into a single Row

    I've read a number of posts with no real good answers or answers that might be good for tables with 3 columns of data. I have a table with 33 columns that will all need to be combined. A little history. Apparently in production the Primary Key Constraint
    was dropped which allowed some duplicate data into the table. Now they want me to squish the records together to fix it.
    Sorry I couldn't include the screen shot of the data, MSDN says my account isn't verified...
    My requirements when I'm putting them together, CERElibilityID is a unique column. This is a sticky problem because in the related tables it is only one of the parent records gets child records related to it.
     I just want to keep the one that has the child records in CERPrepActivity table. If there are no child records then the rule will be like all the other records with data. 
    If a  field is null and another record has data we take the record that has data.
    If multiple records have data we take the record that has the highest "ModifiedOn" timestamp column value.
    I feel like I'm asking a lot, but I'm in a bit of a bind and I've spent the morning Googling and have come up with nothing 
    Thank  you for any help the community can provide and the more specific you can be the better. I'm not a DBA or SQL guru by any stretch so I'm way out of my element.
    Thanks

    Using the systables, you can get information about your table. I put these together:
    SELECT '
    LEFT OUTER JOIN #CEREligibility ['+c.name+']
    ON s.caseID = ['+c.name+'].caseID
    AND s.modifiedOn = ['+c.name+'].modifiedOn
    AND ['+c.name+'].['+c.name+'] = (SELECT TOP 1 ['+c.name+'] FROM #CEREligibility WHERE caseID = s.caseID AND ['+c.name+'] IS NOT NULL ORDER BY ModifiedOn)
    AND ['+c.name+'].['+c.name+'] IS NOT NULL'
    FROM tempdb.sys.objects o
    INNER JOIN tempdb.sys.columns c
    ON o.object_id = c.object_id
    AND o.name LIKE '#CEREligibility%'
    SELECT '['+c.name+'].['+c.name+'] AS ['+c.name+'], '
    FROM tempdb.sys.objects o
    INNER JOIN tempdb.sys.columns c
    ON o.object_id = c.object_id
    AND o.name LIKE '#CEREligibility%'
    On my test system I created your table as a temp table named #CEREligibility.
    The first of these two queries generates LEFT OUT JOIN SQL for a self join. Because we're using the columns systable, a LOJ for each column is generated.
    The second, produces a select list.
    Putting the two together like so, and adding a FROM and GROUP BY gives us:
    SELECT
    MAX([CEREligibilityId].[CEREligibilityId]) AS [CEREligibilityId], s.[CaseId], MAX([M2Eligibility].[M2Eligibility]) AS [M2Eligibility], MAX([CDREligibility].[CDREligibility]) AS [CDREligibility], MAX([M2Comments].[M2Comments]) AS [M2Comments], MAX([M2CommentsRtf].[M2CommentsRtf]) AS [M2CommentsRtf], MAX([CDRComments].[CDRComments]) AS [CDRComments], MAX([CDRCommentsRtf].[CDRCommentsRtf]) AS [CDRCommentsRtf], MAX([RIAWA].[RIAWA]) AS [RIAWA], MAX([RIAWADate].[RIAWADate]) AS [RIAWADate], MAX([EducationAndTraining].[EducationAndTraining]) AS [EducationAndTraining], MAX([EducationAndTrainingDate].[EducationAndTrainingDate]) AS [EducationAndTrainingDate], MAX([Internship].[Internship]) AS [Internship], MAX([InternshipDate].[InternshipDate]) AS [InternshipDate], MAX([Apprenticeship].[Apprenticeship]) AS [Apprenticeship], MAX([ApprenticeshipDate].[ApprenticeshipDate]) AS [ApprenticeshipDate], MAX([Entrepreneurship].[Entrepreneurship]) AS [Entrepreneurship], MAX([EntrepreneurshipDate].[EntrepreneurshipDate]) AS [EntrepreneurshipDate], MAX([EmploymentPrep].[EmploymentPrep]) AS [EmploymentPrep], MAX([EmploymentPrepDate].[EmploymentPrepDate]) AS [EmploymentPrepDate], MAX([OTPrep].[OTPrep]) AS [OTPrep], MAX([OTPrepDate].[OTPrepDate]) AS [OTPrepDate], MAX([ExitInterview].[ExitInterview]) AS [ExitInterview], MAX([ExitInterviewDate].[ExitInterviewDate]) AS [ExitInterviewDate], MAX([CreatedOn].[CreatedOn]) AS [CreatedOn], MAX([CreatedBy].[CreatedBy]) AS [CreatedBy], MAX([ModifiedOn].[ModifiedOn]) AS [ModifiedOn], MAX([ModifiedBy].[ModifiedBy]) AS [ModifiedBy], MAX([BCPermInEligibility].[BCPermInEligibility]) AS [BCPermInEligibility], MAX([CCPermInEligibility].[CCPermInEligibility]) AS [CCPermInEligibility], MAX([M2EligibilityDate].[M2EligibilityDate]) AS [M2EligibilityDate], MAX([CDREligibilityDate].[CDREligibilityDate]) AS [CDREligibilityDate], MAX([ExitSeparationCode].[ExitSeparationCode]) AS [ExitSeparationCode], MAX([ExitSeparationSubCode].[ExitSeparationSubCode]) AS [ExitSeparationSubCode]
    FROM #CEREligibility s
    LEFT OUTER JOIN #CEREligibility [CEREligibilityId]
    ON s.caseID = [CEREligibilityId].caseID
    AND s.modifiedOn = [CEREligibilityId].modifiedOn
    AND [CEREligibilityId].[CEREligibilityId] = (SELECT TOP 1 [CEREligibilityId] FROM #CEREligibility WHERE caseID = s.caseID AND [CEREligibilityId] IS NOT NULL ORDER BY ModifiedOn)
    AND [CEREligibilityId].[CEREligibilityId] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CaseId]
    ON s.caseID = [CaseId].caseID
    AND s.modifiedOn = [CaseId].modifiedOn
    AND [CaseId].[CaseId] = (SELECT TOP 1 [CaseId] FROM #CEREligibility WHERE caseID = s.caseID AND [CaseId] IS NOT NULL ORDER BY ModifiedOn)
    AND [CaseId].[CaseId] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [M2Eligibility]
    ON s.caseID = [M2Eligibility].caseID
    AND s.modifiedOn = [M2Eligibility].modifiedOn
    AND [M2Eligibility].[M2Eligibility] = (SELECT TOP 1 [M2Eligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [M2Eligibility] IS NOT NULL ORDER BY ModifiedOn)
    AND [M2Eligibility].[M2Eligibility] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CDREligibility]
    ON s.caseID = [CDREligibility].caseID
    AND s.modifiedOn = [CDREligibility].modifiedOn
    AND [CDREligibility].[CDREligibility] = (SELECT TOP 1 [CDREligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [CDREligibility] IS NOT NULL ORDER BY ModifiedOn)
    AND [CDREligibility].[CDREligibility] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [M2Comments]
    ON s.caseID = [M2Comments].caseID
    AND s.modifiedOn = [M2Comments].modifiedOn
    AND [M2Comments].[M2Comments] = (SELECT TOP 1 [M2Comments] FROM #CEREligibility WHERE caseID = s.caseID AND [M2Comments] IS NOT NULL ORDER BY ModifiedOn)
    AND [M2Comments].[M2Comments] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [M2CommentsRtf]
    ON s.caseID = [M2CommentsRtf].caseID
    AND s.modifiedOn = [M2CommentsRtf].modifiedOn
    AND [M2CommentsRtf].[M2CommentsRtf] = (SELECT TOP 1 [M2CommentsRtf] FROM #CEREligibility WHERE caseID = s.caseID AND [M2CommentsRtf] IS NOT NULL ORDER BY ModifiedOn)
    AND [M2CommentsRtf].[M2CommentsRtf] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CDRComments]
    ON s.caseID = [CDRComments].caseID
    AND s.modifiedOn = [CDRComments].modifiedOn
    AND [CDRComments].[CDRComments] = (SELECT TOP 1 [CDRComments] FROM #CEREligibility WHERE caseID = s.caseID AND [CDRComments] IS NOT NULL ORDER BY ModifiedOn)
    AND [CDRComments].[CDRComments] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CDRCommentsRtf]
    ON s.caseID = [CDRCommentsRtf].caseID
    AND s.modifiedOn = [CDRCommentsRtf].modifiedOn
    AND [CDRCommentsRtf].[CDRCommentsRtf] = (SELECT TOP 1 [CDRCommentsRtf] FROM #CEREligibility WHERE caseID = s.caseID AND [CDRCommentsRtf] IS NOT NULL ORDER BY ModifiedOn)
    AND [CDRCommentsRtf].[CDRCommentsRtf] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [RIAWA]
    ON s.caseID = [RIAWA].caseID
    AND s.modifiedOn = [RIAWA].modifiedOn
    AND [RIAWA].[RIAWA] = (SELECT TOP 1 [RIAWA] FROM #CEREligibility WHERE caseID = s.caseID AND [RIAWA] IS NOT NULL ORDER BY ModifiedOn)
    AND [RIAWA].[RIAWA] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [RIAWADate]
    ON s.caseID = [RIAWADate].caseID
    AND s.modifiedOn = [RIAWADate].modifiedOn
    AND [RIAWADate].[RIAWADate] = (SELECT TOP 1 [RIAWADate] FROM #CEREligibility WHERE caseID = s.caseID AND [RIAWADate] IS NOT NULL ORDER BY ModifiedOn)
    AND [RIAWADate].[RIAWADate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [EducationAndTraining]
    ON s.caseID = [EducationAndTraining].caseID
    AND s.modifiedOn = [EducationAndTraining].modifiedOn
    AND [EducationAndTraining].[EducationAndTraining] = (SELECT TOP 1 [EducationAndTraining] FROM #CEREligibility WHERE caseID = s.caseID AND [EducationAndTraining] IS NOT NULL ORDER BY ModifiedOn)
    AND [EducationAndTraining].[EducationAndTraining] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [EducationAndTrainingDate]
    ON s.caseID = [EducationAndTrainingDate].caseID
    AND s.modifiedOn = [EducationAndTrainingDate].modifiedOn
    AND [EducationAndTrainingDate].[EducationAndTrainingDate] = (SELECT TOP 1 [EducationAndTrainingDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EducationAndTrainingDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [EducationAndTrainingDate].[EducationAndTrainingDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [Internship]
    ON s.caseID = [Internship].caseID
    AND s.modifiedOn = [Internship].modifiedOn
    AND [Internship].[Internship] = (SELECT TOP 1 [Internship] FROM #CEREligibility WHERE caseID = s.caseID AND [Internship] IS NOT NULL ORDER BY ModifiedOn)
    AND [Internship].[Internship] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [InternshipDate]
    ON s.caseID = [InternshipDate].caseID
    AND s.modifiedOn = [InternshipDate].modifiedOn
    AND [InternshipDate].[InternshipDate] = (SELECT TOP 1 [InternshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [InternshipDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [InternshipDate].[InternshipDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [Apprenticeship]
    ON s.caseID = [Apprenticeship].caseID
    AND s.modifiedOn = [Apprenticeship].modifiedOn
    AND [Apprenticeship].[Apprenticeship] = (SELECT TOP 1 [Apprenticeship] FROM #CEREligibility WHERE caseID = s.caseID AND [Apprenticeship] IS NOT NULL ORDER BY ModifiedOn)
    AND [Apprenticeship].[Apprenticeship] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ApprenticeshipDate]
    ON s.caseID = [ApprenticeshipDate].caseID
    AND s.modifiedOn = [ApprenticeshipDate].modifiedOn
    AND [ApprenticeshipDate].[ApprenticeshipDate] = (SELECT TOP 1 [ApprenticeshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [ApprenticeshipDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [ApprenticeshipDate].[ApprenticeshipDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [Entrepreneurship]
    ON s.caseID = [Entrepreneurship].caseID
    AND s.modifiedOn = [Entrepreneurship].modifiedOn
    AND [Entrepreneurship].[Entrepreneurship] = (SELECT TOP 1 [Entrepreneurship] FROM #CEREligibility WHERE caseID = s.caseID AND [Entrepreneurship] IS NOT NULL ORDER BY ModifiedOn)
    AND [Entrepreneurship].[Entrepreneurship] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [EntrepreneurshipDate]
    ON s.caseID = [EntrepreneurshipDate].caseID
    AND s.modifiedOn = [EntrepreneurshipDate].modifiedOn
    AND [EntrepreneurshipDate].[EntrepreneurshipDate] = (SELECT TOP 1 [EntrepreneurshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EntrepreneurshipDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [EntrepreneurshipDate].[EntrepreneurshipDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [EmploymentPrep]
    ON s.caseID = [EmploymentPrep].caseID
    AND s.modifiedOn = [EmploymentPrep].modifiedOn
    AND [EmploymentPrep].[EmploymentPrep] = (SELECT TOP 1 [EmploymentPrep] FROM #CEREligibility WHERE caseID = s.caseID AND [EmploymentPrep] IS NOT NULL ORDER BY ModifiedOn)
    AND [EmploymentPrep].[EmploymentPrep] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [EmploymentPrepDate]
    ON s.caseID = [EmploymentPrepDate].caseID
    AND s.modifiedOn = [EmploymentPrepDate].modifiedOn
    AND [EmploymentPrepDate].[EmploymentPrepDate] = (SELECT TOP 1 [EmploymentPrepDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EmploymentPrepDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [EmploymentPrepDate].[EmploymentPrepDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [OTPrep]
    ON s.caseID = [OTPrep].caseID
    AND s.modifiedOn = [OTPrep].modifiedOn
    AND [OTPrep].[OTPrep] = (SELECT TOP 1 [OTPrep] FROM #CEREligibility WHERE caseID = s.caseID AND [OTPrep] IS NOT NULL ORDER BY ModifiedOn)
    AND [OTPrep].[OTPrep] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [OTPrepDate]
    ON s.caseID = [OTPrepDate].caseID
    AND s.modifiedOn = [OTPrepDate].modifiedOn
    AND [OTPrepDate].[OTPrepDate] = (SELECT TOP 1 [OTPrepDate] FROM #CEREligibility WHERE caseID = s.caseID AND [OTPrepDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [OTPrepDate].[OTPrepDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ExitInterview]
    ON s.caseID = [ExitInterview].caseID
    AND s.modifiedOn = [ExitInterview].modifiedOn
    AND [ExitInterview].[ExitInterview] = (SELECT TOP 1 [ExitInterview] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitInterview] IS NOT NULL ORDER BY ModifiedOn)
    AND [ExitInterview].[ExitInterview] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ExitInterviewDate]
    ON s.caseID = [ExitInterviewDate].caseID
    AND s.modifiedOn = [ExitInterviewDate].modifiedOn
    AND [ExitInterviewDate].[ExitInterviewDate] = (SELECT TOP 1 [ExitInterviewDate] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitInterviewDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [ExitInterviewDate].[ExitInterviewDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CreatedOn]
    ON s.caseID = [CreatedOn].caseID
    AND s.modifiedOn = [CreatedOn].modifiedOn
    AND [CreatedOn].[CreatedOn] = (SELECT TOP 1 [CreatedOn] FROM #CEREligibility WHERE caseID = s.caseID AND [CreatedOn] IS NOT NULL ORDER BY ModifiedOn)
    AND [CreatedOn].[CreatedOn] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CreatedBy]
    ON s.caseID = [CreatedBy].caseID
    AND s.modifiedOn = [CreatedBy].modifiedOn
    AND [CreatedBy].[CreatedBy] = (SELECT TOP 1 [CreatedBy] FROM #CEREligibility WHERE caseID = s.caseID AND [CreatedBy] IS NOT NULL ORDER BY ModifiedOn)
    AND [CreatedBy].[CreatedBy] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ModifiedOn]
    ON s.caseID = [ModifiedOn].caseID
    AND s.modifiedOn = [ModifiedOn].modifiedOn
    AND [ModifiedOn].[ModifiedOn] = (SELECT TOP 1 [ModifiedOn] FROM #CEREligibility WHERE caseID = s.caseID AND [ModifiedOn] IS NOT NULL ORDER BY ModifiedOn)
    AND [ModifiedOn].[ModifiedOn] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ModifiedBy]
    ON s.caseID = [ModifiedBy].caseID
    AND s.modifiedOn = [ModifiedBy].modifiedOn
    AND [ModifiedBy].[ModifiedBy] = (SELECT TOP 1 [ModifiedBy] FROM #CEREligibility WHERE caseID = s.caseID AND [ModifiedBy] IS NOT NULL ORDER BY ModifiedOn)
    AND [ModifiedBy].[ModifiedBy] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [BCPermInEligibility]
    ON s.caseID = [BCPermInEligibility].caseID
    AND s.modifiedOn = [BCPermInEligibility].modifiedOn
    AND [BCPermInEligibility].[BCPermInEligibility] = (SELECT TOP 1 [BCPermInEligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [BCPermInEligibility] IS NOT NULL ORDER BY ModifiedOn)
    AND [BCPermInEligibility].[BCPermInEligibility] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CCPermInEligibility]
    ON s.caseID = [CCPermInEligibility].caseID
    AND s.modifiedOn = [CCPermInEligibility].modifiedOn
    AND [CCPermInEligibility].[CCPermInEligibility] = (SELECT TOP 1 [CCPermInEligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [CCPermInEligibility] IS NOT NULL ORDER BY ModifiedOn)
    AND [CCPermInEligibility].[CCPermInEligibility] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [M2EligibilityDate]
    ON s.caseID = [M2EligibilityDate].caseID
    AND s.modifiedOn = [M2EligibilityDate].modifiedOn
    AND [M2EligibilityDate].[M2EligibilityDate] = (SELECT TOP 1 [M2EligibilityDate] FROM #CEREligibility WHERE caseID = s.caseID AND [M2EligibilityDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [M2EligibilityDate].[M2EligibilityDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [CDREligibilityDate]
    ON s.caseID = [CDREligibilityDate].caseID
    AND s.modifiedOn = [CDREligibilityDate].modifiedOn
    AND [CDREligibilityDate].[CDREligibilityDate] = (SELECT TOP 1 [CDREligibilityDate] FROM #CEREligibility WHERE caseID = s.caseID AND [CDREligibilityDate] IS NOT NULL ORDER BY ModifiedOn)
    AND [CDREligibilityDate].[CDREligibilityDate] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ExitSeparationCode]
    ON s.caseID = [ExitSeparationCode].caseID
    AND s.modifiedOn = [ExitSeparationCode].modifiedOn
    AND [ExitSeparationCode].[ExitSeparationCode] = (SELECT TOP 1 [ExitSeparationCode] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitSeparationCode] IS NOT NULL ORDER BY ModifiedOn)
    AND [ExitSeparationCode].[ExitSeparationCode] IS NOT NULL
    LEFT OUTER JOIN #CEREligibility [ExitSeparationSubCode]
    ON s.caseID = [ExitSeparationSubCode].caseID
    AND s.modifiedOn = [ExitSeparationSubCode].modifiedOn
    AND [ExitSeparationSubCode].[ExitSeparationSubCode] = (SELECT TOP 1 [ExitSeparationSubCode] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitSeparationSubCode] IS NOT NULL ORDER BY ModifiedOn)
    AND [ExitSeparationSubCode].[ExitSeparationSubCode] IS NOT NULL
    GROUP BY s.caseID
    When I ran this against your test data, It produced a single row for each of the two case ID's.
    To keep performance in line, I also created a covering index on the temp table:
    CREATE INDEX idx_caseID_ModifiedOn ON #CEREligibility (caseID, modifiedOn) INCLUDE ([CEREligibilityId], [M2Eligibility], [CDREligibility], [M2Comments], [M2CommentsRtf], [CDRComments], [CDRCommentsRtf], [RIAWA], [RIAWADate], [EducationAndTraining], [EducationAndTrainingDate], [Internship], [InternshipDate], [Apprenticeship], [ApprenticeshipDate], [Entrepreneurship], [EntrepreneurshipDate], [EmploymentPrep], [EmploymentPrepDate], [OTPrep], [OTPrepDate], [ExitInterview], [ExitInterviewDate], [CreatedOn], [CreatedBy], [ModifiedBy], [BCPermInEligibility], [CCPermInEligibility], [M2EligibilityDate], [CDREligibilityDate], [ExitSeparationCode], [ExitSeparationSubCode])
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • 9.2.0.6 Intersection Error

    We’ve recently upgraded to 9.2.0.6 as part of a major release and we’re seeing the following spatial error intermittently in our Production system which is causing us major problems. When we get this problem the whole GIS application grinds to a halt.
    *** SESSION ID:(173.10) 2006-05-03 09:51:33.390
    *** 2006-05-03 09:51:33.390
    ksedmp: internal or fatal error
    ORA-00600: internal error code, arguments: [kohdtf048], [], [], [], [], [], [], []
    Current SQL statement for this session:
    SELECT COUNT(*) , SDO_AGGR_UNION(MDSYS.SDOAGGRTYPE(TBLINPROCESSPBLPLY.GEOM, 0.001)) FROM TBLINPROCESSPBLPLY WHERE CRN = :B3 AND SDO_RELATE(TBLINPROCESSPBLPLY.GEOM,:B2 , 'mask=ANYINTERACT querytype=WINDOW')='TRUE' AND SDO_GEOM.SDO_AREA(SDO_GEOM.SDO_INTERSECTION(TBLINPROCESSPBLPLY.GEOM ,
    :B4 ,:B2 ,:B4 ),:B4 ) > 10 AND CREATEDBY = :B1 AND OBJLOCKED = 2
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    43143e930 25 MDSYS.AGGRUNION
    43143e930 25 MDSYS.AGGRUNION
    430296160 1 anonymous block
    4314eb9d8 485 RLR.TBLINPROCESSPBLPLY
    The current code looks as follows, based on a trigger:-
    SELECT COUNT(*) , SDO_AGGR_UNION(MDSYS.SDOAGGRTYPE(TBLINPROCESSPBLPLY.GEOM, 0.001)) INTO nPBLPolys , nUnionElem FROM TBLINPROCESSPBLPLY
    WHERE CRN = :NEW.CRN
    AND SDO_RELATE
    (TBLINPROCESSPBLPLY.GEOM,:NEW.GEOM , 'mask=ANYINTERACT querytype=WINDOW')='TRUE'
    AND SDO_GEOM.SDO_AREA(SDO_GEOM.SDO_INTERSECTION(TBLINPROCESSPBLPLY.GEOM , dim_array ,:NEW.GEOM ,dim_array),dim_array) > 10
    AND CREATEDBY = :NEW.CREATEDBY
    AND OBJLOCKED = 2
    I have looked on the Oracle forums and it looks like the SDO_INTERSECTION call is causing the exception. I’ve changed the above to the following to remove this call and also added an exception block.
    BEGIN
    SELECT COUNT (*),
    sdo_aggr_union
    (MDSYS.sdoaggrtype
    (tblinprocesspblply.geom,
    0.001
    INTO npblpolys,
    nunionelem
    FROM tblinprocesspblply
    WHERE crn = :NEW.crn
    AND sdo_relate
    (tblinprocesspblply.geom,
    :NEW.geom,
    'mask=OVERLAPBDYINTERSECT+CONTAINS+INSIDE+COVERS+COVEREDBY+EQUAL querytype=WINDOW'
    ) = 'TRUE'
    AND createdby = :NEW.createdby
    AND objlocked = 2;
    EXCEPTION
    WHEN OTHERS
    THEN
    BEGIN
    INSERT INTO tbltrigger_log
    (lineno, varname, VALUE
    VALUES (2, :NEW.crn, :NEW.createdby
    RAISE;
    END;
    END;
    Hopefully this will solve the problem but I was wondering if anyone had seen this problem before and how you got around it. And also if the second piece of SQL would mimic the first?

    This looks like a known memory leak issue with sdo_aggr_union which
    is fixed in 9207.
    Do you know how many rows are going into the sdo_aggr_union function ?
    siva

  • How to run sql query in bat file in task schedular at every 10 seconds

    This is my sql script :
    DECLARE @countRows INT,
    @currDate DATE,
    @checkForTasks INT,
    @created_by_id INT,
    @gst_ID int;
    SET @currDate = Getdate()
    SET @countRows = (SELECT Count(*)
    FROM [dbo].[sd_gst_effective_table]
    WHERE isapplied = 0)
    IF @countRows > 0
    -- Check for those GST''s who are not applied yet : if they are greater than 0 then perform next task
    BEGIN
    SET @checkForTasks = (SELECT Count(*)
    -- Check is current date equals to task date or not
    FROM [dbo].[sd_gst_effective_table]
    WHERE effect_date = @currDate AND isapplied = 0)
    IF @checkForTasks > 0
    -- If current date = task date then perform this task
    BEGIN
    SET @created_by_id = (SELECT TOP 1 createdby FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
    SET @gst_ID = (SELECT gst_id FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
    -- STEP 1 :: InActivate the existing GST according to createdbyID
    UPDATE sd_gst_rate
    SET isactive = 0,
    inactivedate = Getdate()
    WHERE isactive = 1
    AND createdby = @created_by_id
    -- STEP 2 :: Activate the New GST according to implementation date and gstID
    UPDATE sd_gst_rate
    SET isactive = 1,
    activedate = Getdate()
    WHERE id = @gst_ID
    -- STEP 3 :: Inactivate the applied GST from sd_gst_effective_table
    UPDATE [dbo].[sd_gst_effective_table] SET isApplied = 1 WHERE gst_id = @gst_ID
    END
    END
    DECLARE @Text AS VARCHAR(100)
    DECLARE @Cmd AS VARCHAR(100)
    DECLARE @value nvarchar(1000);
    SET @value = (SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds);
    SET @Text = 'File Writed ' + @value
    SET @Cmd ='echo ' + @Text + ' > E:\AppTextFile.txt'
    EXECUTE Master.dbo.xp_CmdShell @Cmd
    This is resided in videos folder of windows , i have created a task schedular in windows 8.1 to run daily at every 10 seconds , but it is not working ... Please tell me how to deal with it.
    Please note : This sql query is running perfectly in sql server. Query have no errors. Please check whats wrong with my time schedular. I just want my schedular to run every 10 seconds regardless of date.

    Hi Emad,
    Is your script in a ".sql" file? May I know how you configure the schedule task action?
    Since you didn't mention how you configure the schedule task, can you confirm you have followed the below step correctly?
    Save your script in a ".sql" file.
    Create a ".bat" file and call the sql file above inside with
    sqlcmd.exe, you can reference
    here.
    Configure a schedule task to run the ".bat" file in a certain interval.
    Have you tried to run the script in you bat file in a standalone commandline window? Please post the script in your bat file, It can help to diagnose the issue.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • In which field is the current valuation price (FIFO) stored?

    We need the current valuation price of FIFO-related items
    Previously, the valuation price was stored in oitm.avgprice or oitw.avgprice. In the current version these fields are not filled.
    How can you determine the current price of a FIFO-related item?
    Valuation Price = (sum of single FIFO prices of the items in stock) : (inventory)
    A similar problem occurs with charge-off. So far, the total booking price was stored in ige1.stocksum, but in SAP8.8 it is not. For a recalculation we need the value actually posted at the item level. This is the reason why the price cannot be determined from the posting journal jdt1, because there, a sum of all entries calculated.
    Is there a reliable way, which works with both SAP2007 and SAP8.8?
    regards
    M.Heigl

    Hello János
    Thanks a lot for your advice, this helps me to advance
    Unfortunately, the calcprice is not filled correctly.
    Example:
    Number of decimals in Price = 2
    Posting in 1 piece
    Factor = 1000 (1000 pc are posted),
    Total price 0.05 u20AC,
    Single Price = 0.00005,
    now in oitm.calcprice is stored : 0, in oinm.openvalue=0.05u20AC, in the jounrnal (jdt1) 0.05u20AC
    Alternatively, the field  u201Copenvalueu201D may be used?
    To get out the correct average inventory value, the following SQL statement would be correct:
    select sum (openvalue / openqty) from where oinm itemcode = N'test_fifo 'and openqty! = 0
    At charge off, the total value is determined via
    select sum (-1 * transvalue) from where oinm transtype=60 and createdby=164 and itemcode = N'test_fifo'
    In this test, I have also found an error:
    If the single price (oinm.calcprice) = 0, for example because it was posted with a large factor, the item cannot be issued anymore.
    Error message "acquisition price" is missing (...)
    Tested with 2007ASP1PL9 and SAP  8.8 (8.80.230) SP0PL12
    I assume that for FIFO evaluation SAP uses the calcprice and not the total price, the single price is determined, which in this case is 0 because of rounding.
    Apart from this error: Are my assumptions and SQL statements correct?
    Regards,

  • Powershell How to get person field display name

    I am running the following ps script to get some data out to csv. The person fields (AssignedTo and CreatedBy) come with index;#LastName, FirstName. How do just get the name without the index stuff. Or do I need to do a Regex or Replace? For example,
    32;#Doe, John Should be Doe, John
    $results = @()
    $web = Get-SPWeb "http://ourlocal.company.cc/docs/sales"
    $list = $web.Lists["Sales Tasks"]
    $caml = '<Where><Eq><FieldRef Name="Status" /><Value Type="Choice">Completed</Value></Eq></Where>'
    $query=new-object Microsoft.SharePoint.SPQuery
    $query.Query=$caml
    $ListItems=$list.GetItems($query)
    Write-Host "count " $ListItems.Count
    foreach ($item in $listItems)
    $Title = $item["Title"]
    $AssignedTo = $item["AssignedTo"]
    $Status = $item["Status"]
    $Priority = $item["Priority"]
    $CreatedBy = $item["Created By"]
    $out = new-object psobject -Property @{Title = $Title
    AssignedTo = $AssignedTo
    Status = $Status
    Priority = $Priority
    "Due Date" = $DueDate
    "Percent Complete" = $Percent
    "Created by" = $CreatedBy}
    $out = $out|select-object Title, AssignedTo, Status, Priority, "Due Date", "Percent Complete", "Created by"
    $results +=$out
    $results | Export-Csv "c:\output.csv" -noType
    $web.Dispose()

    Step 1:
    Add following code right after $CreatedBy=$item["Created By"]
    $CreatedByUserObj = New-Object Microsoft.SharePoint.SPFieldUserValue($web, $CreatedBy)
    $CreatedByDisplayName = $CreatedByUserObj.User.DisplayName;
    Step 2:
    Replace "Created by" = $CreatedBy with following code
    "Created by" = $CreatedByDisplayName

  • Field value not being written to database

    Hello,
    I'm trying to auto-populate a form field from a value in one of my backing beans by changing the field value property from #{bindings.Modifiedby1.inputValue} to #{pageFlowScope.backing_Login.userName}. When I open the form, the correct value from the backing bean is displayed in the field now, but when I save/commit the record the value doesn't make it to the database so while it is displayed on the screen in the form field, it doesn't get written to the database. Is there something that needs to be done to update the input value in the actual binding or something? I'm developing in JDeveloper 11.1.1.3.
    Thanks!

    Well, I thought it was working. I've found that the ModifiedBy and ModifiedDate fields do get updated in the database now, but it updates those two fields in the first row that was displayed on the table instead of the row that was selected. Here's my backing bean code (I've tried to comment what I'm doing in each step):
    public void editDialogListener(DialogEvent dialogEvent) {
    //when "ok" button in dialog box is selected
    if (dialogEvent.getOutcome().name().equals("ok")) {
    //get userName from Login backing bean and save as loggedInUser
    RequestContext requestContext =
    RequestContext.getCurrentInstance();
    String loggedInUser =
    (String)requestContext.getPageFlowScope().get("userName");
    //get bindings
    BindingContainer bindings = getBindings();
    //get Modifiedby1 attribute from bindings and setInputValue to LoggedInUser
    AttributeBinding attrModifiedBy =
    (AttributeBinding)bindings.getControlBinding("Modifiedby1");
    attrModifiedBy.setInputValue(loggedInUser);
    //get Modifieddate1 attribute from bindings and setInputValue to current date
    AttributeBinding attrModifiedDate =
    (AttributeBinding)bindings.getControlBinding("Modifieddate1");
    attrModifiedDate.setInputValue(new Date());
    //perform Commit
    OperationBinding operationBinding =
    bindings.getOperationBinding("Commit");
    operationBinding.execute();
    Can anyone see what I need to add or do differently to grab the selected row's attributes for updating?

  • Problem in selection from data base with RANGE-TABLE.

    Dear folks,
                   I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = space.
        APPEND wa_salesno TO r_salesno.
         CLEAR : wa_salesno .
      endif.
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
         wa_brandid-LOW = space.
        APPEND wa_brandid  TO  r_brandid.
        CLEAR : wa_brandid  .
      endif.
    *If any of these are given then select data accordingly.
        <b>select * from ZNSLVWHDIMMD_LCL
                 into corresponding fields of table IT_VIEW
                 WHERE SALESRLNO in  r_salesno
    *             and   CREATEDBY in It_crtby_selopt
    *            and   STARTDATE in It_validfrm_selopt
    *             and   ENDDATE   in It_validto_selopt
    *             and  STATUS     in It_status_selopt1
                 and   BRANDID   in r_brandid.
    *             and   MODELNO   in It_model_selopt.</b>

    Hello Nirad
    Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        REFRESH: r_salesno.  " means: select all sales numbers
    " NOTE: If you fill the range like below this means that only sales order
    "            with no sales number (= ' ', space) should be select.
    " Thus, there will never be any sales order selected.
    *   wa_salesno-sign = 'I'.
    *   wa_salesno-option = 'EQ'.
    *   wa_salesno-LOW = space.
    *   APPEND wa_salesno TO r_salesno.
    *    CLEAR : wa_salesno .
      endif.
    The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        REFRESH: r_brandid.  " means: select all BRANDID
    *    wa_brandid-sign = 'I'.
    *    wa_brandid-option = 'EQ'.
    *     wa_brandid-LOW = space.
    *    APPEND wa_brandid  TO  r_brandid.
    *    CLEAR : wa_brandid  .
      endif.
    Regards
      Uwe

  • Track List attachments' last modified metadata

    Hi,
    Do we have any option to display the last modified by/date for a List item's attachment? I know this is stored as a separate column and OOTB it is not possible to view the last modified properties for an attachment. But is this possible?
    Thanks,
    Vimal

    Hi Vimal,
    According to your description, my understandings is that you want to track the list attachments’ last modified by/date metadata in SharePoint.
    I recommend to use the File.ModifiedBy and
    File.TimeLastModified property to get the last modified by/date of list attachments through PowerShell to see if the issue can be solved.
    Here is a similar issue for you to refer:
    http://sharepoint.stackexchange.com/questions/76141/list-attachment-details
    More references:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file_members(v=office.14).ASPX
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file.timelastmodified(v=office.14).ASPX
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file.modifiedby(v=office.14).ASPX
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • To yashpal Gupta-Select option range table

    Dear Yashpal,
                        I have created range table and put conditions and passed empty table in this fashion.still the result is the same (If i give both input then functionality works,only one of then is given then sy-subrc = 4.).I am wondering ehther u haev passed empty table correctly or not.
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = space.
        APPEND wa_salesno TO r_salesno.
         CLEAR : wa_salesno .
      endif.
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
         wa_brandid-LOW = space.
        APPEND wa_brandid  TO  r_brandid.
        CLEAR : wa_brandid  .
      endif.
    **Situation where these fields are not provided  on the screen.
    *If any of these are given then select data accordingly.
        select * from ZNSLVWHDIMMD_LCL
                 into corresponding fields of table IT_VIEW
                 WHERE SALESRLNO in  r_salesno
    *             and   CREATEDBY in It_crtby_selopt
    *            and   STARTDATE in It_validfrm_selopt
    *             and   ENDDATE   in It_validto_selopt
    *             and  STATUS     in It_status_selopt1
                 and   BRANDID   in r_brandid.
    *             and   MODELNO   in It_model_selopt

    dynamic selection on data.thnx

  • Question to modify a for loop to put a counter and parametrize it

    I have a FOR loop which is part of a PROCEDURE, the loop currently commits records for a large group of network providers. I need to modify it put a counter and commit for every 100 rows and make the number of rows of 100 parametrized. Any idea how this can be accomplished?
    FOR cur_netrec IN cur_network_mc (curproc.mpicontractid)
                LOOP
                   v_effectivedate := NULL;
                   v_terminationdate := NULL;
                   v_delegated := 'N';
                   v_individual := 'N';
                   v_credential := NULL;
                   FOR cur_conrec
                   IN cur_cont (cur_netrec.providerid, cur_netrec.mpinetworkcode)
                   LOOP
                      IF cur_conrec.effdate IS NOT NULL
                      THEN
                         v_effectivedate :=
                            LEAST (cur_conrec.effdate,
                                   NVL (v_effectivedate, '31-DEC-9999'));
                      END IF;
                   END LOOP;
                   IF cur_netrec.mpinetworkproviderid IS NULL
                   THEN
                      INSERT INTO mpi_provider.mpinetworkprovider (
                                                                      mpinetworkproviderid,
                                                                      providerid,
                                                                      mpinetworkcode,
                                                                      providernetworkcode,
                                                                      effectivedate,
                                                                      terminationdate,
                                                                      credentialingtypecode,
                                                                      createdby,
                                                                      creationdate,
                                                                      modifiedby,
                                                                      modificationdate
                        VALUES   (
                                     seq_mpinetworkprovider.NEXTVAL,
                                     cur_netrec.providerid,
                                     cur_netrec.mpinetworkcode,
                                     (SELECT   otherid
                                        FROM   mpi_provider.mpiprovider
                                       WHERE   providerid = cur_netrec.providerid),
                                     NVL (cur_netrec.effectivedateoverride,
                                          v_effectivedate),
                                     NVL (cur_netrec.terminationdateoverride,
                                          v_terminationdate),
                                     v_credential,
                                     USER,
                                     TRUNC (SYSDATE),
                                     USER,
                                     TRUNC (SYSDATE)
                   ELSE
                      UPDATE   mpinetworkprovider
                         SET   effectivedate =
                                  NVL (cur_netrec.effectivedateoverride,
                                       v_effectivedate),
                               terminationdate =
                                  NVL (cur_netrec.terminationdateoverride,
                                       v_terminationdate),
                               credentialingtypecode = v_credential,
                               modificationdate = TRUNC (SYSDATE),
                               modifiedby = USER
                       WHERE   providerid = cur_netrec.providerid
                               AND mpinetworkcode = cur_netrec.mpinetworkcode;
                   END IF;
                   --update when contract credential type code change
                   UPDATE   mpi_provider.person prs
                      SET   prs.credentialingtypecode =
                               (SELECT   DECODE (MIN (credtype),
                                                 1, 'DELEGNCQA',
                                                 2, 'DELEGNETEX',
                                                 3, 'DELEGATED',
                                                 4, 'NONDELEG',
                                                 5, 'INDIVIDUAL',
                                                 6, 'NONDENETEX',
                                                 'NONE')
                                            AS personcredentialingtypecode
                                  FROM   (SELECT   DECODE (
                                                      c.credentialingtypecode,
                                                      'DELEGNCQA',
                                                      1,
                                                      'DELEGNETEX',
                                                      2,
                                                      'DELEGATED',
                                                      3,
                                                      'NONDELEG',
                                                      4,
                                                      'INDIVIDUAL',
                                                      5,
                                                      'NONDENETEX',
                                                      6,
                                                      7
                                                      AS credtype
                                            FROM   mpi_provider.mpicontractprovider cp,
                                                   mpi_provider.mpicontract c
                                           WHERE   c.mpicontractid =
                                                      cp.mpicontractid
                                                   AND cp.providerid =
                                                         cur_netrec.providerid
                                                   AND cp.terminationdate >
                                                         SYSDATE))
                    WHERE   prs.providerid = cur_netrec.providerid;
                   COMMIT;          
                END LOOP;

    This piece could be accomplished with a MERGE, too
                   IF cur_netrec.mpinetworkproviderid IS NULL
                   THEN
                      INSERT INTO mpi_provider.mpinetworkprovider (
                                                                      mpinetworkproviderid,
                                                                      providerid,
                                                                      mpinetworkcode,
                                                                      providernetworkcode,
                                                                      effectivedate,
                                                                      terminationdate,
                                                                      credentialingtypecode,
                                                                      createdby,
                                                                      creationdate,
                                                                      modifiedby,
                                                                      modificationdate
                        VALUES   (
                                     seq_mpinetworkprovider.NEXTVAL,
                                     cur_netrec.providerid,
                                     cur_netrec.mpinetworkcode,
                                     (SELECT   otherid
                                        FROM   mpi_provider.mpiprovider
                                       WHERE   providerid = cur_netrec.providerid),
                                     NVL (cur_netrec.effectivedateoverride,
                                          v_effectivedate),
                                     NVL (cur_netrec.terminationdateoverride,
                                          v_terminationdate),
                                     v_credential,
                                     USER,
                                     TRUNC (SYSDATE),
                                     USER,
                                     TRUNC (SYSDATE)
                   ELSE
                      UPDATE   mpinetworkprovider
                         SET   effectivedate =
                                  NVL (cur_netrec.effectivedateoverride,
                                       v_effectivedate),
                               terminationdate =
                                  NVL (cur_netrec.terminationdateoverride,
                                       v_terminationdate),
                               credentialingtypecode = v_credential,
                               modificationdate = TRUNC (SYSDATE),
                               modifiedby = USER
                       WHERE   providerid = cur_netrec.providerid
                               AND mpinetworkcode = cur_netrec.mpinetworkcode;
                   END IF;
                   --update when contract credential type code change
                   UPDATE   mpi_provider.person prs
                      SET   prs.credentialingtypecode =
                               (SELECT   DECODE (MIN (credtype),
                                                 1, 'DELEGNCQA',
                                                 2, 'DELEGNETEX',
                                                 3, 'DELEGATED',
                                                 4, 'NONDELEG',
                                                 5, 'INDIVIDUAL',
                                                 6, 'NONDENETEX',
                                                 'NONE')
                                            AS personcredentialingtypecode
                                  FROM   (SELECT   DECODE (
                                                      c.credentialingtypecode,
                                                      'DELEGNCQA',
                                                      1,
                                                      'DELEGNETEX',
                                                      2,
                                                      'DELEGATED',
                                                      3,
                                                      'NONDELEG',
                                                      4,
                                                      'INDIVIDUAL',
                                                      5,
                                                      'NONDENETEX',
                                                      6,
                                                      7
                                                      AS credtype
                                            FROM   mpi_provider.mpicontractprovider cp,
                                                   mpi_provider.mpicontract c
                                           WHERE   c.mpicontractid =
                                                      cp.mpicontractid
                                                   AND cp.providerid =
                                                         cur_netrec.providerid
                                                   AND cp.terminationdate >
                                                         SYSDATE))
                    WHERE   prs.providerid = cur_netrec.providerid;

  • Is this a bug? createdBy populated with value "1"

    I have a field in entity object mapped as historical column "createdBy". once I create a new record, this field populated as login user name. -- this works fine.
    However, after I specify this field "refresh after inserted/updated". this field populated with value "1" automatically once new record created. -- Is this a bug?
    BTW, the historical column "modifiedBy" does not have this problem.
    Thanks

    at javax.swing.JInternalFrame.setMaximum(JInternalFrame.java:890)
    at TestInterface.initComponents(TestInterface.java:48)What you posted there cannot be the entire contents of the method. According to the stack trace, your initComponents method, at line 48, calls the setMaximum method of some JInternalFrame object. However, the problem remains: Why a NullPointerException? It's possible there is a bug in the JVM, but that theory doesn't get your problem solved if it's true. And it's more likely (MUCH more likely for most of us) that it's a bug in your program. But what could that be? I looked at the API documentation for JInternalFrame.setMaximum and noticed this:
    "A maximized frame is resized to fully fit the JDesktopPane area associated with the JInternalFrame."
    I don't know how you would "associate" a JDesktopPane with a JInternalFrame, but possibly if you failed to do that, then references to the JDesktopPane would fail with a NullPointerException.

  • Xsd:complexType with extension and unordered (sometimes not all) elements

    Hello, I have a schema definition that I need to change.
    I have the following BASE (from which I extend) elements Entity and Record Info, and I have a Quote element that extends from entity.
    Some times a Quote (title, context, quoted, written) will have all its elements and some times the user will not enter the [context] for example (as the quote maybe self explanatory),
    so I am in need of a definition that will allow me that.
    Also I have a User entity that is working fine, but when I run the JUnit test it changes the order of userName and userPassword and what happens is that it throws an error because it is expecting the order (userName then userPassword, and not userPassword firs, and userName second) is this possible to change also?
    The ideal would be a Definition that will allow me unordered elements and some of the elements can be missing also, well now that I think about it I could just put the element with an empty string, but what could I do about the order?
    I need some field like id and record info, but the rest, I really don't care if title is the first element or the last.
    These are my schema parts I used to have sequence but I am trying with xsd:all but it crashes:
        <xsd:complexType name="entity">
            <xsd:sequence>
                <xsd:element name="synapseId" type="xsd:string"></xsd:element>
                <xsd:element name="recordInfo" type="tns:recordInformation" xmlns:tns="http://xml.fdt.com/Schemas/Cognoscere/mainRepository"></xsd:element>
            </xsd:sequence>
            <xsd:attribute name="id" type="xsd:string"/>
            <xsd:attribute name="languageCode" type="xsd:string"/>
            <xsd:attribute name="countryCode" type="xsd:string"/>
            <xsd:attribute name="regenerateAs" type="xsd:string" use="optional"/>
        </xsd:complexType>
        <xsd:complexType name="recordInformation">
            <xsd:sequence>
                <xsd:element name="createdBy" type="xsd:string"></xsd:element>
                <xsd:element name="createdDate" type="xsd:long"></xsd:element>
                <xsd:element name="modifiedBy" type="xsd:string"></xsd:element>
                <xsd:element name="modifiedDate" type="xsd:long"></xsd:element>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:complexType name="quote">
            <xsd:complexContent>
                <xsd:extension base="tns:entity">
                    <xsd:sequence>
                            <xsd:element name="title" type="xsd:string"></xsd:element>
                            <xsd:element name="context" type="xsd:string"></xsd:element>
                            <xsd:element name="preface" type="xsd:string"></xsd:element>
                            <xsd:element name="quoted" type="xsd:string"></xsd:element>
                            <xsd:element name="written" type="xsd:long"></xsd:element>
                    </xsd:sequence>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>by the way, when I tried with xsd:all minOccur etc, this is the error it threw:
    s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: all. [58]
    f(t)

    sorry the error was
    cos-all-limited.1.2: An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition.
    not the other one.
    I found it is working with choice. Is this ok?
    <xsd:complexType name="quote">
            <xsd:complexContent>
                <xsd:extension base="tns:entity">
                    <xsd:choice minOccurs="0" maxOccurs="unbounded">
                        <xsd:element name="title" type="xsd:string"></xsd:element>
                        <xsd:element name="context" type="xsd:string"></xsd:element>
                        <xsd:element name="preface" type="xsd:string"></xsd:element>
                        <xsd:element name="quoted" type="xsd:string"></xsd:element>
                        <xsd:element name="written" type="xsd:long"></xsd:element>
                    </xsd:choice>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>Doesn't look right to me, but my app is working, I would like to do it well not just have it working. (welcome to the nice happy and easy going place that is my mind) ;-)
    f(t)

  • How to Update the OrderStatus and OrderStatusAudit using BPEL

    Hi,
    I was working on OrderStatus schema using the BPEL.
    In this I have two tables namely OrderStatus and OrderStatusAudit.
    I have Inserted a new Order into both tables. In case I want to update the existing order number in both the tables what I need to do is It must simply Update existing row of the Ordernumber in the OrderStatus table since in this table OrderNumber is primary key.
    But in the OrderStatusAudit table each time when I was updating an existing ordernumber it must insert a new row underthe same Ordername because here the Ordernumber is not the Primarykey.
    (ie) The OrderStatus table should have the Current status of the ordernumber in a single row and the OrderStatusAudit table should have the entire details of what happened eachtime for the same ordernumber.
    My schema for OrderStatus is
    OrderNumber
    OrderStatus
    CreatedDate
    CreatedBy
    ModifiedDate
    ModifiedBy
    My schema for OrderStatusAudit is
    OrderNumber
    OrderStatus
    UpdatedDate
    UpdatedBy
    It was working fine when I was checking for a single Ordernumber giving condition of Switch as particular ordernumber.
    If the Ordernumber is same as in Switch condition it will update the existing row in OrderStatus and insert a new row in OrderStatusAudit and if it is not same as given in the Switch it will Insert a new row in both the tables.
    How can I acheive the same updation if there are many ordernumbers to be updated.
    It must to be done in a single BPEL.
    Please help me.
    Regards,
    Mahes.

    Hi,
    For example you can create a simple BPEL Process and you can throw an error during running process. If input data is not valid and format is not correct you can throw error using throw activity and using catch activity you can catch particular error. The catch-all will handle all the error occurred with the scope.
    you can also refer faulthandling section in the link for more information related to exception handling.
    http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/faults.htm#sthref1188
    Regards,
    Deepa

Maybe you are looking for