Conditional commit inside functions

Поиск
Список
Период
Сортировка
От Gerhard Wiesinger
Тема Conditional commit inside functions
Дата
Msg-id alpine.LFD.1.10.0812251214420.31597@bbs.intern
обсуждение исходный текст
Ответы Re: Conditional commit inside functions  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: Conditional commit inside functions  (Gerhard Wiesinger <lists@wiesinger.com>)
Список pgsql-general
Hello!

I want to translate the following Oracle PL/SQL script into plpgsql.
Especially I'm having problems with the transaction thing. i tried START
TRANSACTION and COMMIT without success.

Any ideas?

Thanx.

Ciao,
Gerhard

CREATE OR REPLACE PROCEDURE insert_1Mio
IS
   maxcommit NUMBER;
BEGIN
   maxcommit := 10000;

   FOR i IN 1..1000000 LOOP
     INSERT INTO employee (id, department, firstname, lastname) VALUES (i, i, 'John' || to_char(i), 'Smith' ||
to_char(i));
     IF MOD(i, maxcommit) = 0 THEN
       COMMIT;
     END IF;
   END LOOP;

   COMMIT;
END;



--
http://www.wiesinger.com/


В списке pgsql-general по дате отправления:

Предыдущее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Information about Pages, row versions of tables, indices
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Conditional commit inside functions