Oracle SELECT – PB Docs 126


The SELECT statement contains input variables and output variables.

  • Input variables are passed to the database as part
    of the execution and the substitution as described above for DELETE,

  • Output variables are used to 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 variables defined within
the scope of the script that contains the SELECT statement, and
emp_id_var 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 Oracle
data type. When the data types do not match perfectly, PowerBuilder converts

note.png 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 the following statement:

If the statement executes with no errors, data locations for
the result fields are bound internally. The data returned into these
locations is then converted as 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 line edit sle_Emp
and clicks the button Cb_Delete to delete the employee.

The script for the Clicked event in the CommandButton Cb_Delete

note.png 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

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x