How to create a DB2 stored procedure in SQL with following conditions?

Viewed 17217

I am new to this. Please do not downvote question.

I have created a table named 'FormData' which contains following fields Reviewer, AgencyName, Name, Email, Phone and all of type varchar. I have to retrieve all rows from FORMDATA where Reviewer is equal to the value of Reviewer given by the user.

I have written following code but I am not getting what is the problem in this.

CREATE PROCEDURE GetFormData( INOUT Reviewer varchar,
                              INOUT AgencyName varchar,
                              INOUT Name varchar,
                              INOUT Email varchar,
                              INOUT Phone varchar)
LANGUAGE SQL
P1:BEGIN
DECLARE v_Reviewer varchar;
SET v_Reviewer=Reviewer;
SELECT * FROM TRAININGDB.FormData
WHERE Reviewer=v_Reviewer;
END P1

The error I received after this is:

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "END-OF-STATEMENT" was found following "Reviewer varchar"

We are using DB2 in WebSphere server and the remaining details are. Product Identifier: SQL09075 DB2 v9.7.500.702 JDK 1.6 OS: Windows 7

1 Answers
Related