SQL> CREATE VIEW NUM_OWNED
   2 AS SELECT UNIQUE OWNER_NAME, NUM_PETS(OWNER_NAME) NUM_OF_PETS
   3 FROM PETS_OWNERS;

View created.

SQL> exit


In this example I am creating a new VIEW called NUM_OWNED.
My SELECT statment contains a normal column from PETS_OWNERS and the
value RETURNED from my function NUM_PETS. A name must be assigned to
the column for the returned value. Here it is NUM_OF_PETS. I then
make my selection FROM PETS_OWNERS. The value passed to NUM_PETS is
the current ROW's OWNER_NAME.


Return to Functions