postgresql创建function使两个表互动
Jun 07, 2016 pm 02:59 PMpostgresql创建function使两个表互动 create function f_m_stockcurrent_post(character varying(32)) RETURNS integer as $$ declare rec record; begin update stockcurrent set units=units+(select handqty from shipmentinline sp inner join stockcurr
postgresql创建function使两个表互动
create function f_m_stockcurrent_post(character varying(32))
RETURNS integer
as
$$
declare
rec record;
begin
update stockcurrent set units=units+(select handqty from shipmentinline sp inner join stockcurrent st on st.product=sp.product where sp.documentno=$1);
for rec in (select sp.location,sp.handqty,sp.product from shipmentinline sp where sp.documentno=sp_documentno and not exists(select handqty from shipmentinline sp inner join stockcurrent st on st.product=sp.product where sp.documentno=$1)) loop
insert into stockcurrent(location,product,attributesetinstance_id,units)values(rec.location,rec.product,null,rec.handqty);
end loop;
end;
$$
language 'plpgsql' VOLATILE;
数据库中检验函数是否生效
select f_m_stockcurrent_post('123');

Article chaud

Outils chauds Tags

Article chaud

Tags d'article chaud

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Sujets chauds

Comment personnaliser votre iPhone sur le dernier iOS 17

Comment créer un diagramme de Gantt à l'aide de Highcharts

Comment créer une affiche de contact pour votre iPhone

Un premier aperçu de Django : créez votre premier projet Django en utilisant la ligne de commande

Comment créer une image de code de vérification en utilisant PHP ?
