Dynamically Executing FedSQL Statements from DS2

You can embed and execute FedSQL statements from within your DS2 programs. You can use FedSQL with DS2 in the following instances:
  • You can invoke a DS2 package method expression as a function in a FedSQL SELECT statement.
    For more information, see Using DS2 Packages in Expressions.
  • You can use the SQLSTMT package to generate, prepare, and execute FedSQL statements to update, insert, or delete rows from a table at run time.
    The SQLSTMT package is intended for use with FedSQL statements that are executed multiple times, statements with parameters, or statements that generate a result set. For more information, see Using the SQLSTMT Package in SAS DS2 Language Reference.
  • You can also use the SQLEXEC function to generate, prepare, and execute FedSQL statements to update, insert, or delete rows from a table at run time.
    The SQLEXEC function is intended for use with FedSQL statements that are executed only one time, do not have parameters, and do not produce a result set.
    For more information, see the SQLEXEC Function in SAS DS2 Language Reference.
  • You can load data into a hash instance at run time by using a FedSQL SELECT statement in the DECLARE PACKAGE statement or the DATASET method.
    For more information, see Using a FedSQL Query with a Hash Instance to Get Rows Dynamically at Run Time in SAS DS2 Language Reference the DATASET Method in SAS DS2 Language Reference and the DECLARE PACKAGE Statement, Hash Package in SAS DS2 Language Reference.
  • You can use the SET statement to input data by using a FedSQL SELECT statement.
    For more information, see SET Statement with Embedded FedSQL in SAS DS2 Language Reference and the SET Statement in SAS DS2 Language Reference.