_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › PL/SQL螳

Contents

1 PL/SQL 襴
2 觚蟲譟
3
4 bulk collect


1 PL/SQL 襴 #

  • SQL螻殊 螳ロ 牛
  • 焔( 磯殊..)
  • 覲伎


  • れ れ 螻(覩碁Μ )
  • 螳豌伎 襦蠏碁覦 讌
  • 轟危襴貅伎螻 伎れ 讌

2 觚蟲譟 #

[declare
  -- declartions]
begin
  -- statements
[exception
  -- handlers]
end;

3 #


declare
  i number := 10;
  b boolean;
  str varchar(20);
  type varArrary is table of number index by pls_integer;
  comm_tab varArrary;

覲 螳 (讌)
declare
  i number := 10;
  b boolean;
  str varchar(20);
  type varArrary is table of number index by pls_integer;
  comm_tab varArrary;
begin
  i := i + 1;
  b := (i < 3);
  str := '伎';
  comm_tab(10) := 20*20;
end;

覲 螳 (into 伎)
declare 
    bonus number(8,2);
    emp_id number(6) := 100;
begin
    select salary * 0.10
    into bonus
    from employees
    where employee_id = emp_id;

    dbms_output.put_line('bonus = ' || bonus);
end;

覲 螳 豢
declare
  i number := 10;
  b boolean;
  str varchar(20);
  type varArrary is table of number index by pls_integer;
  comm_tab varArrary;
begin
  i := i + 1;
  b := (i < 3);
  str := '伎';
  comm_tab(10) := 20*20;
  
  dbms_output.put_line(i);
  if b = true then 
      dbms_output.put_line('true');
  else
      dbms_output.put_line('false');
  end if;
  dbms_output.put_line(str);
  dbms_output.put_line(comm_tab(10));
end;


declare
  credit_limit CONSTANT NUMBER := 5000.00;


4 bulk collect #

declare
  type type_job_id is table of hr.jobs.job_id%type index by pls_integer;
  type type_job_title is table of hr.jobs.job_title%type index by pls_integer;
  
  v_job_id type_job_id;
  v_job_title type_job_title;
  
  col1 char(13);
begin
  select job_id, job_title
  bulk collect into v_job_id, v_job_title
  from hr.jobs;

  for i in v_job_id.first .. v_job_id.last
  loop
      col1 := v_job_id(i);
      dbms_output.put_line('job_id = ' || col1 || '     job_title = ' || v_job_title(i));
  end loop;
end;
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

襷 譬 蟆螻 譬 覦朱 螳 豈. 襷 蟲滑唄 襷 豈企る 企讌讌 蟆 企 蟾.