oracle从不同表选所有数据,请问如何在 PB中从不同的表循环选取所有数据?

本文档详细介绍了如何在PowerBuilder中使用动态SQL来执行产生结果集的语句。内容包括DECLARE、PREPARE、OPEN、EXECUTE和FETCH等步骤,以及参数和结果集列的处理。此外,还提到了NULL值的设置方法和不同类型的FETCH选项。
摘要由CSDN通过智能技术生成

用动态SQL

Description

Use this format to execute a SQL statement that produces a result set in which the input parameters and result set columns are known at compile time.

Syntax

DECLARE Cursor | Procedure         DYNAMIC CURSOR | PROCEDURE         FOR DynamicStagingArea ;

PREPARE DynamicStagingArea FROM SQLStatement         {USING TransactionObject} ;

OPEN DYNAMIC Cursor         {USING ParameterList} ;

EXECUTE DYNAMIC Procedure        {USING ParameterList} ;

FETCH Cursor | Procedure         INTO HostVariableList ;

CLOSE Cursor | Procedure ;

Parameter        Description

Cursor or Procedure        The name of the cursor or procedure you want to use

DynamicStagingArea        The name of the DynamicStagingArea (usually SQLSA)If you need a DynamicStagingArea variable other than SQLSA, you must declare it and instantiate it with the CREATE statement before using it

SQLStatement        A string containing a valid SQL SELECT statement The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressions Enter a question mark (?) for each parameter in the statement. Value substitution is positional; reserved word substitution is not allowed

TransactionObject (optional)        The name of the transaction object that identifies the database

ParameterList (optional)        A comma-separated list of PowerScript variables. Note that PowerScript variables are preceded by a colon (

5f60efcaccfa40b26873a6a9cb266119.gif

HostVariableList        The list of PowerScript variables into which the data values will be retrieved

Usage

To specify a NULL value, use the SetNull function.

The DECLARE statement is not executable and can be declared globally.

If your DBMS supports formats of FETCH other than the customary (and default) FETCH NEXT, you can specify FETCH FIRST, FETCH PRIOR, or FETCH LAST.

The FETCH and CLOSE statements in Format 3 are the same as in standard embedded SQL.

To declare a global, shared, or instance cursor or procedure, select Global Variables, Instance Variables, or Shared Variables on the Declare menu of the PowerScript painter. To declare a local cursor, click the Paint SQL button in the PainterBar.

For information about global, instance, shared, and local scope, see "Where to declare variables ".

以上是PB带的帮助

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值