Querying a Nested Table

前端 未结 2 1005
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-20 23:37

I\'m trying my hand at querying a NESTED TABLE using PL/SQL (which I\'m told by several sources is possible) but I keep getting the error message:

相关标签:
2条回答
  • 2021-01-21 00:05

    I don't understand the specific error you are getting, but generally you need to include an explicit cast to the appropriate type in the SQL statement:

    open O_CURSOR for select * from table(CAST(dados AS t_pontos));
    

    This is because the statement is handed off from PL/SQL to the SQL engine for processing, and it has no information about the type of the variable beyond it being user-defined.

    Also, this only works if the type (t_pontos) is declared at the schema level, i.e. with a CREATE TYPE statement. If it is declared somewhere in PL/SQL code, e.g. in a package specification, the SQL engine cannot access the type definition.

    0 讨论(0)
  • 2021-01-21 00:08

    Try defining your cursor in the beginning of your procedure and open it in the body of your procedure.

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