Such result sets can be processed using cursors, by other stored procedures, by associating a result-set locator, or by applications.
Stored procedures may also contain declared variables for processing data and cursors that allow it to loop through multiple rows in a table.
Depending on the database system, stored procedures can be implemented in a variety of programming languages, for example SQL, Java, C, or C++.
Although simpler and more declarative, prepared statements are not ordinarily written to use procedural logic and cannot operate on variables.
Smart contract is a term applied to executable code stored on a blockchain as opposed to an RDBMS.
Despite the execution result consensus mechanisms of public blockchain networks differing in principle from traditional private or federated databases, they perform ostensibly the same function as stored procedures, albeit usually with a sense of value transaction.