【问题标题】:ROWTYPE in CURSOR postgresqlCURSOR postgresql 中的 ROWTYPE
【发布时间】:2016-10-04 14:58:23
【问题描述】:

我想知道是否可以在 postgresql (pl/pgsql) 中为游标获取“Rowtype”。 ..

我的光标从多个表中选择,我不知道如何获取行类型。

c_Data CURSOR FOR 
select 
 dst_description 
, cnt_number 
, prd_name 
, grt_code 
, res_currency 
, res_date 
, prm_installmentdate 

from tbl_xxx, tbl_yyy, tbl_aaa
where cnt_id = res_xxx
and prd_id = cnt_yyy
and dst_id = prd_aaa
and grt_id = res_xxx
and prm_id = res_aaa; 

l_Data c_Data%rowtype;

请帮忙

【问题讨论】:

  • 你认为你为什么需要它?
  • 你不需要行类型。请改用 RECORD 类型。

标签: postgresql cursor plpgsql


【解决方案1】:

更像这样。

declare 
l_data record; 

begin
select 
INTO l_data --<<
 dst_description 
, cnt_number 
, prd_name 
, grt_code 
, res_currency 
, res_date 
, prm_installmentdate 
from tbl_xxx, tbl_yyy, tbl_aaa
where cnt_id = res_xxx
and prd_id = cnt_yyy
and dst_id = prd_aaa
and grt_id = res_xxx
and prm_id = res_aaa; 

l_data 将是您需要的行类型。

【讨论】:

    猜你喜欢
    • 2017-02-08
    • 1970-01-01
    • 2016-04-17
    • 2016-04-02
    • 1970-01-01
    • 1970-01-01
    • 2019-05-31
    • 2019-05-28
    • 2020-10-02
    相关资源
    最近更新 更多