Contact Us
About Us
News
Home
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome,
Guest
. Please
login
or
register
.
December 04, 2008, 10:34:06 pm
Username:
Password:
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forgot your password?
Groovy Script SQL - Problems with the assignment of variables
Welcome,
Guest
. Please
login
or
register
.
December 04, 2008, 10:34:06 pm
News:
The Forums are up! Welcome to eviware.
Eviware Forum
soapUI
soapUI
Groovy Script SQL - Problems with the assignment of variables
« previous
next »
Pages:
[
1
]
Author
Topic: Groovy Script SQL - Problems with the assignment of variables (Read 353 times)
Juergen
Newbie
Posts: 6
Groovy Script SQL - Problems with the assignment of variables
«
on:
November 29, 2007, 04:19:20 pm »
I have the following problem I liked to select from a data bank a Sequence TEST_CASE_ID_SEQ and write this afterwards
in another table. Unfortunately, the handing over of the variable TEST_CASE_ID_SEQ into the variable TEST_CASE_ID does not work.
However, I get only the value 'null' I have written the following script.
What do I make wrong ??
##########################
import java.sql.Connection
import java.sql.DriverManager
import javax.sql.DataSource
import groovy.sql.Sql
import oracle.jdbc.driver.OracleTypes
import groovy.sql.DataSet
def driver = oracle.jdbc.driver.OracleDriver
def sql = Sql.newInstance ('jdbc:oracle:thin:pt_xxx/pt_xxx@localhost:31521:pt_xxx')
def TEST_CASE_ID_SEQ
def TEST_CASE_ID
//READ next Value of TEST_CASE_ID_SEQ
TEST_CASE_ID = sql.eachRow("SELECT TEST_CASE_ID_SEQ.nextval as TEST_CASE_ID_SEQ from dual")
{
}
println TEST_CASE_ID
// result null
//Write Value TEST_CASE_ID
//TEST_CASE_ID = "2345"
sql.execute("Insert into log TEST_CASE_ID values (?)", [TEST_CASE_ID])
#####################
Thanks and best regards
Juergen
Logged
omatzura
Administrator
Hero Member
Posts: 1,506
Re: Groovy Script SQL - Problems with the assignment of variables
«
Reply #1 on:
November 29, 2007, 07:59:16 pm »
Hi Juergen,
I think the problem is the statement
//READ next Value of TEST_CASE_ID_SEQ
TEST_CASE_ID = sql.eachRow("SELECT TEST_CASE_ID_SEQ.nextval as TEST_CASE_ID_SEQ from dual")
{
}
please try the following instead:
sql.eachRow("SELECT TEST_CASE_ID_SEQ.nextval as TEST_CASE_ID_SEQ from dual")
{
row -> TEST_CASE_ID = row[0]
}
Hope this helps!
regards,
/Ole
eviware.com
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> eviware general
-----------------------------
soapUI
-----------------------------
=> soapUI
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.2
|
SMF © 2006-2007, Simple Machines LLC
Loading...