I am not able to create this DB2 SP. What is the issue with it? Not getting it I am not able to create this DB2 SP. What is the issue with it? 

I get the following error:


  Category   Timestamp   Duration    Message     Line  Position
  Error 18/12/2013 09:43:46     0:00:00.031  - DB2 Database Error: ERROR [42601] [IBM][DB2/AIX64] SQL0104N  An unexpected token "PROTECTION" was found following "M, CUST_PREMIUM FROM".  Expected tokens may include:  "INTO".  11    271


I need to create sp accepting 2 input parameters and using same in select to return data and if no data found the raise exception saying no data found.

CREATE PROCEDURE "PROTECTION"."GET_PROSPER_PRE_APP_CUSTOMERS"
(IN "I_FSA_REF"  VARCHAR(6), IN "I_CUST_ID" VARCHAR(20))
  LANGUAGE SQL
  NOT DETERMINISTIC
  EXTERNAL ACTION
  MODIFIES SQL DATA
  CALLED ON NULL INPUT
  INHERIT SPECIAL REGISTERS
  OLD SAVEPOINT LEVEL
BEGIN
    SELECT FSA_REF, CUST_ID, CUST_DATE_INSERTED, CUST_EXPIRY, CUST_TITLE, CUST_FORENAMES, CUST_SURNAME, CUST_ADDRESS_1, CUST_ADDRESS_2, CUST_ADDRESS_3, CUST_ADDRESS_4, CUST_COUNTRY, CUST_POSTCODE, CUST_EMAIL, CUST_SEX, CUST_DOB, CUST_SUM_INSURED, CUST_TERM, CUST_PREMIUM FROM "PROTECTION"."PROSPER_PRE_APP_CUSTOMERS"
    WHERE FSA_REF = I_FSA_REF AND CUST_ID = I_CUST_ID;

    DECLARE handler_type HANDLER FOR NOT FOUND
    BEGIN
       SET MESSAGE_TEXT = 'NO DATA FOUND WITH GIVEN CONDITIONS';
       EXIT;
    END IF;

END;
You cannot use a simple SELECT statement in compound SQL. It must be SELECT INTO. Another problem with your code is that all DECLARE statements must come before any other statements.