I'm starting programming in pl/sql and I have some problems. I'm making a database, which includes tables like:

```
TRAINS: ID_TRAIN, NAME, TYPE

CARS: ID_CAR, TYPE, SEATS, QUANTITY

TRAINS_W_CARS: ID_TRAIN (FK), ID_CAR (FK), QUANTITY

```

I want to make a procedure/function, which will decrease amount of available cars, when I add some to train.

For example: I have 50 available cars with 2 class, and when I add 5 of them to the some train, this amount will be decreased to 45.

To be honest, I don't really know how to go about it, because I have not done so complicated things this far.