Skip to content

Instantly share code, notes, and snippets.

@Jviejo
Created January 5, 2016 13:24
Show Gist options
  • Save Jviejo/8aa24050aabdfcdd84b9 to your computer and use it in GitHub Desktop.
Save Jviejo/8aa24050aabdfcdd84b9 to your computer and use it in GitHub Desktop.
genera type from user_tables oracle
select 'type ' || table_name || '_T is
record (' || chr(13) || listagg(column_name || ' ' ||
table_name ||'.'||column_name || '%type',','||chr(13))
within group (order by column_id)
|| '); ' || CHR(13) ||
'type '||TABLE_NAME||'_T_C is table of '||TABLE_NAME||'_T;' || CHR(13) ||
'T '||TABLE_NAME|| '_T_C;'
from user_tab_columns
where table_name = '<PONER EL NOMBRE DE LA TABLA>'
group by table_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment