Friday, 15 March 2013

sql - Print only first unique value for column that ORDER BY in Oracle sqlplus -



sql - Print only first unique value for column that ORDER BY in Oracle sqlplus -

this script dump tables columns , comments oracle (what do: dump schema ddl in human readable format without dependency on external tools, sqlplus, want commit script svn team fellow member can utilize it):

select dt.table_name, dt.column_name, dt.data_type, dt.data_length, comm.comments user_col_comments comm, user_tab_columns dt dt.table_name = comm.table_name , dt.column_name = comm.column_name order dt.table_name;

output like:

tbl111 col11 ... tbl111 col22 ... tbl222 col11 ... tbl222 col22 ... tbl222 col33 ... tbl333 col11 ...

to create more readable way skip unnecessary tblxxx words:

tbl111 col11 ... col22 ... tbl222 col11 ... col22 ... col33 ... tbl333 col11 ...

any suggestion?

when generate study using sql*plus can utilize break on columnname suppress duplicates in query results.

sql oracle sqlplus ddl

No comments:

Post a Comment