How do I list all the columns in a table?

You can list all the columns in a table in Oracle by querying the "user_tab_columns" data dictionary view. The following SQL query can be used:

SELECT column_name
FROM user_tab_columns
WHERE table_name = 'table_name';

You can also query the "all_tab_columns" view to list all tables accessible by the current user or the "dba_tab_columns" view to list all columns for all tables in the database.

SELECT column_name
FROM all_tab_columns
WHERE table_name = 'table_name';

SELECT column_name
FROM dba_tab_columns
WHERE table_name = 'table_name';

You can also query the "user_tab_columns" data dictionary view and return more information about the columns by selecting additional columns like data_type, data_length, nullable, etc.

SELECT column_name, data_type, data_length, nullable
FROM user_tab_columns
WHERE table_name = 'table_name';

In all of the above examples, you should replace "table_name" with the actual name of the table whose columns you want to list.

Also, starting from Oracle 18c, you can use the DESCRIBE command to list the column names and datatypes of the table.

DESCRIBE table_name

It is also worth noting that there are other ways to list columns, such as by using the "COLUMN" clause in a SELECT statement or by using the "DBMS_METADATA" package.