Article View: pl.comp.bazy-danych
Article #194342Re: Oracle zapytanie do tabeli wewnątrz triggera (mutating)
From: Daniel Gontarek
Date: Mon, 02 Mar 2015 12:43
Date: Mon, 02 Mar 2015 12:43
25 lines
1735 bytes
1735 bytes
W dniu 2015-02-28 o 10:02, Tdobe pisze: > Witam, > > Chciałbym w triggerze before delete sprawdzać czy kasowany rekord jest ostatnim. > > czyli coś takiego: > > select max(id) > into last_id > from table; > > if (last_id is not null and last_id <> :old.id) then > raise_exception(...) > end if; > > Jednak taka konstrukcja wywala mutację tabeli (w sumie racja bo odczyt tabeli ktora wlasnie jest zmieniana). Czy w takim przypadku deklaracja pragma autonomous_transaction jest dobrym wyjściem czy inaczej to można rozwiązać, ma ktoś pomysła? > > Tomek > Od wersji 11 jest dostępny mechanizm compound triggers. Może się przydać w takich problemach -- gont
Technical Details
Message-ID:
<54f45abf$0$19315$65785112@news.neostrada.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mailReferences:
<b4ff2e8e-8cce-4f92-bbc5-cab40f982e64@googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-b-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail Date: Mon, 02 Mar 2015 13:43:21 +0100 From: Daniel Gontarek <gont@plusnet.pl> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 Newsgroups: pl.comp.bazy-danych Subject: Re: Oracle zapytanie do tabeli wewnątrz triggera (mutating) References: <b4ff2e8e-8cce-4f92-bbc5-cab40f982e64@googlegroups.com> In-Reply-To: <b4ff2e8e-8cce-4f92-bbc5-cab40f982e64@googlegroups.com> Lines: 25 Message-ID: <54f45abf$0$19315$65785112@news.neostrada.pl> Organization: Telekomunikacja Polska NNTP-Posting-Host: isengard.shh.pl X-Trace: 1425300159 unt-rea-a-02.news.neostrada.pl 19315 193.239.58.153:52551 X-Complaints-To: abuse@news.neostrada.pl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit