0
Tables
col1| col2| col3| ...| coln
1 | 2 | 3 | ...| n
Display the name :
col1 col2 col3 ... coln
0
Tables
col1| col2| col3| ...| coln
1 | 2 | 3 | ...| n
Display the name :
col1 col2 col3 ... coln
3
I believe that pro oracle you need to use the all_tab_cols
, see:
SELECT
column_name
FROM all_tab_cols
WHERE table_name = 'tabela'
https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2093.htm
1
This Function is useful for developers as 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;
Do :
select columns('') from dual
Browser other questions tagged sql oracle pl-sql
You are not signed in. Login or sign up in order to post.
Your answer makes sense, but a reference would be welcome
– Jefferson Quesado