Setting SELECT Buffers (into variables)

To be able to receive data from a SQL select command, you must set the areas within the Silk Performer program that will receive that data. These areas are called into variables. You must specify the into variables in the into clause of a SQL select command. An into variable in a SQL command must be associated with (bound to) a global variable. Into variable names begin with a colon (:) and are followed by the name of the corresponding global variable.

If certain columns specified in the select clause of the SQL select command will not be used in your transaction, you can use asterisks (*) instead of into variables to receive the values of these columns. Columns associated with an asterisk will be received in a special buffer of Silk Performer. You cannot use this buffer inside your transactions. Asterisks serve the purpose of place holders. You must not omit them, because you want to simulate and measure the performance of your final system. The number of into variables and asterisks in the into clause must match with the number of columns in the select clause of the SQL command.

The into clause of a select statement can be omitted if the Silk Performer program does not process result values. In this case all values of the select list are automatically bound to the internal buffer of Silk Performer.

Example

dclrand
  rArtNo: RndUniN(1..500);

var
  v_artno, v_stock, v_quant: number;

dcltrans
  transaction TMain
  begin
    v_artno := rArtNo;
    c1: SelArticle();
    if v_stock < v_quant then
      ...
    end
  end TMain;

dclsql
  SelArticle:
    SELECT articlename, articlegroup, quantity, stock
    INTO *, *, :v_quant, :v_stock
    FROM article WHERE articlenumber = :v_artno;

The example above shows the SQL SELECT command SelArticle selecting the database columns articlename, articlegroup, quantity and stock. The database columns articlename and articlegroup are associated with (bound to) with the Silk Performer data buffer (*) because their values will not be used in the transaction calling the SQL command. The database columns quantity and stock are associated with the into variables :v_quant and :v_stock.