× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Perhaps it's as simple as including a BEGIN clause after the LANGUAGE SQL
clause to demarcate a start of the routine body?
Then end the routine body with an END clause. See the example at the bottom
of this page:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/db2/rbafzmstcrtp
sf.htm

Here are some CONNECT TO references, just in case the above suggestion
doesn't help:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/db2/rbafzmstconj
1.htm
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/db2/rbafzmstcon2
t.htm

Hth, Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com

-----Original Message-----
Subject: Using CONNECt in an SQL Procedure.


I'm trying to write my first ever procedure and have actually created one
that runs on the local DB.

However, what I am trying to do is to run the SQL on another LPAR.

When I run the CONNECT command through interactive SQL (STRSQL) I'm able to
connect and get the ensuing SQL to run correctly on that LPAR's DB. I have
created all the necessary entries for the network to operate.

Unfortunately, when I try to create a procedure inclusive of the CONNECT
statement, I can't get it to build. It's probably a simple syntax thing, but
I've exhausted my reference options.

I've tried a few variations, but this code fails at the compilation stage:

create procedure evedev/tfrtbldta(in rdbid char(10), in tblid char(8))
language sql
connect to misi9001 user myuser using 'mypwd'

Record *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+...
7 ...+... 8 .
78 EXEC SQL CONNECT TO MISI9001 USER MYUSER USING ' ;
5722SS1 V5R4M0 060210 Create SQL ILE C Object TFRTBLDTA
DIAGNOSTIC MESSAGES
MSG ID SEV RECORD TEXT
SQL0010 35 78 Position 48 String constant beginning ' ; ' not
delimited.
SQL0107 30 78 Position 48 ' ; too long. Maximum 128 characters.

I tried it with a semi-colon after the connect statement but got exactly the
same error.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.