cancel
Showing results for 
Search instead for 
Did you mean: 

select statement and row count

Former Member
0 Kudos

Hi,

I am executing this SQL_Query,

"select * from salary_update where emp_no like ?".

Here I want to get the row count, how can I achieve this?

I appreciate your help.

Thanks,

Sunita.

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

have a look at this weblog:

/people/siva.maranani/blog/2005/09/16/xi-how-to-on-jdbc-receiver-response

to see how to create any jdbc response

without knowing it's format before the test:)

Regards,

michal

Former Member
0 Kudos

Hi Michal,

I know this approach.

But in the response from the DB, for the above select statement, there is not any row count field available. It is sending only the fields which will be mapped to the internal table (483) rows.

How can I send the row count also to the Response to the select statement?>

Thanks,

Sunita.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

you can only use count for delete,insert and update

if you want to do it with select

you can count it youself (since you have all the rows) you can do it with a simple User defined function

or count all rows removing the context - this should

be possible without any java code and only with standard

message mapping function

Regards,

michal

Former Member
0 Kudos

Hi Michal,

Thanks-a-lot. Can you please tell me clearly how to do this by removing context. I dont want to write custom java function, I want to use the standard functions?.

Thanks,

Sunita.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

try the count function:

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

and removeContexts on the row (the one with multiple occurance ) TAG

if this doesn't work create a simple function

which will count the rows

Regards,

michal

moorthy
Active Contributor
0 Kudos

Hi Sunita,

Please go thru following blog -

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/308c4024d26e1de10000000a1550b0/frameset.htm

Standard Functions-

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm

Hope this helps,

Regards,

Moorthy

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi sunita ,

u can use the Count function to determine the number of rows those are being read from the database using select statement .

Regards,

keith.

Former Member
0 Kudos

Thanks All,

/Sunita.

Former Member
0 Kudos

Hi Sunita,

If you want to get the count in the select SQL statement you can do the following:

select column1, column2, column3, (select count(*) from table1) as rowcount from table1

It's not very efficient for the DB though, so it's better to just count the number of rows in the message map as was suggested earlier.

Thanks,

Jesse