SAK }‘ŠŲ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠŲEƒJƒtƒF ˆę—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

Oracle PL/SQL •Ō13 - ƒe[ƒuƒ‹\‘Ē•\ŽĶA€–ÚŒŸõ•\ŽĶAuser_tab_columns

ĄUSER_TAB_COLUMNS

  EUSER_TAB_COLUMNS ‚ð—˜—p‚ĩ‚āAƒe[ƒuƒ‹\‘Ē‚ð•\ŽĶ‚·‚é‚ɂ́AŽŸ‚Ė‚æ‚Ī‚É
    ‚·‚éBŪA\‘Ē•\ŽĶƒe[ƒuƒ‹–ž‚́A‰pŽš‚ðŽ•ķŽš‚ÅŽw’č‚·‚é‚ą‚ƁB

set serveroutput on;

declare

  tbl  varchar2(200) := 'ƒeƒXƒgm';  -- \‘Ē•\ŽĶƒe[ƒuƒ‹–ž

  cursor cu is select
    lower(table_name) as ƒe[ƒuƒ‹–ž,
    column_name as €–Ú–ž,
    lower(data_type) as €–Úƒ^ƒCƒv,
    nvl(data_precision, char_col_decl_length) as ’·‚ģ,
    data_scale as Ž”•”
    from user_tab_columns
    where lower(table_name) = tbl
    order by table_name, column_id;

begin

-- ƒe[ƒuƒ‹\‘Ē•\ŽĶ
  dbms_output.put_line('===========================================================================');
  dbms_output.put_line('ƒe[ƒuƒ‹ - ' || tbl);
  dbms_output.put_line('===========================================================================');
  dbms_output.put_line('€–Ú–ž                                   ƒ^ƒCƒv                 ’·‚ģ Ž”•”');
  dbms_output.put_line('---------------------------------------------------------------------------');
  for cu_rec in cu loop
    dbms_output.put_line(
      rpad(cu_rec.€–Ú–ž, 40) || ' ' ||
      rpad(cu_rec.€–Úƒ^ƒCƒv, 20) || ' ' ||
      to_char(cu_rec.’·‚ģ, '99999') || ' ' ||
      to_char(cu_rec.Ž”•”, '99999')
    );
  end loop;
  dbms_output.put_line('===========================================================================');

end;
/

-- ˆ—Œ‹‰Ę --
===========================================================================
ƒe[ƒuƒ‹ - ƒeƒXƒgm
===========================================================================
€–Ú–ž                                   ƒ^ƒCƒv                 ’·‚ģ Ž”•”
---------------------------------------------------------------------------
ƒL[                                     char                      8
ƒf[ƒ^1                                  number                    9      0
ƒf[ƒ^2                                  number                    9      0
ƒf[ƒ^3                                  number                    9      0
===========================================================================

  EUSER_TAB_COLUMNS ‚ð—˜—p‚ĩ‚āA€–Ú’č‹`‚ðŒŸõ•\ŽĶ‚·‚é‚ɂ́AŽŸ‚Ė‚æ‚Ī‚É
    ‚·‚éBŪA’č‹`•\ŽĶ€–Ú–ž‚́A‰pŽš‚ðŽ•ķŽš‚ÅŽw’č‚·‚é‚ą‚ƁB

set serveroutput on;

declare

  fld  varchar2(200) := 'ƒf[ƒ^';  -- ’č‹`•\ŽĶ€–Ú–ž

  cursor cu is select
    lower(table_name) as ƒe[ƒuƒ‹–ž,
    column_name as €–Ú–ž,
    lower(data_type) as €–Úƒ^ƒCƒv,
    nvl(data_precision, char_col_decl_length) as ’·‚ģ,
    data_scale as Ž”•”
    from user_tab_columns
    where instr(lower(column_name), fld) > 0
    order by table_name, column_id;

begin

-- €–Ú’č‹`•\ŽĶ
  dbms_output.put_line('===========================================================================');
  dbms_output.put_line('€–Ú - ' || fld);
  dbms_output.put_line('===========================================================================');
  dbms_output.put_line('ƒe[ƒuƒ‹–ž          €–Ú–ž               ƒ^ƒCƒv                 ’·‚ģ Ž”•”');
  dbms_output.put_line('---------------------------------------------------------------------------');
  for cu_rec in cu loop
    dbms_output.put_line(
      rpad(cu_rec.ƒe[ƒuƒ‹–ž, 19) || ' ' ||
      rpad(cu_rec.€–Ú–ž, 20) || ' ' ||
      rpad(cu_rec.€–Úƒ^ƒCƒv, 20) || ' ' ||
      to_char(cu_rec.’·‚ģ, '99999') || ' ' ||
      to_char(cu_rec.Ž”•”, '99999')
    );
  end loop;
  dbms_output.put_line('===========================================================================');

end;
/

-- ˆ—Œ‹‰Ę --
===========================================================================
€–Ú - ƒf[ƒ^
===========================================================================
ƒe[ƒuƒ‹–ž          €–Ú–ž               ƒ^ƒCƒv                 ’·‚ģ Ž”•”
---------------------------------------------------------------------------
ƒR[ƒhm             ƒf[ƒ^               varchar2                200
ƒeƒXƒgm             ƒf[ƒ^1              number                    9      0
ƒeƒXƒgm             ƒf[ƒ^2              number                    9      0
ƒeƒXƒgm             ƒf[ƒ^3              number                    9      0
===========================================================================

ĄOracle PL/SQL •ŌŽ‘—ŋ
ĄSQL Šî‘bŽĀ’n•ŌŽ‘—ŋ
ĄSQL Šî‘b•ŌŽ‘—ŋ
ĄSQL ƒ`ƒ…[ƒjƒ“ƒO•ŌŽ‘—ŋ
ĄPostgreSQL •ŌAJAVA ServletAJSP •ŌŽ‘—ŋ
ĄMySQL •ŌŽ‘—ŋ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠŲEƒJƒtƒF ˆę—— SAK Streets ŒŸõ



Copyright (C) 1999-2017 Y.SAK