stored procedure는 데이터베이스에 저장되어 이름으로 실행되는 SQL 문(과 절차적 로직)의 집합입니다. 애플리케이션 코드가 아니라 데이터베이스 안에서 로직을 실행합니다. 실질적 이점이 있지만 상당한 트레이드오프도 있으므로, 언제 사용할지는 진정한 설계 결정입니다.
stored procedure
transfer_funds(from_id , to_id , amount )
plpgsql $$
accounts balance balance amount id from_id;
accounts balance balance amount id to_id;
;
$$;
transfer_funds(, , );
