Ask a Question

How to use datasource (date) in sql update

SOLVED
Ivan_Trampedach
Contributor

How to use datasource (date) in sql update

I have a DataSource step, where I have a parameter (YEARX) with a date e.g 2016-03-12

In another step, I have a JDBC (Oracle) select where I want to use this YEARX parameter

 

If I am using the format below, and just retrive data from step, then I get an error. Why can't I see the sql that is send to DB ?

 

select * from table where
opddate= TO_DATE (${DataSource#YEARX} , 'YYYY-MM-DD')

  of some reason , 'YYYY-MM-DD') is removed in this post

 

If I am doing like belowe, sql retrive data as expected.

 

select * from tabel
where
opddate= TO_DATE('2016-03-12','YYYY-MM-DD')

I have read that a SQL (Oracle), could be entered like this

 

 

select * from tabel
where
opddate= TO_DATE(:YEARX,'YYYY-MM-DD')

But where should value for parameter (YEARX) be set ? I think I have tried the most, with no positive result.

 

How could I use DataSource out of the box ? 

If you have any suggestion to solve this, I would be wery happy to test your solution

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ivan_Trampedach
Contributor

Re: How to use datasource (date) in sql update

After a god night sleep, I solved it and now see the parameter field in JDBC step for :YearX

And '  ' around my Datasource, also solved the problem.

 

View solution in original post

2 REPLIES 2
Ivan_Trampedach
Contributor

Re: How to use datasource (date) in sql update

After a god night sleep, I solved it and now see the parameter field in JDBC step for :YearX

And '  ' around my Datasource, also solved the problem.

 

View solution in original post

TanyaYatskovska
Community Manager

Re: How to use datasource (date) in sql update

Hi Ivan,

 

It's great to hear. Thanks for sharing your solution with us.

Sleep is always a good idea 🙂

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


cancel
Showing results for 
Search instead for 
Did you mean: