I am new to DB2 and have been following directions from a book for creating a stored procedure. Things LOOK like they should work, but I am getting errors. What am I missing? I've worked with MS SQL, so the syntax on this is very different.. Any help would be appreciated!
CREATE PROCEDURE san.MeetingInsert ()
LANGUAGE SQL
im: BEGIN
DECLARE v1_alias varchar(25);
DECLARE v1_T_30 varchar(10);
DECLARE v1_T_14 varchar(10);
DECLARE v1_T_3 varchar (10);
DECLARE v2_ukey smallint;
DECLARE v2_alias varchar(25);
DECLARE v2_T_30 varchar(10);
DECLARE v2_T_14 varchar(10),
DECLARE v2_T_3 varchar (10);
DECLARE V2_RS_Status char(1);
DECLARE v2_RS_Date DATE;
DECLARE v2_RS_Time TIME;
DECLARE IMC CURSOR FOR
SELECT t1.ALIAS, t1.T_30, t1.T_14, t1.T_3, t2.ALIAS, t2.T_30, t2.T_14, t2.T_3,t2.RS_STATUS,t2.RS_Date,t2.RS_Time
from SAN.FS_MEETING_STG t1
left join SAN.FS_MEETING_DIM t2
on t1.ALIAS = t2.ALIAS;
OPEN IMC;
------------------------------------------------------------------------------
CREATE PROCEDURE san.MeetingInsert ()
LANGUAGE SQL
im: BEGIN
DECLARE v1_alias varchar(25)
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 "v1_alias
varchar(25)". Expected tokens may include: "<psm_semicolon>". LINE
NUMBER=4. SQLSTATE=42601
DECLARE v1_T_30 varchar(10)
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 "DECLARE v1_T_30 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v1_T_14 varchar(10)
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 "DECLARE v1_T_14 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v1_T_3 varchar (10)
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 "DECLARE v1_T_3 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_ukey smallint
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 "smallint" was found following "DECLARE v2_ukey
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE v2_alias varchar(25)
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 "DECLARE v2_alias varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_T_30 varchar(10)
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 "DECLARE v2_T_30 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_T_14 varchar(10), DECLARE v2_T_3 varchar (10)
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 "DECLARE v2_T_14 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE V2_RS_Status char(1)
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 "DECLARE V2_RS_Status char" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_RS_Date DATE
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 "DATE" was found following "DECLARE v2_RS_Date
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE v2_RS_Time TIME
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 "TIME" was found following "DECLARE v2_RS_Time
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE IMC CURSOR FOR SELECT t1.ALIAS, t1.T_30, t1.T_14, t1.T_3, t2.ALIAS, t2.T_30, t2.T_14, t2.T_3,t2.RS_STATUS,t2.RS_Date,t2.RS_Time from SAN.FS_MEETING_STG t1 left join SAN.FS_MEETING_DIM t2 on t1.ALIAS = t2.ALIAS
DB20000I The SQL command completed successfully.
OPEN IMC
DB20000I The SQL command completed successfully.
CREATE PROCEDURE san.MeetingInsert ()
LANGUAGE SQL
im: BEGIN
DECLARE v1_alias varchar(25);
DECLARE v1_T_30 varchar(10);
DECLARE v1_T_14 varchar(10);
DECLARE v1_T_3 varchar (10);
DECLARE v2_ukey smallint;
DECLARE v2_alias varchar(25);
DECLARE v2_T_30 varchar(10);
DECLARE v2_T_14 varchar(10),
DECLARE v2_T_3 varchar (10);
DECLARE V2_RS_Status char(1);
DECLARE v2_RS_Date DATE;
DECLARE v2_RS_Time TIME;
DECLARE IMC CURSOR FOR
SELECT t1.ALIAS, t1.T_30, t1.T_14, t1.T_3, t2.ALIAS, t2.T_30, t2.T_14, t2.T_3,t2.RS_STATUS,t2.RS_Date,t2.RS_Time
from SAN.FS_MEETING_STG t1
left join SAN.FS_MEETING_DIM t2
on t1.ALIAS = t2.ALIAS;
OPEN IMC;
------------------------------------------------------------------------------
CREATE PROCEDURE san.MeetingInsert ()
LANGUAGE SQL
im: BEGIN
DECLARE v1_alias varchar(25)
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 "v1_alias
varchar(25)". Expected tokens may include: "<psm_semicolon>". LINE
NUMBER=4. SQLSTATE=42601
DECLARE v1_T_30 varchar(10)
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 "DECLARE v1_T_30 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v1_T_14 varchar(10)
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 "DECLARE v1_T_14 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v1_T_3 varchar (10)
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 "DECLARE v1_T_3 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_ukey smallint
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 "smallint" was found following "DECLARE v2_ukey
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE v2_alias varchar(25)
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 "DECLARE v2_alias varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_T_30 varchar(10)
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 "DECLARE v2_T_30 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_T_14 varchar(10), DECLARE v2_T_3 varchar (10)
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 "DECLARE v2_T_14 varchar" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE V2_RS_Status char(1)
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 "DECLARE V2_RS_Status char" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<values>". LINE
NUMBER=1. SQLSTATE=42601
DECLARE v2_RS_Date DATE
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 "DATE" was found following "DECLARE v2_RS_Date
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE v2_RS_Time TIME
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 "TIME" was found following "DECLARE v2_RS_Time
". Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=1.
SQLSTATE=42601
DECLARE IMC CURSOR FOR SELECT t1.ALIAS, t1.T_30, t1.T_14, t1.T_3, t2.ALIAS, t2.T_30, t2.T_14, t2.T_3,t2.RS_STATUS,t2.RS_Date,t2.RS_Time from SAN.FS_MEETING_STG t1 left join SAN.FS_MEETING_DIM t2 on t1.ALIAS = t2.ALIAS
DB20000I The SQL command completed successfully.
OPEN IMC
DB20000I The SQL command completed successfully.