Executing an oracle variable string as I do in SQL Server In SQL Server I can do something like:

DECLARE @VAR VARCHAR(100);

SELECT @VAR = SELECT * FROM SYS.DATABASES

EXECUTE(@VAR)


How can I execute a string that I've created inside a variable in Oracle?

This is the query:

DECLARE BUSCACOLUNA  VARCHAR(2000);
BEGIN

 BUSCACOLUNA:= 'SELECT  '' SELECT '' || LTRIM(listagg ( '' , '' || ''"'' || T1.COLUMN_NAME || ''"'' || '' AS '' ||''"''|| T2.DESCRICAO ||''"''  ) within group  ( order by t1.column_name ),'' , '') || '' FROM TABELA_ENTRADA ''
  FROM ALL_TAB_COLUMNS T1
    INNER JOIN TABBASE T2
      ON T1.COLUMN_NAME=T2.NO_COL_TABBASE
    WHERE T1.TABLE_NAME=''TABELA_ENTRADA''
    AND T2.CD_CONTEUDO_ARQUIVO= ''X''';


 END;


The result of that dynamic SQL is something like:

  SELECT C1 AS B1, C2 AS B2...FROM TABLE


And I would like to execute this SELECT by executing the VARIABLE.

I tried with a loop, with EXECUTE IMMEDIATE but the query only returns:


  anonymous block completed


So I can understand it's working. If it was an UPDATE or INSERT, it would work, But I would like the return of that.
In Oracle you use (for dynamic SQL):

BEGIN
    EXECUTE IMMEDIATE


Or 

BEGIN
    DBMS_SQL.EXECUTE()


Like the examples here: https://www.guru99.com/dynamic-sql-pl-sql.html