PL SQL如何选择所有列

编程入门 行业动态 更新时间:2024-10-26 16:34:31
本文介绍了PL SQL如何选择所有列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何使以下包装器选择所有列*而不是 if_type 和 number_infected ?

How do i make the following wrapper select all columns "*" instead of just if_type, and number_infected?

--spec create or replace package WrapperSample is type TResultRow is record( if_type codes.cd%type ,number_infected Integer); type TResultRowList is table of TResultRow; function GetADedIcWarningsProv ( p_hos_id in work_entity_data.hos_id%type ,p_date in date ) return TResultRowList pipelined; end WrapperSample; / --body create or replace package body WrapperSample is function GetADedIcWarningsProv ( p_hos_id in work_entity_data.hos_id%type ,p_date in date ) return TResultRowList pipelined is v_refcur eOdatatypes_package.eOrefcur; currentRow TResultRow; begin v_refcur := YourSchema.getADedIcWarningsProv(p_hos_id, p_date); loop fetch v_refcur INTO currentRow; exit when v_refcur%NotFound; pipe row(currentRow); end loop; close v_refcur; return; end; end WrapperSample; /

推荐答案

请了解您的问题和要求。

I am not sure if I do understand your question and requirement.

但是,如果您正在寻找一种获取表格内容或其中一部分的方法,这可能是您如何处理:

But if you're looking for a way to get a table's content, or a portion thereof, this is probably how you would approach it:

create table tq84_test_table ( col_1 number, col_2 varchar2(10), col_3 date ); insert into tq84_test_table values (1, 'one' , sysdate); insert into tq84_test_table values (2, 'two' , sysdate+1); insert into tq84_test_table values (3, 'three', sysdate-1); create or replace package tq84_sss as type record_t is table of tq84_test_table%rowtype; function GetADedIcWarningsProv return record_t; end; / create or replace package body tq84_sss as function GetADedIcWarningsProv return record_t is ret record_t; begin select * bulk collect into ret from tq84_test_table; return ret; end GetADedIcWarningsProv; end; /

然后您可以使用此功能:

You would then later use this function like so:

declare table_content tq84_sss.record_t; begin table_content := tq84_sss.GetADedIcWarningsProv; for i in 1 .. table_content.count loop dbms_output.put_line(table_content(i).col_1 || ' ' || table_content(i).col_2 || ' ' || table_content(i).col_3 ); end loop; end; /

更多推荐

PL SQL如何选择所有列

本文发布于:2023-07-22 12:36:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187565.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何选择   PL   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!