Link to home
Start Free TrialLog in
Avatar of Midhun 123
Midhun 123

asked on

DB2 Select query for pulling records after a specific timestamp where input timestamp will be present inside a text file

Hi Experts,

Good Day

As per my work , I need to write a DB2 sql query which has to pull records after a specific timestamp..Already in the table there is a column for timestamp(transaction_date). So basically It should compare with this column value and If the transaction-date timestamp is greater than the specific time stamp , It should pull those records.

Specific timestamp will be present inside a text file(/home/user/inputpath/Extracted-date.txt).
How can I write query? input should be taken from the text file and compare with the transaction-date timestamp.

select query where 

Open in new window

Thanks in Advance.
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi Midhun,

The easiest way is to run the query from a shell or client tool that will allow you access to the file.  You can import it into a table and then the query is trivial.  Alternatively, if the entire process will run from the O/S shell (say a scheduled job) you can use one of the O/S/ tools to insert the value into a query.

But I'm not aware of any built-in tools to query the value from your text file.  If it needs to be done this way, you'll probably have to write a stored procedure in C that can access the O/S interfaces to get to the file directly.

Good Luck,
Kent
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.