I'm trying to convert a table with a LONG column into a VARCHAR2 column and build a view off that in Oracle 11g. All the other examples I've been reading have shown how to do it in a SELECT
query, but never in a CREATE OR REPLACE FORCE VIEW
statement.
I can create views and objects under my user profile, and have successfully run a PL/SQL script that transformed the LONG field into a VARCHAR with the following script:
DECLARE
LONGCOMMENTS LONG;
VAR2 VARCHAR2(4000);
BEGIN
SELECT PGX.COMMENTS INTO LONGCOMMENTS FROM USER.PGX
WHERE ROWNUM < 100;
VAR2 := SUBSTR(LONGCOMMENTS, 1, 4000);
PGX.COMMENTS:=DBMS_OUTPUT.PUT_LINE(VAR2);
END;
However, I can't find a way to store the output into a view. I tried wrapping the above script into a CREATE VIEW
but Oracle can't handle it.
Any pointers on how to achieve this?