Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

ODBC SELECT – PB Docs 2019 – PowerBuilder Library

ODBC SELECT – PB Docs 2019

ODBC
SELECT

The SELECT statement contains input and output variables.

  • Input variables

    are passed to the database as part of the execution, and the
    substitution is as described for DELETE, INSERT, and UPDATE.

  • Output variables

    return values based on the result of the SELECT
    statement.

Example 1

Assume you enter the following statement:

In this example, emp_id_var, emp_salary_var, and emp_name_var are
PowerScript variables defined within the scope of the script containing
the SELECT statement, and emp_id_var is an input variable and is processed
as described in the DELETE example above.

Both emp_name_var and emp_salary_var are output variables that will
be used to return values from the database. The data types of emp_name_var
and emp_salary_var should be the PowerScript data types that best match
the data type in the database. When the data types do not match perfectly,
PowerBuilder converts them.

How big should numeric output variables be?

For numeric data, the output variable must be large enough to hold
any value that may come from the database.

Assume the value for emp_id_var is 691 as in the previous example.
When the SELECT statement executes, the database receives this
command:

If no errors are returned when the statement executes, data
locations are bound internally for the result fields. The data returned
into these locations is converted if necessary, and the appropriate
PowerScript variables are set to those values.

Example 2

This example assumes the default transaction object (SQLCA) has been
assigned valid values and a successful CONNECT has executed. It also
assumes the data type of the emp_id column in the employee table is
CHARACTER[10]. The user enters an employee ID into the single line edit
field sle_Emp and clicks the button Cb_Delete.

The script for the Clicked event in the CommandButton Cb_Delete
is:

Error checking

Although you should test the SQLCode after every SQL statement,
these examples show statements to test the SQLCode only to illustrate a
specific point.

Example 3

This example assumes the default transaction object (SQLCA) has been
assigned valid values and a successful CONNECT has executed. The user
wants to extract rows from the employee table and insert them into the
table named extract_employees. The extraction occurs when the user clicks
the button Cb_Extract. The boolean variable YoungWorkers is set to TRUE or
FALSE elsewhere in the application.

The script for the Clicked event for the CommandButton Cb_Extract
is:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x