View previous topic :: View next topic
|
Author |
Message |
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
I have 2 tables . SUPPLY and PART TABLES . Both have City field as common . I have to fetch details from both tables for matching cities using embeddded sql. Can i declare a cursor as below :
EXEC SQL
DECLARE C1 CURSOR FOR SELECT * FROM S.SUPPLY , P.PART WHERE S.CITY = P.CITY
END-EXEC.
Is this syntax for declare cursor allowed in embedded sql ? If yes i am getting SQLCODE 20O while running thw pgm . Please let me know what it indicates.
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Lose the "select *". .
Is that the exact sql executed or just something similar?
There was more info presented than "200". You need to post the rest as well.
At the top of the page is a link to "IBM Manuals". Suggest you look up your return info in the db2 messages documentation. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I assume that S.SUPPLY and P.PART are really existing tables .
SELECT * FROM S.SUPPLY A , P.PART B WHERE A.CITY = B.CITY
or
SELECT * FROM S.SUPPLY , P.PART WHERE S.SUPPLY.CITY = P.PART.CITY |
|
Back to top |
|
|
|