Andrew Wang wrote:
> Hi, I can use IBM toolbox jdbc driver to connect to AS400(V5R2) and the=
=20
> general query(like select * from table) is ok. But it failed if I creat=
e=20
> a stored procedure . Below is the error message and the create procedur=
e=20
> script..
> =20
> -- create procedure --
> create procedure test1
> language sql
> begin
> end;
> =20
> -- error message --
> Error: java.sql.SQLException: [SQL0199] =A4=A3=B9w=B4=C1=C3=F6=C1=E4=A6=
rEND=A1C =A6=B3=AE=C4=B0O=B8=B9=AC=B0( IF=20
> GET SET CALL CASE DROP GOTO LOCK OPEN WITH ALTER CLOSE=A1C, SQL State:=20
> 42601, Error Code: -199
I had a similar problem with Oracle when trying to execute a block of
PL/SQL code. I found that the problem was that the code had ';'
characters inside of it. SQuirreL doesn't know anything about
procedures or code blocks, so it scans the single block of code for the
';' character, and breaks the block into multiple SQL statements. It
then tries to execute each statement separately, which the database
engine chokes on.
Try changing the Session SQL property 'Statement Separator' from ';' to
something else ('/' for example), and then try your procedure again like =
so:
create procedure test1
language sql
begin
<sql statements>;
end;
/
Of course, you'll have to change the property back to ';', after
creating your procedure if you want the ';' to remain the termination
character for single SQL statements.
Maury
|