Search code examples
oracleuser-defined-types

CAST to package type


Is it possible to CAST to a type within a package? For example:

CAST(v_variable AS Mypackage.type)

I know CAST states the ability to cast to built-in types but I was wondering if this was possible. I'm interested in this approach because I prefer keeping my utilities in one package instead of having a separate TYPE object.

Thanks!


Solution

  • No. CAST() is a SQL function so we can only use it with SQL types. This means we cannot use it with types we have declared in a PL/SQL package.