How to get only value of sql query without header using groovy

rAJ

I tried to fetch only DB value using groovy script but result includes the value along with header.

def res = con.rows("select fkuserid from tblUserCardDetail where cardValue='111633072'" )
log.info "The User ID from DB is :" + res

Result is coming like this : Mon Apr 25 06:51:07 PDT 2016:INFO:The User ID from DB is :[[fkuserid:2951]]

I want only value : 2951

Emmanuel Rosa

When Groovy SQL returns a result, it returns it as a Map-like object, a GroovyRowResult. Since you're using rows() you're getting a list of GroovyRowResults.

If the query will always return a single record (or nothing at all), then you can use firstRow() instead of rows(). Then, you can access the fkuserid property/key to get the value:

def res = con.firstRow("select fkuserid from tblUserCardDetail where cardValue='111633072'" )
log.info "The User ID from DB is :" + res.fkuserid

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How do I get property value without knowing it's specific key in javascript using JSON

来自分类Dev

How to get the previous row value in the result set of type forward only using Java

来自分类Dev

Fetch single value with linq projection query without using FirstOrDefualt

来自分类Dev

get single value from sql-query into a textbox

来自分类Dev

How to get the value of a node using for each and if in xpath

来自分类Dev

How to get a single value from gae ndb query?

来自分类Dev

How to extract custom header value?

来自分类Dev

How do I get a Cookie from a SoapUI response using a Groovy test step?

来自分类Dev

How to get the OS Version String in MAC 10.10 without using gestalt

来自分类Dev

How to get user location city without using geo location

来自分类Dev

How do you count misspelled fields using a SQL query?

来自分类Dev

How do I get a value from an associative array using Swift

来自分类Dev

advanced sql query using join

来自分类Dev

How to set header to a string in java using JMS

来自分类Dev

How do I only read the header for a URL in Ruby?

来自分类Dev

SQL Query to get the related data in different table

来自分类Dev

How do I count instances of values in columns by individual column using only SQL?

来自分类Dev

Dynamically add query parameters without value to Retrofit request

来自分类Dev

How to query Javascript object using SQL when column names contain spaces?

来自分类Dev

How to rename a cq5 node name using GROOVY Console?

来自分类Dev

SQL query in Foreach loop using array variable

来自分类Dev

google app engine - ndb query to only get a few columns in python

来自分类Dev

Groovy getAt()与get()

来自分类Dev

Groovy SQL批处理

来自分类Dev

MySQL Top10 List with counter using only one query

来自分类Dev

MySQL query to return all row with same value only if all of them with equal to diffrent value

来自分类Dev

Microsoft SQL Query where value from text file

来自分类Dev

Get a certain value in a JSON string using a regex

来自分类Dev

Get the value of a variable using the hexadecimal memory address

Related 相关文章

  1. 1

    How do I get property value without knowing it's specific key in javascript using JSON

  2. 2

    How to get the previous row value in the result set of type forward only using Java

  3. 3

    Fetch single value with linq projection query without using FirstOrDefualt

  4. 4

    get single value from sql-query into a textbox

  5. 5

    How to get the value of a node using for each and if in xpath

  6. 6

    How to get a single value from gae ndb query?

  7. 7

    How to extract custom header value?

  8. 8

    How do I get a Cookie from a SoapUI response using a Groovy test step?

  9. 9

    How to get the OS Version String in MAC 10.10 without using gestalt

  10. 10

    How to get user location city without using geo location

  11. 11

    How do you count misspelled fields using a SQL query?

  12. 12

    How do I get a value from an associative array using Swift

  13. 13

    advanced sql query using join

  14. 14

    How to set header to a string in java using JMS

  15. 15

    How do I only read the header for a URL in Ruby?

  16. 16

    SQL Query to get the related data in different table

  17. 17

    How do I count instances of values in columns by individual column using only SQL?

  18. 18

    Dynamically add query parameters without value to Retrofit request

  19. 19

    How to query Javascript object using SQL when column names contain spaces?

  20. 20

    How to rename a cq5 node name using GROOVY Console?

  21. 21

    SQL query in Foreach loop using array variable

  22. 22

    google app engine - ndb query to only get a few columns in python

  23. 23

    Groovy getAt()与get()

  24. 24

    Groovy SQL批处理

  25. 25

    MySQL Top10 List with counter using only one query

  26. 26

    MySQL query to return all row with same value only if all of them with equal to diffrent value

  27. 27

    Microsoft SQL Query where value from text file

  28. 28

    Get a certain value in a JSON string using a regex

  29. 29

    Get the value of a variable using the hexadecimal memory address

热门标签

归档