Basically if I had some database tables set up like so:
Object State
Id | Description | State
---+-------------+------
1 | blah | A
2 | blah blah | A
3 | blurgh | B
StateAction
Id | State | Action
---+-------+---------
1 | A | ActionA
2 | B | ActionB
Is there a native way (in T-SQL, SQL Server 2017+) to do something like
@proc ProcedureType --No idea if this is a thing
SELECT @proc = SA.Action
FROM ObjectState OS
JOIN StateAction SA ON OS.State = SA.State
WHERE OS.Id = 3
EXEC @proc
Basically, are there function pointer equivalents in SQL or function/procedure types? Are there any patterns for handling this sort of thing within a relational database context?