APOCALYPSE Posted December 12, 2007 Report Share Posted December 12, 2007 Sveiki! Mana lielā milzu problēma ir tā, ka ja izpilda vienkāršas update UPDATE pavadzimes SET summa = daudzums*cena_m3; UPDATE pavedzimes SET PVN = 0.18 * SUMMA; visu ļoti forši sarēķina. Bet ja uztaisa iekš trigerfunkcijas, tad viss it kā uztaisās, CREATE TRIGGER "reizinaat" BEFORE INSERT OR UPDATE ON "pavadzimes" FOR EACH ROW EXECUTE PROCEDURE reikinaat(); CREATE FUNCTION reikinaat() RETURNS "opaque" AS ' BEGIN UPDATE pavadzimes SET summa = daudzums*cena_m3; UPDATE pavedzimes SET PVN = 0.18 * SUMMA; RETURN NEW; END; ' LANGUAGE PLPGSQL; bet mainot tos ciparus, errors tāds, ka neielien ekrānā :( Lūdzu izpalīdziet Link to comment Share on other sites More sharing options...
andrisp Posted December 12, 2007 Report Share Posted December 12, 2007 Varbūt iekopē tad šeit to erroru ? Un vispār, kas tā par dbvs ? Link to comment Share on other sites More sharing options...
APOCALYPSE Posted December 12, 2007 Author Report Share Posted December 12, 2007 PostgreSQL error: 2007-12-12 19:55:19 CONTEXT: SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" PL/pgSQL function "reikinaat" line 2 at SQL statement SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" PL/pgSQL function "reikinaat" line 2 at SQL statement SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" PL/pgSQL function "reikinaat" line 2 at SQL statement SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" PL/pgSQL function "reikinaat" line 2 at SQL statement SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" PL/pgSQL function "reikinaat" line 2 at SQL statement SQL statement "UPDATE pavadzimes SET summa = daudzums*cena_m3" un tā turpinās Link to comment Share on other sites More sharing options...
Delfins Posted December 12, 2007 Report Share Posted December 12, 2007 (edited) 1.) nafig pie katra inserta parrekjinat VISIEM ierakstiem summu un updeitot.. pilnigs marazms! 2.) lasi manuāli (RTFM) - http://www.postgresql.org/docs/8.0/interac...TEMENTS-PERFORM 3.) nav nekadas jegas uzsaukt 2 SQL, jo var uzreiz ari otro aprekinat Edited December 12, 2007 by Delfins Link to comment Share on other sites More sharing options...
APOCALYPSE Posted December 12, 2007 Author Report Share Posted December 12, 2007 Vai tu lūdzu nevarētu palīdzēt izlabot kļūdu? Jau pusdienu ap šito ņemos. Link to comment Share on other sites More sharing options...
Delfins Posted December 12, 2007 Report Share Posted December 12, 2007 tajā linkā ko iedevu viss ir uzrakstīts! Link to comment Share on other sites More sharing options...
Recommended Posts