I'm trying to learn plsql and got stuck in understanding some basic stuff. Here is a challenge that I'm trying to solve. I have two tables. One holds information about owners and the other is information about cars.

I want to to write an anonymous block that joins these two tables and with a for loop based on amount of cars that is registered to each owner prints how many cars each person own. furthermore I want an if statement which distinguishes between 1 Car (singular) and 2, 3 Cars (plural).

the tables are these:

```
CREATE TABLE owners(
    id_nr VARCHAR2(13) PRIMARY KEY,
    f_name VARCHAR2(20),
    s_name VARCHAR2(20)
);

CREATE TABLE cars(
    reg_nr VARCHAR2(6) PRIMARY KEY,
    id_nr REFERENCES owners(pnr),
    model VARCHAR2(20),
    year NUMBER(4),
    date DATE
);

```

The result may look like something like this:

```
19380321-7799, Hans, Anderson, Owns: 1 car
19490321-7899, Mike, Erikson, Owns: 2 cars

```

. . . etc

I know the this question was already answered but when I try following:

```
declare
    v_suffix varchar2(1);
begin
    for o in (select bilägare_pnr, fnamn, enamn,
                (select count(1) from fordon where fordon_pnr = bilägare_pnr) as bilar_ägda
                from bilägare)
    loop
        if o.pnr_fordon = 1 
            then v_suffix = 'bil'
            else v_suffix = 'bilar'
        end if;
        dbms_output.put_line(o.pnr || ', ' || o.fnamn || ', ' || o.enamn
            || ' Äger: ' || o.pnr_fordon || ' bil' || v_suffix);
    end loop;
end;
/

```

I get:

```
ORA-06550: line 9, column 27:
PLS-00103: Encountered the symbol "=" when expecting one of the following:

   := . ( @ % ; 

```

any tips? Im not sure how to declare v\_suffix

EDIT (copied from comment on answer below):
-------------------------------------------

Updating my code:

```
declare
  cursor c_BILÄGARE is
    select fnamn,enamn,pnr
      from BILÄGARE;
begin
  for rec in c_BILÄGARE loop
    if (rec.antal>1) then
     dbms_output.put_line (rec.pnr||','|| rec.fnamn || ',' ||
                           rec.enamn || ',' || rec.antal || 'bilar');
    else
      dbms_output.put_line (rec.pnr||','|| rec.fnamn || ',' ||
                            rec.enamn || ',' || rec.antal || 'bil');
    end if;
  end loop;
end;

```

getting:

```
ORA-06550: line 9, column 9: PLS-00302: component 'ANTAL' must be declared (antal=Quantity)

```