sql >> Base de Datos >  >> RDS >> Oracle

Oracle PLSQL devuelve un tipo de fila

lo definió como objeto a nivel de base de datos, por lo que este objeto debe inicializarse.

Puede hacer esto para inicializarlo con null valores antes de hacer su selección de la siguiente manera:

row_type := foo_type(null,null)

Pero la solución más adecuada aquí sería cambiar la selección a lo siguiente:

select
 foo_type(b1,b2)  -- Create a foo_type from the select
into 
 row_type -- throw this initialized foo_type into your variable row_type
from 
 table_xxx 
where 
 rownum=1; --Only one row!