3 Replies Latest reply: Aug 5, 2014 4:34 AM by Frank Kulash RSS

    function return declared type

    Necronus

      Hi gurus

       

      I have a question, how can i return type in function which is declared inside, but not creating package and own type.

      For ex.:

       

      Create or replace function test_func

      return t_tab pipelined as

       

      type r_tab is record(

                          col1            test_tab.col1%type,

                          col2            test_tab.col2%type);

      type t_tab is table of r_tab;

      v_tab           t_tab;

      begin

      --some operations

      end test_func;

      Regards

        • 1. Re: function return declared type
          Frank Kulash

          Hi

          Necronus wrote:

           

          Hi gurus

           

          I have a question, how can i return type in function which is declared inside, but not creating package and own type.

          For ex.:

           

          Create or replace function test_func

          return t_tab pipelined as

           

          type r_tab is record(

                              col1            test_tab.col1%type,

                              col2            test_tab.col2%type);

          type t_tab is table of r_tab;

          v_tab           t_tab;

          begin

          --some operations

          end test_func;

          Regards

          You can't.  If you want t_tab to be available outside of test_func, then you must define it outside of test_func.

          • 2. Re: function return declared type
            SKP

            The return datatype should be a DB datatype or user defined datatype in package ...

            But how it will have a return type which is not defined in DB.

            You will always get the compilation error.

            • 3. Re: function return declared type
              Necronus

              Thanks all for answer