Jul 192013
  cursor wallet_contents is 
    select money 
    from   wallet
    for    update;
  baby_equipment_stores wallet%rowtype;
  open wallet_contents;
    fetch wallet_contents
    into  baby_equipment_stores;
    exit when wallet_contents%notfound;
  end loop;
  close wallet_contents;
Ah, the never-ending cycle of baby related paraphernalia to purchase.

create table wallet_contents (money number(10, 2));
insert into wallet_contents values (10);
cursor wallet is
select money
from wallet_contents
for update;

child_stores wallet%rowtype;
open wallet;

fetch wallet
into child_stores;
update wallet_contents
set money = money – 1
returning money into child_stores.money;
exit when child_stores.money <= 0; dbms_output.put_line(child_stores.money ); end loop; close wallet; end; / drop table wallet_contents purge;

  4 Responses to “The Cost Of Parenting”

  1. :-)

    at least you don’t have to worry about how to handle a NO_DATA_FOUND – exception ! ;-)

    wait until they are teens :'(

  2. Wow… money number(10, 2)… that’s promissing

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>