Forum Discussion

Ivan_Trampedach's avatar
Ivan_Trampedach
Contributor
9 years ago
Solved

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

 

  • 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.

     

2 Replies

  • 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.

     

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi Ivan,

       

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

      Sleep is always a good idea :)