Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

User defined function returns VARCHAR2 with max size

vikramrathourJan 17 2019 — edited Jan 17 2019

Hello,

We are working on a migration project to migrate Sybase ASE 15 to Oracle 12.2.

The SQL Developer Migration utility generates a package named utils.convert_to_char() that can be used to convert non character data types to char. However, if we create a view like -

create or replace view test_view as

select utils.convert_to_char(numcol) as charcol

from tabname;

In this case the size of charcol is varchar2(32767). Internally convert_to_char() calls SUBSTR().

Is there a way where we can define a user defined function that returns a varchar2 with same size as numcol?

We cannot have the function converting to a fixed size as the column being passed could be a NUMBER, DATE, DECIMAL etc.

Thanks,

Vikram R

This post has been answered by BluShadow on Jan 17 2019
Jump to Answer
Comments
Post Details
Added on Jan 17 2019
6 comments
791 views