Tables
col1| col2| col3| ...| coln
1 | 2 | 3 | ...| n
Display the name:
col1 col2 col3 ... coln
Tables
col1| col2| col3| ...| coln
1 | 2 | 3 | ...| n
Display the name:
col1 col2 col3 ... coln
I believe that pro oracle you need to use all_tab_cols
, see:
SELECT
column_name
FROM all_tab_cols
WHERE table_name = 'tabela'
This function is useful for developers because it generates an editable list for SQL
create or replace FUNCTION colunas (TABELA IN USER_TABLES.TABLE_NAME%TYPE,
PREFIXO IN VARCHAR2 DEFAULT NULL,
SUFIXO IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 IS
VS_SAI VARCHAR2(4000);
/*GERA LISTA COM AS COLUNAS DE UMA TABELA*/
BEGIN
FOR R IN (SELECT COLUMN_NAME
FROM USER_TAB_COLUMNS
WHERE TABLE_NAME = TABELA
ORDER BY COLUMN_ID)
LOOP
VS_SAI := VS_SAI || PREFIXO || R.COLUMN_NAME || SUFIXO ||',';
END LOOP;
VS_SAI := SUBSTR(VS_SAI,1,LENGTH(VS_SAI)-1);
RETURN VS_SAI;
END;
Make:
select columns ('') from dual