Sort records when there is no timestamp
Hello All,
I'd like to know how we can do a sort based on timestamp on an oracle table when there is no timestamp column. I have a table
create table x_log (A varchar,B varchar,C varchar); /* note I do not have a timestamp col */
I'd like to know if its possible to find the records updated/inserted on an hourly basis for about a week's time. I do not have timestamp column here. Any help in this regard is greatly appreciated.
Thanks All.
of course it can be accomplished and you have more than one option, I would start with (2) in your case
1. trigger - you use setup UPDATE trigger on that table, it would then do whatever you want after anybody runs update, ...
2. use ORA_ROWSCN pseudo column - this is a sequence column but at the end can tell you when each record was updated http://blog.tanelpoder.com/2009/02/07/when-was-a-table-last-changed/
3. use data change notification http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_dcn.htm
Similar Messages
-
DataGrid always only showing 1 record when there should be 5
When I do the "Test Operation" in the Data/Services pane, I can pull back the expected 5 records, however at run time, a grid that pulls data using the exact same operation and same input value, it only shows the first record. Is there a setting that is preventing the grid from showing all records, or, is there a runtime setting that is limiting the number of records pulled back?
Are you getting the data from a database or is it internal xml?
-
OSB DB Poller deleting the record when there is a failure
Hi All,
My project consists of below OSB services..
DB Poller -> Proxy service A -> Proxy service B
DB Poller is JCA Based and it should delete the polled record after the complete flow is successful. If there is any error in my OSB Proxy services, the record should not be deleted.
Proxy service A calls Proxy service B using routing(static). My Proxy service B is throwing error and the record is getting deleted.
If I change to Dynamic routing the record id not getting deleted and the flow works as expected. The routing option configuration is same for both static and dynamic routing.
The only configuration in my routing option is QOS="Exactly once" .
Can anyone let me know why the record is deleted if I use static routing?
Thanks in advanceIn your scenario record will be deleted as your DB Poller will commit the transaction once the message has been delivered to Proxy Service A.
If you want the message not to be deleted then you must have only the DB Poller proxy include the logic of proxy A and must make a call to proxy B. -
VO fetches 25 records, when there are 150 in the iterator.
Hi All,
I'm using View Objects as part of my AD form. In the bean associatd with the form, in one fo my methods, I loop through the Iterator associated with this VO.
I notice that only 25 records are being fetched, even though the number of rows is clearly more than that. I've looped through usinga for loop and printed each and every record within the VO and it only prints 25.
How can I tune this VO to bring back all my records at once?Will it always only bring back 25 at a time?
JDev-11g used.
The code I use to bring back the rows is :
int numRows = vo.getRowCount();
System.out.println("*Number of rows*" + numRows); // This returns 150
for (int i = 0; i < numRows; i++) {
System.out.println("Role data" + roledata);
I'm trying to print out each line's role data : I notice only 25 printed lines in the logs.
//some code
What am I doing incorrect here?
Thanks
Preethi.
Edited by: 859810 on 08-Aug-2011 02:38On the page go to bindings - executables - select the iterator and set its range size to -1.
setting -1 will fetch all the records
Edited by: in the line of fire on Aug 8, 2011 1:41 PM -
DB_GET_BOTH_RANGE fails when there is only one record for a key
Using the DB_GET_BOTH_RANGE flag doesn't seem to work when there is a
single record for a key.
Here's a sample Python program that illustrates the problem. If you
don't know Python, then consider this to be pseudo code. :)
from bsddb3 import db
import os
env = db.DBEnv()
os.mkdir('t')
env.open('t',
db.DB_INIT_LOCK | db.DB_INIT_LOG | db.DB_INIT_MPOOL |
db.DB_INIT_TXN | db.DB_RECOVER | db.DB_THREAD |
db.DB_CREATE | db.DB_AUTO_COMMIT)
data = db.DB(env)
data.set_flags(db.DB_DUPSORT)
data.open('data', dbtype=db.DB_HASH,
flags=(db.DB_CREATE | db.DB_THREAD | db.DB_AUTO_COMMIT |
db.DB_MULTIVERSION),
txn = env.txn_begin()
#data.put('0', '6ob 0 rev 6', txn)
data.put('0', '7ob 0 rev 7', txn)
#data.put('0', '8ob 0 rev 8', txn)
data.put('1', '9ob 1 rev 9', txn)
txn.commit()
cursor = data.cursor()
print cursor.get('0', '7', flags=db.DB_GET_BOTH_RANGE)
cursor.close()
data.close()
env.close()
This prints None, indicating that the record who's key is '0' and
who's data begins with '7' couldn't be found. If I uncomment wither of
the commented out puts, so that there is more than one record for the
key, then the get with DB_GET_BOTH_RANGE works.
Is this expected behavior? or a bug?You can use the DB_SET flag which will look for an exact key match. If
you use it with the DB_MULTIPLE_KEY flag, it will return multiple keys
after the point it gets a match. If you can post here how all your
LIKE QUERIES look, I may be able to provide you with the suited
combination of the flags you can use for them.I'm not doing like queries. I'm using BDB as a back end for an object
database. In the object database, I keep multiple versions of object
records tagged by timestamp. The most common query is to get the
current (most recent version) for an object, but sometimes I want the
version for a specific timestamp or the latest version before some
timestamp.
I'm leveraging duplicate keys to implement a nested mapping:
{oid -> {timestamp -> data}}
I'm using a hash access method for mapping object ids to a collection
of time stamps and data. The mapping of timestamps to data is
implemented as duplicate records for the oid key, where each record is
an 8-byte inverse timestamp concatenated with the data. The inverse
timestamps are constructed in such a way that they sort
lexicographically in inverse chronological order. So there are
basically 3 kinds of query:
A. Get the most recent data for an object id.
B. Get the data for an object id and timestamp.
C. Get the most recent data for an object id who's timestamp is before
a given timestamp.
For query A, I can use DB->get.
For query B, I want to do a prefix match on the values. This can be
thought of as a like query: "like <inverse-time-stamp>%", but it can
also be modelled as a range search: "get the smallest record that is >=
a given inverse time stamp". Of course, after such a range search,
I'd have to check whether the inverse time stamp matches.
For query C, I really want to do a range search on the inverse time
stamp prefixes. This cannot be modelled as a like query.
I could model this instead as {oid+timestamp -> data}, but then I'd
have to use the btree access method, and I don't expect that to scale
as I'll have hundreds of millions of objects.
We tried using BDB as a back end for our database (ZODB) several years
ago and it didn't scale well. I think there were 2 reasons for
this. First, we used the btree access method for all of our
databases. Second, we used too many tables. This time, I'm hoping that
the hash access method and a leaner design will provide better
scalability. We'll see. :)
If you want to start
on a key partial match you should use the DB_SET_RANGE flag instead of
the DB_SET flag.I don't want to do a key partial match.
Indeed, with DB_GET_BOTH_RANGE you can do partial
matches in the duplicate data set and this should be used only if you
look for duplicate data sets.I can't know ahead of time whether there will be duplicates for an
object. So, that means I have to potentially do the query 2 ways,
which is quite inconvenient.
As you saw, the flags you can use with cursor.get are described in
detailed here.But it wasn't at all clear from the documentation that
DB_GET_BOTH_RANGE wouldn't work unless there were duplicates. As I
mentioned earlier, I think if this was documented more clearly and
especially of there was an example of how one would work around the
behavior, someone would figure out that behavior wasn't very useful.
What you should know is that the usual piece of
information after which the flags are accessing the records, is the
key. What I advice you is to look over Secondary indexes and Foreign
key indexes, as you may need them in implementing your queries.I don't see how secondary indexes help in this situation.
BDB is
used as the storage engine underneath RDBMS. In fact, BDB was the
first "generic data storage library" implemented underneath MySQL. As
such, BDB has API calls and access methods that can support any RDBMS
query. However, since BDB is just a storage engine, your application
has to provide the code that accesses the data store with an
appropriate sequence of steps that will implement the behavior that
you want.Yup.
Sometimes you may find it unsatisfying, but it may be more
efficient than you think.Sure, I just think the notion that DB_GET_BOTH_RANGE should fail if
the number of records for a key is 1 is rather silly. It's hard for me
to imagine that it would be less efficient to handle the non duplicate
case. It is certainly less efficient to handle this at the application
level, as I'm likely to have to implement this with multiple database
queries. Hopefully, BDB's cache will mitigate this.
Thanks again for digging into this.
Jim -
on my itunes library my albums are all sorted but when i put onto my ipod touch (4th Gen) it seems to duplicate i have checked everything and there are no spaces in the information my question is how do isort it because these things drive me mad i would be most gratefully if you could find a way to help
thatnksNever mind, got it to work. I stumbled around on Google for a while and somehow ended up reading things from the 'jailbroken' community. They had easy instructions to get out of Recovery mode. Thanks anyway though!
P.S. For anyone who experiences this, here is the fix: Hold Power and Home in unison for 6 seconds, then power on as normal. -
Hi
I am combining 2 related records of legacy data together that make up a marriage record. I am doing this in APEX using a before header process using the following code below which works well when there are only 2 related records which joins the bride and groom record together on screen in apex. I have appended a field called principle which is set to 'Y' for the groom and 'N' for the bride to this legacy data
However there are lots of records where in some instances there are 3, 4 , 5, 6 or even 1 record which causes the PL/SQL in APEX to not return the correct data. The difference in these related columns is that the name of the bride or groom could be different but it is the same person, its just that from the old system if a person had another name or was formally known as they would create another duplicate record for the marriage with the different name, but the book and entry number is the same as this is unique for each couple who get married.
How can I adapt the script below so that if there are more than 2 records that match the entry and book values then it will display a message or is there a better possible work around? Cleaning the data would be not an option as there are thousands of rows of where these occurrences occur
declare
cursor c_mar_principle(b_entry in number, b_book in varchar2)
is
select DISTINCT id, forename, surname, marriagedate, entry, book, formername, principle
from MARRIAGES mar
where mar.entry = b_entry
and mar.book = b_book
order by principle desc, id asc;
rec c_mar_principle%rowtype;
begin
open c_mar_principle(:p16_entry,:p16_book) ;
fetch c_mar_principle into rec;
:P16_SURNAME_GROOM := rec.surname;
:P16_FORNAME_GROOM := rec.forename;
:P16_ENTRY := rec.entry;
:P16_BOOK :=rec.book;
:P16_FORMERNAME :=rec.formername;
:P16_MARRIAGEDATE :=rec.marriagedate;
:P16_GROOMID := rec.id;
fetch c_mar_principle into rec;
:P16_SURNAME_BRIDE := rec.surname;
:P16_FORNAME_BRIDE := rec.forename;
:P16_ENTRY := rec.entry;
:P16_BOOK :=rec.book;
:P16_FORMERNAME :=rec.formername;
:P16_MARRIAGEDATE :=rec.marriagedate;
:P16_BRIDEID := rec.id;
close c_mar_principle;
end;rambo81 wrote:
True but that answer is not really helping this situation either?
It's indisputably true, which is more than can be said for the results of querying this data.
The data is from an old legacy flat file database that has been exported into a relational database.
It should have been normalized at the time it was imported.
Without having to redesign the data model what options do I have in changing the PL/SQL to cater for multiple occurances
In my professional opinion, none. The actual problem is the data model, so that's what should be changed. -
Dax Calculate column even when there is no record at a date
We are creating a powerpivot model based on a table with data about worktasks of our employees.
This is simplified our input:
Tasknr date started dateended
1 20140101 20140201 (yyyymmdd)
2 20140102 20140103
3 20140104 20140108
Etc
We created two measures to calculate how many tasks are opened and closed per day. That was no problem, but now the tricky part. We also want to know each day how many tasks are
still open, even on days that no tasks are opened (or closed).
My approach was to create a calculated column to determine how many tasks are opened up to that date and subtracted the closed tasks and end up with the tasks that are open. That
seems to be working :
=COUNTROWS(FILTER(Tasks; Tasks[Open]<=EARLIER(Tasks[Open]))) - COUNTROWS(FILTER(Tasks; Tasks[Close]<=EARLIER(Tasks[Open])))
When I load this to the excel pivot I end up with this:
Row Labels| Opened | Closed | Open not finished
1/1/2014
1
0 1
1/2/2014
1 0
2
1/3/2014
0
1 0
1/4/2014
1
0 2
The line with 1/3/2014 should have 1 in the column [opened not finished], but because that calculation is linked to the opendate column, not to the closed and 3/1/2014 no task
was opened, there is no value. On days that no tasks are opened or closed there even is no line at all although there could be tasks that are still open.
I need a mechanism that calculates the value even when there are no records
on a particular day. Our users want to be able to view the results on any date they select.
I have considered a second table with all the dates and calculate columns from the task-table but are there other ways to do this? I searched this forum but did not find an answer
so far.Hi Jacob,
In our company we have a standard date table that is included in all of our models. What I didn't want to do in this case was to extend that table with calculated fields to solve this issue. Alternative was to create a new date table with the calculated
fields I needed. But I don't like that also so what I did was rewrite the sql that loaded the data into the pivot so that the measures were calculated at the load. But I am also not happy with that solution because of maintanance and performance reasons. My
feeling is that there must be a way to solve this with only dax in the loaded table.
Jacob's answer does exactly what you want. The DAX expression in his response is a measure which you could put in your Tasks table. You don't need to alter your date dimension in any way.
The key to this technique is that the date table cannot have an active relationship to your Tasks table. (although you could have an inactive relationship and then you could use the USERELATIONSHIP function to make other measures easier to calculate)
Translating Jocob's measure into something against a 'Tasks' table would looks like the following:
=
CALCULATE (
COUNTROWS ( Tasks ),
FILTER (
Tasks,
Tasks[Open] <= MAX ( Calendar[Date] )
&& Tasks[Closed] >= MAX ( Calendar[Date] )
http://darren.gosbell.com - please mark correct answers -
First rows retrieving slowly when there are no records.
Hi, In a Web Application, I´m using a query to retrieve the last records on a table, by user who created them. The query uses the FIRST_ROWS hint to retrieve faster the records, as there are users that have lots of records on the table. It looks like this:
select * from(SELECT /*+ FIRST_ROWS*/ * FROM HISTORY WHERE USER_ID ='CC71312667'
ORDER BY CREATE_DATE DESC) where rownum<=7;
The usage of the hint works marvels in response times with those users with lots of records, but when the user has no records at all (i.e. the query won´t retrieve any records), the performance is actually poorer than not using the hint.
Is there any way to make the query retrieve records fast in both cases?
I was thinking in doing a previous query to ask if the user has records (using count)... but I would like to avoid this if possible.
Thanks for any help you can give me.
Message was edited by:
jvegaAre there any indexes on any columns of the table 'HISTORY'?
Are statistics estimated/computed for the table and indexes(if any on it)?
What version of Oracle do you use?
Could you post the execution plan(s) for your case?
Do you often delete data from table 'HISTORY'? -
When I record videos, there's no sound recorded. But I tried recording a voice memo, there is a voice/sound recorded. Mobile technicians said I need to restore the phone to factory settings. HELP thanks!
When I record videos, there's no sound recorded. But I tried recording a voice memo, there is a voice/sound recorded. Mobile technicians said I need to restore the phone to factory settings. HELP thanks!
-
Why is there no sound recording when I capture Video in iMovie?
Sometimes there is sound recording, sometimes there isn't. And I can no longer find the "choose microphone" field that lets me change from the internal mic to an external Yeti. What's going on??
There are no waveforms in the audio field under the video. I've checked all the mute buttons and the connector cables. I've tried both the Yeti and the internal mic. I'm wondering if something in my iMovie got changed when the last update came in. Also, I've been Skyping lately. Did that affect anything? Help!!Contact iTunes store support
This article clearly states you don't need a credit card
http://docs.info.apple.com/article.html?artnum=301958
+7. In the resulting screen, create your new iTunes Store account. You will have the option to enter credit card information; if you do not wish to do so, click the None button on the Payment screen.+
If the "None" isn't there, it's a problem on their end! -
How do I print some value when there is no record against field
hi,
I have two queries and a link between two queries .columns selected for query are source to the fields in layout. In one of the case i have record for master table but the detail field is left blank because there is no record against it(its not null)
How do i display "0" where there is no record in detail. the columns of both the query are in same record . I can't assign "0" when null because there is no record so its not null.
Thanks in advance
RamaCreate a summary column in the parent query which counts the records in the child query. This will be zero when there are no records in the child query. Put this field on the page and in the format trigger use "RETURN :cs_count = 0;" to ensure the field is not visible except when its value is zero.
-
i have i4s .when i installed i0s 7.0.1 its speed became slow. when i wanted to hear my recorded program, there was no sound. secondly side buttons + and - are not working properly. thirdly face time is not present in settings
kindly helpDevice Manager which is in Control Panels
I strongly recommend AIDA64 to show everything, temps, fans, chips, drivers and versions
http://www.aida64.com/ Windows has better tools to show you every service and knick and cranny
https://discussions.apple.com/thread/2769294
http://realitypod.com/category/hacks-and-cracks/mac-hacks-and-cracks/
MacBook definitely uses Cirrus - probably iMac -
Problem with XML Publisher report when there are no detail records.
I am working on an Oracle XML Publisher procurement report (Oracle E-Business Suite R12) that starts with a budget amount that is imported from our financial system, then lists all requisitions and orders that are in process (not approved). The amounts of all those unapproved requisitions/orders are totaled using a Sum form field, to be followed by a field where the unapproved requisition/order total is subtracted from the budget amount (amount available). I am running into a problem when there are no unapproved requisitions. When I run the report for such instances, it completes with a warning -- here is what it states in the OPP log:
oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'sum'
I have altered my sum field on the RTF template to include an if statement in case of a null value...
<?sum (EXTENDED_COST)?> <?xdofx:if sum (EXTENDED_COST) = " then 0 end if?>
...but this does not work.Hi,
You are on right track. Simply put summary field in header group and remember to set reset at property to Header Group Not Child and now you can use this field in format trigger.
Format trigger must be written on header frame.
Cheers !
Adinath Kamode -
Line details sort order when using Pick and Pack
Hi,
A customer of mine recently complained (very small complain) that when he used "Per date" as a sort when using Pick & Pack, that the line details where not grouped together by Sales Order Number.
Example:
2008/11/23 SO1001 - Line 1
2008/11/23 SO1013 - Line 3
2008/11/23 SO1001 - Line 2
2008/11/23 SO1001 - Line 4
2008/11/23 SO1021 - Line 1
2008/11/23 SO1001 - Line 5
etc...
Is there a way to sort records on two columns instead of just one? or would there be another workaround this issue?
Thanks
CharlesI think I found my answer, sorting data using the Data/Sort feature allows for sorting on multiple columns.
Maybe you are looking for
-
I have just opened my itunes account and have lost all of my music, including music i have downloaded from disc and purchased music it appears to have happened in the last 2 months. can anyone help. When i did a check on my account it came up with th
-
After I was prompted to download Adobe Reader XI, installed and tried to use it, a pop up message appears stating that Adobe Reader has encountered a problem and needs to close. I have tried several times and still failed. I cannot read by pdf fil
-
How do I transfer a ReporWriter Report to Report Painter??
Hi, everybody. I have a report in ReportWriter and I would like to transfer it to ReportPainter automatically....Is it this possible?? How do I do it? Many Thanks
-
Dear All, I don't know if I'm in the right place, but I use the Field Service application, and I need to extract some attachments using a customized BS. Is it possible? If yes, how can I achieve this requirement? Thanks in advance. Rose Edited by: us
-
Central instance on Windows , DB instance on UNIX
Hi, Client wanted to install ECC6 implementation on hetrogeneous environment. Database instalnce on HP-UX , Central instance on Windows2003. I know that technically it is possible but it is very complex . My questions is do we face any problems durin