Unable to retrieve the latest data from DB2 using with ur clause - db2

We are facing one interesting issue in my production DB.
We are using Db2 data base , after issuing update command(from command center, dqlsuirrel....all) and commit , not able to retrieve the latest data/updated data from select query with UR(It is returning previous data).But if i use the select clause with RR then i am able to see the latest data.
One more interesting thing if update the data today , i can't get the latest by using Select with UR on the same day but i am able to retrive the latest data(which i updated on previous day) on next day (By using select ...from ABC with UR).

I found the problem.
A MQT is created on this base table(XYZ) so whenever i query the against table (XYZ) it is getting data from MQT table/buffer.

Related

Delete data based on date from DOMO

I need to delete data from a dataset. I read this post that I think would help (https://dojo.domo.com/discussion/comment/46624#Comment_46624) but Im not sure where to run this query to delete from the table.
Please let me know if these are the correct steps:
click SQL in DOMO url -> MySQL -> input datasets (add the table I want to delete rows from) -> transform (
add my delete from statement:
DELETE FROM
my_table
where `loaded_date` >= '2019-10-01' and `loaded_date`<= '2019-11-01';)
-> output datasets (just do select * from table? does it matter what I enter here?, can I just limit to 10?)
thanks!
Ok so I found a way two ways to do this. Within my question I mentioned where to go to run a DataFlow, that would be one way to do this. But it matters what you write for the output dataset as that would be the new dataset you use.
So I did SELECT * FROM my_table;
The second way to do this is to delete the version history, so lets say I get my data daily to DOMO, I would go to the dataset url, and add this to the end: ?_f=dataRepair . This just refreshed the page, but at the top there is a new button to click on called "data repair" select that and it will take you to all your versions. You can filter it by date as well and just delete.

Take a record to update and let no other update take and update that record during the process

I'm using Entity Framework to develop a website.
The problem I'm having here is a client select 1 record and update it, but if there is another client running the same select query the db will return the same record selected before and rewrite.
How do I avoid this? Is there anyway I can select a record and let no other touch that record?
How do I avoid this. Is there anyway I can select a record and let no other touch that record?
You need to implmenent concurency management :
your table must have a row version column. When users query the data you send row version along the data.
each update from your user must include the row version.
if the row version is different with the current value stored in the database then you throw an exception.
if the row version is same with the one stored in your table then update the data and regenerate the row version column.
Entity Framework make it easy to handle concurrency just take a look at this tutorial. It will help you a lot.

OrientDB -Order by FIELD not working

I want to order the table by the id's given within "IN Clause"
SELECT * FROM mytable WHERE id IN [1,2,3,4] ORDER BY FIELD(id,3,2,1,4);
But i am getting error as response.
Sorry, OrientDB does not support this in current release. Please open an issue on the official issue tracker, we'll consider it for next releases.

Select new or updated records com table in Postgresql

It's possible to get all the new or update records from one table in postgresql by
specified date?
something like this:
Select NEW OR UPDATED FROM anyTable WHERE dt_insert or dt_update = '2015-01-01'
tks
You can only do this if you added a trigger-maintained field that keeps track of the last change time.
There is no internal row timestamp in PostgreSQL, so in the absence of a trigger-maintained timestamp for the row, there's no way to find rows changed/added after a certain time.
PostgreSQL does have internal information on the transaction ID that wrote a row, stored in the xmin hidden column. There's no record of what transaction ID committed when, though, until PostgreSQL 9.5 which keeps track of this if and only if the new track_commit_timestamps setting is turned on. Additionally, PostgreSQL eventually clears the creator transaction ID information from a tuple because it re-uses transaction IDs, so it only works for fairly recent transactions.
In other words: it's kind-of possible in a rough way, if you understand the innards of the database, but should really only be used for forensic and recovery purposes.

How to display last 3 RECENTLY stored items in sqlite database - iPhone

In my app i am using Sqlite data base to store the data.
The stored items are displayed in a table (Main table).
Now i need to display RECENTLY added 3 items in another table (RecentTable).
I implemented recent table, but unable to display recently added data.
Please help..
Thanks in advance.
Have you thought about using an auto-incrementing column and then using that to get the three most recently added items? Something like:
select whatever
from mytable
order by auto_inc_column desc
limit 3