Advanced PowerBuilder

HomePrevious Lesson: Embedded SQL - PowerBuilder Implementation
Next Lesson: SELECT INTO

Using Host Variables

SQL statements in PowerBuilder can make use of the existing variables by prefixing the variable name with a colon (:). For example, in the following code we make reference to the li_ProductNo variable in the SQL statement:
Int li_ProductNo
li_ProductNo = Integer( sle_itemno.Text )
SELECT "product_master"."item_product_description" 
   INTO :lProductDesc 
   FROM "product_master" 
   WHERE "product_master"."product_no" = : li_ProductNo ;

Host variables are most commonly used in the following areas:

They are also used in place of values in the SET clauses in UPDATE statements and as parameter values to the Stored Procedures.
HomePrevious Lesson: Embedded SQL - PowerBuilder Implementation
Next Lesson: SELECT INTO