Teradata Conditional Procedure. #Stored Procedure #NestedCaseStatement

The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
New Member

Teradata Conditional Procedure. #Stored Procedure #NestedCaseStatement

Good day Community,


Please kindly assist with the following request in Teradata 16.

HR_Requirement.PNGHR Headcount Requirement


In the above HR request I need to calculate headcount with built in exceptions.


For example, scenario 3, I have to count 'Filled' positions however in the case were the "Position" is an 'Expat' (this "Position" is derived by adding an 'E' prefix on the 'Permanent' value "Position" - E123654 is Expat and 123654 is Permanent), I have to check if the 'Permanent' "Position" = 'Filled', if it is true, then I do not count the 'Expat' "Position".


Please see Headcount Rules in the image attached for the different scenario's and the rule exceptions/conditions.


The issue is with building the 'check rule' and extracting the numeric equivalent for 'Permanent', searching the set and returning an answer.


If anyone can assist, it would be much appreciated.

Junior Contributor

Re: Teradata Conditional Procedure. #Stored Procedure #NestedCaseStatement

Can you add a Create Table plus Inserts?