I am trying to use the CAST
function to convert the output of a column in a query, from VARCHAR2
(255 CHAR) to VARCHAR2
of a variable length, the final number being returned by a sub-query, like this:
SELECT CAST(Title as VARCHAR2(SELECT MAX(LENGTH(Title)) FROM Books))
FROM Books;
Does anyone know if it is possible for me to format the output as a VARCHAR2 with the length returned by the sub query? For the example above I keep getting errors but there might be other ways.