PRB: Error Creating Stored Procedure

ID Number: Q42624

1.00 1.10 1.11 4.20

OS/2

Summary:

SYMPTOMS

When using the following procedure as a stored procedure

Create procedure workshop as

use pubs

select * from authors

after pressing CTRL+E in SAF, the error message "USE statement

cannot be used in a stored procedure." Deleting the USE PUBS

command returns the error message "Unknown object authors."

RESOLUTION

When using stored procedures, you must be in the database that

you want the procedure to be executed in. This is also where

the procedure should be created. You must first enter USE PUBS,

then create the procedure. Now you can execute the procedure

as long as you are in the "pubs" database.