• <bdo id='vnEHs'></bdo><ul id='vnEHs'></ul>
      <i id='vnEHs'><tr id='vnEHs'><dt id='vnEHs'><q id='vnEHs'><span id='vnEHs'><b id='vnEHs'><form id='vnEHs'><ins id='vnEHs'></ins><ul id='vnEHs'></ul><sub id='vnEHs'></sub></form><legend id='vnEHs'></legend><bdo id='vnEHs'><pre id='vnEHs'><center id='vnEHs'></center></pre></bdo></b><th id='vnEHs'></th></span></q></dt></tr></i><div id='vnEHs'><tfoot id='vnEHs'></tfoot><dl id='vnEHs'><fieldset id='vnEHs'></fieldset></dl></div>

        <small id='vnEHs'></small><noframes id='vnEHs'>

        <legend id='vnEHs'><style id='vnEHs'><dir id='vnEHs'><q id='vnEHs'></q></dir></style></legend>

        <tfoot id='vnEHs'></tfoot>

      1. 如何做一个函数来从 pl/sql 中的表中返回行类型?

        时间:2023-11-02

      2. <i id='ZshkF'><tr id='ZshkF'><dt id='ZshkF'><q id='ZshkF'><span id='ZshkF'><b id='ZshkF'><form id='ZshkF'><ins id='ZshkF'></ins><ul id='ZshkF'></ul><sub id='ZshkF'></sub></form><legend id='ZshkF'></legend><bdo id='ZshkF'><pre id='ZshkF'><center id='ZshkF'></center></pre></bdo></b><th id='ZshkF'></th></span></q></dt></tr></i><div id='ZshkF'><tfoot id='ZshkF'></tfoot><dl id='ZshkF'><fieldset id='ZshkF'></fieldset></dl></div>

            • <bdo id='ZshkF'></bdo><ul id='ZshkF'></ul>

              <small id='ZshkF'></small><noframes id='ZshkF'>

                <tbody id='ZshkF'></tbody>
              <tfoot id='ZshkF'></tfoot>
              <legend id='ZshkF'><style id='ZshkF'><dir id='ZshkF'><q id='ZshkF'></q></dir></style></legend>
                  本文介绍了如何做一个函数来从 pl/sql 中的表中返回行类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了这个函数,但是当我执行它时它返回一个错误!

                  I made this function but it return an error when i execute it!

                  create or replace function get_accounts
                  (Acc_id in Account1.account_id%Type)
                  return account1%rowtype
                  as
                  l_cust_record account1%rowtype;
                  begin
                  select * into l_cust_record from account1
                  where account_id=Acc_id;
                  return(l_cust_record);
                  end;
                  /
                  

                  推荐答案

                  Oracle 设置:

                  CREATE TABLE account1 (
                   account_id INT,
                   name       VARCHAR2(20)
                  );
                  
                  INSERT INTO account1 VALUES ( 1, 'Bob' );
                  
                  CREATE OR REPLACE FUNCTION get_accounts(
                    Acc_id IN Account1.account_id%TYPE
                  ) RETURN account1%ROWTYPE
                  AS
                    l_cust_record account1%ROWTYPE;
                  BEGIN
                    SELECT *
                    INTO   l_cust_record
                    FROM   account1
                    WHERE  account_id = Acc_id;
                  
                    RETURN l_cust_record;
                  END;
                  /
                  

                  PL/SQL 块:

                  DECLARE
                    r_acct ACCOUNT1%ROWTYPE;
                  BEGIN
                    r_acct := get_accounts( 1 );
                    DBMS_OUTPUT.PUT_LINE( r_acct.name );
                  END;
                  /
                  

                  输出:

                  Bob
                  

                  这篇关于如何做一个函数来从 pl/sql 中的表中返回行类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:表函数和流水线函数的区别? 下一篇:在 PL/SQL 中并行化调用

                  相关文章

                  1. <small id='maEAt'></small><noframes id='maEAt'>

                    <legend id='maEAt'><style id='maEAt'><dir id='maEAt'><q id='maEAt'></q></dir></style></legend>

                      <bdo id='maEAt'></bdo><ul id='maEAt'></ul>
                  2. <tfoot id='maEAt'></tfoot>

                    1. <i id='maEAt'><tr id='maEAt'><dt id='maEAt'><q id='maEAt'><span id='maEAt'><b id='maEAt'><form id='maEAt'><ins id='maEAt'></ins><ul id='maEAt'></ul><sub id='maEAt'></sub></form><legend id='maEAt'></legend><bdo id='maEAt'><pre id='maEAt'><center id='maEAt'></center></pre></bdo></b><th id='maEAt'></th></span></q></dt></tr></i><div id='maEAt'><tfoot id='maEAt'></tfoot><dl id='maEAt'><fieldset id='maEAt'></fieldset></dl></div>