Micro Focus QTP (UFT) Forums
parameterized SQL query in QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: parameterized SQL query in QTP (/Thread-parameterized-SQL-query-in-QTP)



parameterized SQL query in QTP - sk.aravind - 11-25-2009

I ve got a problem

as soon as i create a record in my GUI an 2 unique ids are generated for a record and it is displayed at the bottom of my screen

I retreived the values using text output values

Now i need to validate whether the record is present in the database

I stored the 2 ids in the variables x & y respectively

in the Database output value I mentioned the sqlquery as

select * from table where id1='x' and id2='y'
I used the select SQL statement manually after setting up the connection string
The database ouput value Wizard throws an error.

Kindly help me out in this

how do i use output values as input to SQL


RE: parameterized SQL query in QTP - Jackomcnabb - 11-26-2009

Try this

select * from table where id1='"&x&"' and id2='"&y&"'


RE: parameterized SQL query in QTP - sk.aravind - 11-26-2009

Hi Jack

I did try this

I get an error stating that SQL query cannot be excecuted

details :[Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number


RE: parameterized SQL query in QTP - sk.aravind - 11-26-2009

Hey guys

can someone help me out on this


RE: parameterized SQL query in QTP - Saket - 11-27-2009

I guess the field Id1 and Id2 is expecting a numeric value
have you tried removing the single quote (')?
Code:
select * from table where id1="& x & " and id2=" & y



RE: parameterized SQL query in QTP - sk.aravind - 11-27-2009

I HAVE DONE IT BUDDY. I will try once again and get back to u


RE: parameterized SQL query in QTP - sk.aravind - 11-27-2009

it says "invalid identifier" now for this query

select * from table where id1="& x & " and id2=" & y"

tried all possible combinations . no sloution yet


RE: parameterized SQL query in QTP - v_selvam - 12-02-2009

Hi,
Check, the id1 and id2 column's data type. According to it, you reframe your query and then try.