userimage

“DESC TABLE_NAME” command in Oracle is not working with pl/sql block

I am using Oracle 11g R2 and i have been trying to execute the below given pl/sql procedure :-

SET SERVEROUTPUT ON

DECLARE

TABLENAME VARCHAR2(100) := "TABLE_NAME";

BEGIN

DESC TABLENAME; 

END;

/

Or

    SET SERVEROUTPUT ON

    DECLARE

    TABLENAME VARCHAR2(100) := "TABLE_NAME";

    BEGIN

    EXECUTE IMMEDIATE "DESC TABLENAME"; 

    END;

    /

I tried everything but continuously getting the error. Please help me. Thank you so much

userimage

If you have read access to user_tab_columns view, then this will return same. Verified just now.

          SELECT

          column_name "Name",

          nullable "Null?",

          concat(concat(concat(data_type,'('),data_length),')') "Type"

          FROM user_tab_columns

          WHERE table_name='TABLE_NAME';

Answer is