Oracle Magazine, July/August 2018
Database Developer OPEN SOURCE New Pet Data 1 Duke 2 dog 2 Dragon 2 bird 4 Red 2 bird 6 Buster 2 dog 5 Red 3 horse 3 Sneaky 5 snake 7 Fido 7 cat Heres what delete py does Gets a cursor object from the connection Prepares a SQL UPDATE statement changing the owner to 2 Kim for the records with an owner of 1 Bob Updating is covered in Part 3 of this series Executes the statement using bind variables Prepares a SQL DELETE statement deleting records with an id of 1 Bob Executes the statement using bind variables Commits the transaction When you change data its a good idea to verify the number of affected rows This is covered in Part 2 of this series ANOTHER DEEPER DIVE Due to a zoning change snakes are no longer allowed in the area Stacey has decided to move and take Sneaky her snake with her Lets fix the data to reflect that When youre done the results should be Original People Data 2 Kim 27 I like birds 3 Cheryl 23 I like horses 4 Bob 27 I like rabbits 5 Stacey 45 I like snakes 6 Pete 23 I like cats 7 Pat 36 I like dogs ORACLE MAGAZINE JULY AUGUST 2018 105
You must have JavaScript enabled to view digital editions.