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 ServletAJSP •ÒŽ‘—¿
¡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-2024 Y.SAK