postgresql 匿名函數(單獨執行代碼段)


do LANGUAGE plpgsql
$$
declare
  top integer;
  row_org dbo.a_org_type%rowtype;
begin
  /* Insert real code here */
  select into row_org * from dbo.a_org_type order by id desc limit 1;
  top := row_org.id + 1;
  
  for idx in 1..5 loop
    insert into dbo.a_org_type(id, des) 
    values(top, 'shang hai ' || top);
    
    top := top + 1;
  end loop;
  
end;
$$

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM