dbfit variable in Oracle query

383 views
Skip to first unread message

Mahesh Choudhari

unread,
Feb 19, 2015, 6:28:14 AM2/19/15
to db...@googlegroups.com

Hello,

I am trying to execute below code on dbfit, basically I want to parameterize my script, so that I can pass value once and reuse the variable in rest of the queries for test certain columns.

!|DatabaseEnvironment|ORACLE|
|Connect|${HOSTNAME}|${USERNAME}|${PASSWORD}|
|set option|bind symbols|false|


!|Query|!-select acct_id ts from dual-!| |acct_id?| |>>acct_id|

|Set Parameter|acct_id|<

|store query|SELECT id from table1 where id=:acct_id| result1|
|store query|SELECT id from table2 where id=:acct_id| result2|

!|compare stored queries|result1|result2|
|id?|

getting error as below:
ava.lang.Error: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
at dbfit.fixture.StoreQuery.doTable(StoreQuery.java:48)
at fit.Fixture.interpretFollowingTables(Fixture.java:120)
at fit.Fixture.interpretTables(Fixture.java:106)
at fit.Fixture.doTables(Fixture.java:80)
at fit.FitServer.process(FitServer.java:81)
at fit.FitServer.run(FitServer.java:56)
at fit.FitServer.main(FitServer.java:41)

Is there any way to get it working?
 



Mahesh Choudhari

unread,
Feb 19, 2015, 6:42:13 AM2/19/15
to db...@googlegroups.com
Small Correction to below:
 

Hello,

I am trying to execute below code on dbfit, basically I want to parameterize my script, so that I can pass value once and reuse the variable in rest of the queries for test certain columns.

!|DatabaseEnvironment|ORACLE|
|Connect|${HOSTNAME}|${USERNAME}|${PASSWORD}|
|set option|bind symbols|false|


!|Query|!-select acct_id ts from dual-!| |acct_id?| |>>acct_id|

|Set Parameter|acct_id|:acct_id|

Yavor Nikolov

unread,
Feb 19, 2015, 3:47:07 PM2/19/15
to db...@googlegroups.com
Hi Mahesh,

Query with >>acc_id should be enough to set your parameter. You shouldn't use explicit Set Parameter in this case.

!|Query|!-select acct_id ts from dual-!| |acct_id?| |>>acct_id|
Since you're referring to the column as act_id you shouldn't use this "ts" alias in the query.

Regarding "compare stored queries" - using single column, or lack of key columns was a special edge case I think. If you face an issue - try with |id| (no question mark) and/or add a second column. Please come back if you stumble upon that.

Best Regards,
Yavor


--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+un...@googlegroups.com.
To post to this group, send email to db...@googlegroups.com.
Visit this group at http://groups.google.com/group/dbfit.
For more options, visit https://groups.google.com/d/optout.

Mahesh Choudhari

unread,
Feb 19, 2015, 4:56:49 PM2/19/15
to db...@googlegroups.com
Hi Yavor,

Thanks for responding back.

What i have observed is, when i have a multi line query as below:


!|DatabaseEnvironment|ORACLE|
|Connect|${HOSTNAME}|${USERNAME}|${PASSWORD}|
|set option|bind symbols|false|

|Set Parameter|acct_id|12345|

|store query|!- SELECT id from table1 t1 inner join table3 t3 on t1.a=t3.a
where id=:acct_id -!| result1|

|store query|SELECT id from table2 where id=:acct_id| result2|

!|compare stored queries|result1|result2|
|id?|

then i am getting error, given in the previous email but If i set bind symbol option to true then i don't get error. The thing is i want keep the option to false, so that some comments which i have put in my SQL code should also work like --, /**/ etc.

is there anyway i can execute it with |bind symbol|false| option?

Thanks,
Mahesh


--
You received this message because you are subscribed to a topic in the Google Groups "dbfit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dbfit/GxcInDBjx5A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dbfit+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages