Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about Sql Procedure

Status
Not open for further replies.

aaajjj

Programmer
Dec 21, 2000
1
US
I have Db2 7.1 and the following script I try to execute

CREATE PROCEDURE aaww()
BEGIN
DECLARE i INTEGER DEFAULT 1;
ins_loop:
LOOP IF i>100 THEN
LEAVE ins_loop;
ELSEIF i<=100 THEN
ITERATE ins_loop;
END IF;
INSERT INTO TAB1 VALUES (i,'FIRST VALUES');
SET i = i + 1;
END LOOP;
END@

and getting error
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 &quot;BEGIN&quot; was found following &quot;ATE PROCEDURE aaww()&quot;. Expected tokens may include: &quot;<proc_attribute_list>&quot;. LINE NUMBER=1. SQLSTATE=42601
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 &quot;i&quot; was found following &quot;DECLARE &quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601
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 &quot;: LOOP IF i>100 THEN LEAVE ins_loop;&quot; was found following &quot;ins_loop&quot;. Expected tokens may include: &quot;<space>&quot;. SQLSTATE=42601
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 &quot;i&quot; was found following &quot;ELSEIF &quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601
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 &quot;IF&quot; was found following &quot;END &quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601
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 &quot;;&quot; was found following &quot;S (I,'FIRST VALUES')&quot;. Expected tokens may include: &quot;END-OF-STATEMENT&quot;. SQLSTATE=42601
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0206N &quot;I&quot; is not valid in the context where it is used. SQLSTATE=42703
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 &quot;LOOP&quot; was found following &quot;END &quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601
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 &quot;END-OF-STATEMENT&quot; was found following &quot;END@&quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top