LoginSignup
0
0

More than 5 years have passed since last update.

ユーザー定義のテーブル名を取得 oracle

Last updated at Posted at 2018-07-04

oracleでユーザー定義の属性名を取得する

ユーザテーブルの取得
SELECT
    *
FROM
    user_tables
;
現行のユーザーが所有するテーブル、ビューおよびクラスタの列を取得
SELECT
  *
FROM
  user_tab_columns
;

これらを応用しつつ、テーブル構造を取得する。

SELECT
    table_name,
    column_name,
    data_type || '(' || nvl(data_precision,data_length) || '.' || nvl(data_scale,'0') ||')' as data_type
FROM
    user_tab_columns
WHERE
    not table_name like 'BIN$%'
;

table_name に BIN$ほにゃららを出さないようにしているのがミソ
別ブログに掲載していた記事をQiitaに掲載

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0