|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
how to fetch only first record in db2 table? |
« View previous topic :: View next topic » |
Author |
Message
|
PRKUMAR |
Posted: Thu Sep 20, 2012 1:26 am Post subject: how to fetch only first record in db2 table? |
|
|
Apprentice
Joined: 04 Sep 2012 Posts: 36
|
I want to fetch only first record from a db2 table. I am using the following code, but it doesn't work:
SELECT * FROM TABLE1 FETCH FIRST 1 ROWS ONLY |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Sep 20, 2012 4:41 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
mqjeff |
Posted: Thu Sep 20, 2012 11:53 am Post subject: Re: how to fetch only first record in db2 table? |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
PRKUMAR wrote: |
I want to fetch only first record from a db2 table. I am using the following code, but it doesn't work:
SELECT * FROM TABLE1 FETCH FIRST 1 ROWS ONLY |
That's an SQL select statement.
It's got no relationship, other than the name, to an ESQL select statement.
Are you using ESQL? Or some node other than a Compute node? |
|
Back to top |
|
 |
NealM |
Posted: Thu Sep 20, 2012 12:40 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
By the way, that SQL construct will always require a passthru. It is unique to DB2. In Oracle you would use "WHERE rownum <= 1". etc. ; the Broker sticks to universal database SQL constructs in its ESQL. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|