procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
procedure PROCESS_TRANS(p_account_id in number, p_operator_id in number, p_sum in number, o_result out number) is l_cnt number; cursor cur_account is select id from pay_account where id = p_account_id for update of balance; cursor cur_operator is select id from pay_operator where id = p_operator_id and total >= p_sum for update of total; begin o_result := -1; -- tansaction begins select count (1) -- if such operator exist? into l_cnt from pay_operator opr where opr.id = p_operator_id; if (l_cnt != 1) then o_result := -2; -- Operator not found! return ; end if ; open cur_account; open cur_operator; fetch cur_account into l_cnt; -- need to fetch to update rows later fetch cur_operator into l_cnt; -- 0/1 row in cursor as selected by prim_key if cur_account%notfound then o_result := -3; -- Account not found! elsif cur_operator%notfound then o_result := -4; -- Operator has not enough money else update pay_account set balance = (balance + p_sum) where current of cur_account; update pay_operator set total = (total - p_sum) where current of cur_operator; insert into pay_transaction ( id, account_id, operator_id, money, datetime ) values ( pay_transaction_seq.nextval, p_account_id, p_operator_id, p_sum, sysdate ); commit ; o_result := 1; -- transaction successfully finished! end if ; close cur_account; close cur_operator; end ; * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- const char * bind_address = ": 9000" ;
- const char * db_user_name = "orauser" ;
- const char * db_password = "pass" ;
- const char * db_conn_str = "comp: 1521 / xe" ;
- int main ( int argc, char * const argv [])
- {
- using namespace oracle :: occi;
- int listenQueueBacklog = 4000;
- FCGX_Request request;
- if (FCGX_Init ())
- exit (1);
- int listen_socket = FCGX_OpenSocket (bind_address, listenQueueBacklog);
- if (listen_socket <0)
- exit (1);
- if (fchmod (listen_socket, S_IROTH | S_IWOTH))
- exit (1);
- if (FCGX_InitRequest (& request, listen_socket, 0)) exit (1);
- Environment * env = Environment :: createEnvironment (Environment :: DEFAULT);
- Connection * conn = env-> createConnection (db_user_name, db_password, db_conn_str);
- Statement * stmt = conn-> createStatement (
- "BEGIN PAY_SYS.PROCESS_TRANS (: v1,: v2,: v3,: v4); END;" );
- while (FCGX_Accept_r (& request) == 0)
- {
- bool noException = false , succesful = false ;
- long start = GetTickCount ();
- char * params = FCGX_GetParam ( "QUERY_STRING" , request.envp);
- int operatorID, accountID, moneySum, result = -1;
- operatorID = GetIntParam ( params , "operator =" );
- accountID = GetIntParam ( params , "account =" );
- moneySum = GetIntParam ( params , "money =" );
- if (operatorID <= 0 || accountID <= 0 || moneySum <= 0)
- {
- FCGX_FPrintF (request. Out , "HTTP / 1.0 503 Params Error \ n" );
- FCGX_FPrintF (request. Out , "Content-type: text / html \ r \ n \ r \ n" );
- FCGX_FPrintF (request. Out , "wrong params <br> \ n" );
- FCGX_Finish_r (& request);
- continue ;
- }
- try
- {
- stmt-> setInt (1, accountID);
- stmt-> setInt (2, operatorID);
- stmt-> setInt (3, moneySum);
- stmt-> registerOutParam (4, OCCIINT, sizeof (result));
- stmt-> execute ();
- result = stmt-> getInt (4);
- if (result == 1)
- succesful = true ;
- }
- catch (SQLException & sqlExcp)
- {
- error_log (sqlExcp.getMessage (). c_str ());
- }
- if (succesful)
- {
- FCGX_FPrintF (request. Out , "HTTP / 1.0 200 OK \ n" );
- FCGX_FPrintF (request. Out , "Content-type: text / html \ r \ n \ r \ n" );
- FCGX_FPrintF (request. Out , "SQL result =% d" , result);
- }
- else
- {
- FCGX_FPrintF (request. Out , "HTTP / 1.0 503 DatabaseError \ n" );
- FCGX_FPrintF (request. Out , "Content-type: text / html \ r \ n \ r \ n" );
- FCGX_FPrintF (request. Out , "Database error occured" );
- error_log ( "db error" );
- }
- FCGX_Finish_r (& request);
- }
- conn-> terminateStatement (stmt);
- env-> terminateConnection (conn);
- Environment :: terminateEnvironment (env);
- return 0;
- }
* This source code was highlighted with Source Code Highlighter .
- // option WITHOUT setting support via nginx.conf and error PROCESSING
- #include <ngx_config.h>
- #include <ngx_core.h>
- #include <ngx_http.h>
- #include < string .h>
- #include <oci.h>
- const text * db_user_name = ( const text *) "orauser" ;
- const text * db_password = ( const text *) "pass" ;
- const text * db_conn_str = ( const text *) "comp: 1521 / xe" ;
- const text * command = ( const text *)
- "BEGIN PAY_SYS.PROCESS_TRANS (: v1,: v2,: v3,: v4); END;" ;
- OCIEnv * env;
- OCISvcCtx * context;
- OCISession * session;
- OCIServer * server;
- OCIError * error;
- OCIStmt * statement;
- OCIBind * bnd1, * bnd2, * bnd3, * bnd4;
- int operatorID, accountID, sum, result;
- static char * ngx_http_payment_init (ngx_conf_t * cf,
- ngx_command_t * cmd, void * conf);
- // array of possible module options in nginx.conf
- static ngx_command_t ngx_http_payment_commands [] =
- { // set only one main option, including the module in the specified Location
- {ngx_string ( "payment_enabled" ),
- NGX_HTTP_LOC_CONF | NGX_CONF_NOARGS,
- ngx_http_payment_init,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- Null}
- ngx_null_command // terminates an array
- };
- // callback, don't use
- static ngx_http_module_t ngx_http_payment_module_ctx =
- {
- NULL, / * preconfiguration * /
- NULL, / * postconfiguration * /
- NULL, / * create main configuration * /
- NULL, / * init main configuration * /
- NULL, / * create server configuration * /
- NULL, / * merge server configuration * /
- NULL, / * create location configuration * /
- NULL / * merge location configuration * /
- };
- // module handle, includes all parameters
- ngx_module_t ngx_http_payment_module =
- {
- NGX_MODULE_V1,
- & ngx_http_payment_module_ctx, / * module context * /
- ngx_http_payment_commands, / * module directives * /
- NGX_HTTP_MODULE, / * module type * /
- NULL, / * init master * /
- NULL, / * init module * /
- NULL, / * init process * /
- NULL, / * init thread * /
- NULL, / * exit thread * /
- NULL, / * exit process * /
- NULL, / * exit master * /
- NGX_MODULE_V1_PADDING
- };
- void SetCallParams ( int oper, int account, int money)
- {
- if (bnd1! = 0) OCIHandleFree ((dvoid *) bnd1, OCI_HTYPE_BIND);
- if (bnd2! = 0) OCIHandleFree ((dvoid *) bnd2, OCI_HTYPE_BIND);
- if (bnd3! = 0) OCIHandleFree ((dvoid *) bnd3, OCI_HTYPE_BIND);
- if (bnd4! = 0) OCIHandleFree ((dvoid *) bnd4, OCI_HTYPE_BIND);
- // copy from the stack to be able to pass a valid pointer
- result = 0;
- operatorID = oper;
- accountID = account;
- sum = money;
- // bind the parameters to the SQL call
- OCIBindByPos (statement, & bnd1, error, 1, & accountID,
- sizeof (accountID), SQLT_INT, (dvoid *) 0,
- (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
- OCIBindByPos (statement, & bnd2, error, 2, & operatorID,
- sizeof (operatorID), SQLT_INT, (dvoid *) 0,
- (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
- OCIBindByPos (statement, & bnd3, error, 3, & sum, sizeof (sum), SQLT_INT,
- (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0,
- (ub4 *) 0, OCI_DEFAULT);
- OCIBindByPos (statement, & bnd4, error, 4, & result, sizeof (result), SQLT_INT,
- (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
- }
- // main handler, all work is done here
- static ngx_int_t ngx_http_payment_handler (ngx_http_request_t * r)
- {
- // clear the body section
- ngx_int_t rc = ngx_http_discard_request_body (r);
- if (rc! = NGX_OK && rc! = NGX_AGAIN)
- {
- ngx_log_error (NGX_LOG_ERR, r-> connection-> log, 0,
- "Failed ngx_http_discard_request_body ()" );
- return rc;
- }
- // strings in nginx are stored as a pair length-data,
- // not as traditional C-style zero-end
- // copy for the parser to work
- const int buflen = 100;
- char buf [buflen + 1];
- int len = (r-> args.len <buflen)? r-> args.len: buflen;
- buf [len] = '\ 0' ;
- ngx_memcpy (buf, r-> args.data, r-> args.len);
- int successful = 0;
- int operator , abonent, money, result = -1;
- // call the simplest parser
- operator = GetIntParam (buf, "operator =" );
- abonent = GetIntParam (buf, "abonent =" );
- money = GetIntParam (buf, "money =" );
- if ( operator > 0 && abonent> 0 && money> 0)
- {
- SetCallParams ( operator , abonent, money);
- int retCode = OCIStmtExecute (
- context, statement, error, (ub4) 1, (ub4) 0,
- (OCISnapshot *) NULL, (OCISnapshot *) NULL,
- (ub4) OCI_COMMIT_ON_SUCCESS);
- if (retCode == OCI_SUCCESS)
- successful = 1;
- }
- r-> headers_out.content_type.len = sizeof ( "text / html" ) - 1;
- r-> headers_out.content_type.data = (u_char *) "text / html" ;
- r-> headers_out.content_length_n = 0;
- if (successful == 1)
- r-> headers_out.status = NGX_HTTP_OK;
- else
- r-> headers_out.status = NGX_HTTP_INTERNAL_SERVER_ERROR;
- // ... forming the body of the response and sending it to nginx .. see emiller examples
- }
- static char * ngx_http_payment_init (ngx_conf_t * cf,
- ngx_command_t * cmd,
- void * our_conf)
- {
- // set nginx handler
- ngx_http_core_loc_conf_t * core_conf =
- ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module);
- core_conf-> handler = ngx_http_payment_handler;
- // oracle
- bnd1 = (OCIBind *) 0;
- bnd2 = (OCIBind *) 0;
- bnd3 = (OCIBind *) 0;
- bnd4 = (OCIBind *) 0;
- OCIEnvCreate ((OCIEnv **) & env, (ub4) OCI_DEFAULT,
- (dvoid *) 0, (dvoid * (*) (dvoid *, size_t)) 0,
- (dvoid * (*) (dvoid *, dvoid *, size_t)) 0,
- ( void (*) (dvoid *, dvoid *)) 0, (size_t) 0, (dvoid **) 0);
- / * allocate a server handle * /
- OCIHandleAlloc ((dvoid *) env, (dvoid **) & server,
- OCI_HTYPE_SERVER, 0, (dvoid **) 0);
- / * allocate an error handle * /
- OCIHandleAlloc ((dvoid *) env, (dvoid **) & error,
- OCI_HTYPE_ERROR, 0, (dvoid **) 0);
- / * create a server context * /
- int retCode = OCIServerAttach (server, error, db_conn_str,
- strlen (( const char *) db_conn_str), OCI_DEFAULT);
- / * allocate a service handle * /
- retCode = OCIHandleAlloc ((dvoid *) env, (dvoid **) & context,
- OCI_HTYPE_SVCCTX, 0, (dvoid **) 0);
- / * set the server attribute in the service context * /
- retCode = OCIAttrSet ((dvoid *) context, OCI_HTYPE_SVCCTX,
- (dvoid *) server, (ub4) 0, OCI_ATTR_SERVER, error);
- / * allocate a user session handle * /
- retCode = OCIHandleAlloc ((dvoid *) env, (dvoid **) & session,
- OCI_HTYPE_SESSION, 0, (dvoid **) 0);
- // set up user & password for our session
- retCode = OCIAttrSet ((dvoid *) session, OCI_HTYPE_SESSION,
- ( void *) db_user_name, (ub4) strlen (( const char *) db_user_name),
- OCI_ATTR_USERNAME, error);
- retCode = OCIAttrSet ((dvoid *) session, OCI_HTYPE_SESSION,
- ( void *) db_password, (ub4) strlen (( const char *) db_password),
- OCI_ATTR_PASSWORD, error);
- // start session
- retCode = OCISessionBegin (context, error, session,
- OCI_CRED_RDBMS, OCI_DEFAULT);
- / * set the user session attribute in the service context * /
- retCode = OCIAttrSet ((dvoid *) context, OCI_HTYPE_SVCCTX,
- (dvoid *) session, (ub4) 0,
- OCI_ATTR_SESSION, error);
- OCIHandleAlloc ((dvoid *) env, (dvoid **) & statement,
- OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0);
- OCIStmtPrepare (statement, error, command, (ub4) strlen (( char *) command),
- (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
- return NGX_CONF_OK;
- }
Source: https://habr.com/ru/post/69974/
All Articles