Table variable in Oracle stored procedure

后端 未结 2 1491
臣服心动
臣服心动 2021-01-19 04:38

I\'m new to Oracle and I need to translate my SQL Server stored procedure to oracle. In SQL Server, I have function that returns a table variable.

Executing looks l

相关标签:
2条回答
  • 2021-01-19 05:13

    ValTBL is so-called nested table. To load data in it please use BULK COLLECT option.

    Example:

    SELECT * BULK COLLECT INTO tblTSVal FROM TABLE(dbMis.fn_ag_valuesToTable(tsVal));
    

    But that is not root of the "Table or view does not exist." error problem. Please check your rights to execute dbMis.fn_ag_valuesToTable function.

    To use pl/sql function as a table is worth to read about pipelined and parallel table functions. http://docs.oracle.com/cd/E11882_01/appdev.112/e10765/pipe_paral_tbl.htm#ADDCI2140

    0 讨论(0)
  • 2021-01-19 05:16

    I haven't tried this, but since you're not returning the query results directly as output (ie you're executing a command), what if you wrapped it in a PL/SQL block?

    BEGIN
      execute immediate 'insert into tblTSVal(stValue, itemKey, props) ' ||
        'select * from ' || dbMis.fn_ag_valuesToTable(tsVal);
    END;
    /
    

    I'm assuming dbMis.fn_ag_valuesToTable is a function.

    0 讨论(0)
提交回复
热议问题