« first day (2162 days earlier)      last day (2709 days later) » 

5:20 AM
Is my answer here off-base? stackoverflow.com/a/35491211/57611
 
 
1 hour later…
6:39 AM
First person to get the gold Oracle badge :) dba.stackexchange.com/help/badges/223/oracle
7
 
6:59 AM
@Philᵀᴹ Congratulations!
 
7:18 AM
Hello everyone!
 
7:35 AM
@Philᵀᴹ Congrats! Finally another proper database tag badge :)
 
8:09 AM
@ErikE It's fine.
Regrading "there is no need to join": No, but sometimes it's more efficient to join. There is no need to not join either ;)
Similar question, with lots of different ways to achieve the same result: How to filter SQL results in a has-many-through relation
 
8:39 AM
@ypercubeᵀᴹ agree about joining, just that in this particular case it was likely to be more joins for more positions, and that seemed less ideal.
@ypercubeᵀᴹ the reason I asked is because someone down voted and I wondered if I was missing anything.
@ypercubeᵀᴹ haven't read your link yet, but a more set-based approach with FULL JOIN would be a more general-purpose solution.
 
@Philᵀᴹ Nice
 
@ErikE OP's case could probably be generalised beyond recognition, but there's no need for that either :)
 
With just 2 and finding those that are supersets of the 2 is easy. Finding n with only exact matches is harder.
@AndriyM not sure what's prompting you to say this... do you mean that my expectation of wanting more items, thus generalizing a bit, was not ideal?
 
8:55 AM
@ErikE I mean I'm not sure why you are talking about FULL JOIN. Usually if this kind of problem is solved with a join or joins, it's inner joins, not full joins. I can imagine how a full join might be appropriate but that would be generalising the problem more than necessary for that specific question.
@ErikE Oh, I'm sorry, didn't realise that comment was meant for a different question than the one you answered.
 
@Eugene hi
 
 
1 hour later…
10:17 AM
Guys, is there anyway to determine what is the order of triggers, that is executed on same table on same event? As I understand amount is not limited. Thank you.
 
@Eugene which RDBMS?
 
Oracle
Sorry. Forgot to mention PlSQL
 
I don't see how a FULL JOIN would help.
As AndriyM pointed, there are several ways to do this, usually with either JOINs or EXISTS subqueries or with the GROUP BY method you used.
SOme methods are easier to generalize, like GROUP BY. The joins and exists are not easy to generalize but are usually faster (in the DBMS I checked, ie Postgres and MySQL). I'd expect SQL Server ot behave the same.
But performance depends on mnay things, like distributions of values, indexes, etc.
 
@Eugene triggers will fire in some order (the documentation goes as far to say "you cannot control the order")
 
And the exact division problem is harder still, as you pointed out.
 
10:27 AM
if you are after to tell in which order they were fired for a given event, some logging could possibly help
but we have a gold-badge @Philᵀᴹ who can possibly explain it better
 
@ErikE I've seen a 20-times self-join perform slightly faster than a single GROUP BY ;)
 
10:42 AM
@dezso I see. The issue is, that I have a trigger, that is table level (if I understand correctly) and it does some operations. I need to use the result of that operations in my case, but I'm not sure whether it will be available during my trigger or not hens the order of execution. And my trigger is FOR EACH ROW.
 
@Eugene So you have 2 triggers, one at statement level and one at row level?
 
Yes.
 
The order is defined in that case.
50
A: row-level trigger vs statement-level trigger

ypercubeᵀᴹThe main difference is not what can be modified by the trigger, that depends on the DBMS. A trigger (row or statement level) may modify one or many rows, of the same or other tables as well and may have cascading effects (trigger other actions/triggers) but all these depend on the DBMS of course....

 
"Oracle fires multiple triggers in an unspecified, random order, if more than one trigger of the same type exists for a given statement; that is, triggers of the same type for the same statement are not guaranteed to fire in any specific order."
In reality, it does it in object_id order usually, but don't rely on it
 
@Philᵀᴹ I mean it is defined if one trigger is statement level and the other is row-level. Am I wrong?
 
10:48 AM
"First, statement level triggers are fired, and then row level triggers are fired."
 
Ou. Okay.
 
@Eugene Use the FOLLOWS/PRECEEDS trigger_ordering_clause docs.oracle.com/database/122/LNPLS/…
 
@BalazsPapp New in 12c?
 
10:50 AM
@Philᵀᴹ available since 11.1
 
The AskTom article appears to be putting the order of different types like this: 1) statement-level BEFORE, 2) row-level BEFORE, 3) row-level AFTER, 4) statement-level AFTER.
 
@Philᵀᴹ That is for BEFORE triggers. Isn't it the opposite for AFTER triggers?
@BalazsPapp see this ^^
Am I wrong? Because I'd have to update my answer at SO, which claims the same as AndriyM (I probably read the AskTom article when I answered that)
@Philᵀᴹ where it says:
> Oracle uses the following execution model to maintain the proper firing sequence of multiple triggers and constraint checking:

Run all BEFORE statement triggers that apply to the statement.

Loop for each row affected by the SQL statement.

Run all BEFORE row triggers that apply to the statement.

Lock and change row, and perform integrity constraint checking. (The lock is not released until the transaction is committed.)

Run all AFTER row triggers that apply to the statement.

Complete deferred integrity constraint checking.
It would be illogical to run an AFTER stetement trigger before AFTER row triggers anyway. Because the statement hasn't finished until all rows have been processed.
 
Yeah, the docs are clear
 
 
1 hour later…
@JackDouglas Yes, ok for that. I was asking for triggers with not the same timing point
 
in which case you can't use FOLLOWS
which I think you know
 
2 hours ago, by Philᵀᴹ
"First, statement level triggers are fired, and then row level triggers are fired."
Was trying to clarify this (in case someone considers it with AFTER triggers)
 
@BalazsPapp I don't think PRECEEDS does the same thing
 
> Use FOLLOWS to indicate that the trigger being created must fire after the specified triggers. [...] Use PRECEDES to indicate that the trigger being created must fire before the specified triggers.
 
12:26 PM
or rather it is only for a very special case: stackoverflow.com/questions/17693502/…
 
(That was from the docs)
 
"You can specify PRECEDES only for a reverse crossedition trigger"
 
"reverse crossedition trigger" – more than 60% of that is absolutely unknown to me. :)
Oh, crossedition – as in Oracle Database editions.
 
editions are supposed to be a very powerful tool for reducing downtime during releases, I've never actually used them
 
@AndriyM No
I think they refer to edition of a table. I'm sure Jack will correct me.
 
12:31 PM
edition applies to the whole database afaik
 
So I was right, that was something unfamiliar for me.
 
@JackDouglas Very interesting. So it's meant to be used mainly for DDL changes, to have minimal downtime.
 
yes, and the reverse crossedition triggers are for the case when you want to run both the new application and old application at the same time for a period during migration, so you can move over gradually. I guess there is some obvious reason why that requires a PRECEEDS syntax, but it escapes me.
 
someone should make a Hungarian notation joke to @BalazsPapp, so that I am not the only victim of these
2
 
12:47 PM
2
Hungarian language

Proposed Q&A site for people interested in the confusing Hungarian language.

Currently in definition.

> confusing Hungarian language.
 
@dezso Perhaps he hasn't hung out with us long enough to qualify for Hungarian jokes :)
 
@BalazsPapp your profile link to the WP blog is not working.
 
I just managed to scare a systems administrator of ours with a quick query for reverting order of items in a string
 
@dezso By replacing ASC with DESC?
 
1:33 PM
Thank you all who helped with question related to trigger.
 
@AndriyM splitting the string using a regexp to an array, revert that, fix some encoding and so on
 
@dezso I can imagine something like that to be an eye-opener for someone who might not realise that writing a query may involve a number of skills.
 
 
1 hour later…
2:54 PM
@ypercubeᵀᴹ that was in the summary section of the documentation. I just did a quick cut and paste without thinking. Further down in the docs, it says otherwise - the part you quoted after
 
3:19 PM
Are you affiliated with the product? Please disclose, if so. And add that it is a commercial one, not a free one. — ypercubeᵀᴹ 3 hours ago
 
3:35 PM
@ypercubeᵀᴹ Sure, multiple or many seeks can often beat 1 scan.
@ypercubeᵀᴹ regarding FULL JOIN I'll show you what I mean at some point if I can.
 
4:13 PM
HALLO, AND HAPPY MONDAY EVERYONE.
How is my channel doing?
 
@dezso So, what type is a @Balasz?
 
@ConcernedOfTunbridgeWells e_parse_error
Balazs it is
 
 
1 hour later…
5:42 PM
@dezso Exception @BalazsException = new ParseError()
 
 
2 hours later…
8:02 PM
Hello all
 
@Sami greetings!
 
:) thank you
i have a question
can i ask?
about sql server jobs and sql server agent
@ThomasWard
I have around 40 different sql server jobs in one instance. They all have different schedules. Some run once a day some every two mins some every five mins. If I have a need to stop sql server agent, how can I find the best time when no jobs are running so I won't interrupt any of my jobs?
 
8:30 PM
0
Q: How to automatically STOP SQL Server Agent when no jobs are running?

SamiI have around 40 different sql server jobs in one instance. They all have different schedules. Some run once a day some every two mins some every five mins. If I have a need to stop sql server agent, how can I find the best time when no jobs are running so I won't interrupt any of my jobs?

(question now asked on main)
 
@PaulWhite i thought it was kiwi magic searching that happened to surface a related question.
 
@swasheck Well I did go looking for a Q & A and happened to find Sami's own question as the first result :)
 
bringin' back that kiwi magic
 
9:06 PM
I would've sworn I've seen that question before
 
@TomV As in that exact question or a duplicate target?
 
@PaulWhite Something similar, but I can't find it
maybe I was wrong, maybe it was on SO or another site
aha crosspost
0
Q: How to automatically STOP SQL Server Agent when no jobs are running?

user3041013I have around 40 different sql server jobs in one instance. They all have different schedules. Some run once a day some every two mins some every five mins. If I have a need to stop sql server agent, how can I find the best time when no jobs are running so I won't interrupt any of my jobs?

 
near post
 
answers on both sites
a mess has been created
 
Crap.
 
9:14 PM
in fighting the battles, the answers, already lost we have. yet, open to us a path remains.
 
@Sami did you ask the question this site, so you can answer the SO one?
That's not how these sites are supposed to work ...
 
Attribution is required if you are going to quote other people's work. — Paul White 52 secs ago
 
@PaulWhite Meh, gone with the wind
 
So I see. Hm.
 
Confusing
Then again, me being confused isn't anything special :)
 
9:25 PM
@ypercubeᵀᴹ I don't have 10k on SO and don't want to bother the SO mods immediately. Was that answer simply deleted by the owner or is there anything else going on?
 
@PaulWhite deleted by owner, edited (removed the last update) and undeleted ...
so you should be able to see the revisions now: stackoverflow.com/posts/40980753/revisions
 
@ypercubeᵀᴹ Yes thanks. I'm pretty sure the remaining content was copied from dba as well. Think I saw it earlier when looking for a dupe. Hm.
16
A: Script to see running jobs in SQL Server with Job Start Time

Kenneth FisherI posted a query a while back for getting a list of currently running jobs here. SELECT ja.job_id, j.name AS job_name, ja.start_execution_date, ISNULL(last_executed_step_id,0)+1 AS current_executed_step_id, Js.step_name FROM msdb.dbo.sysjobactivity ja LEFT JOIN msdb.db...

 
taking it to a whole new level :)
Fortunately we got them CSI glasses
 
Just for @ypercubeᵀᴹ :
`pi@raspberrypi:~ $ ps auxww | grep christmas | grep -v grep
root 570 12.6 1.1 14600 10680 ? S 21:32 0:04 /usr/bin/python /usr/local/bin/christmaslights.py
pi@raspberrypi:~ $`
 
51
A: It’s time to retire the term “rep-whore”

Shog9Yeah... This seems like a good idea. The term has moved from its original jocular uses to something considerably more mean-spirited. I suspect most folks using the term now have some sort of nasty boogieman in mind rather than good ol' Marc Gravell. And when folks here are more concerned about w...

@Philᵀᴹ Needs more grep.
 
9:34 PM
@PaulWhite Oh so I messed up twice in a week
 
@TomV You just keep reminding me of things I've read recently on meta!
 
@PaulWhite Not sure what's wrong with me lately then
 
@TomV Don't sweat it. If you hadn't seen it, you had no way of knowing :)
 
flagged my own message :)
 
@PaulWhite I ask to hel
& i dont know that i should put a link to this site
so now you tell me
& i'll do that
 
9:36 PM
@Sami You could've flagged for migration or left a comment on the original question
 
@TomV It's not his question though.
 
No it's not mine
 
Yes that's what I mean, a comment in the sense of "you'd better ask this over at dba" would have been more helpful imo
 
@Sami My only objection is copying other people's questions/answers without the required attribution. That's not optional, SE requires it.
 
better than reposting
"asking for a friend"
 
9:38 PM
Now what i should do ? just put a link on the Answer?
 
@TomV Certainly copying the text of someone else's question to ask somewhere else is unusual indeed and technically would need to be attributed (I guess). Asking essentially the same question, but in your own words, with a focus on the target community would be fine with me.
@Sami Anything you have copied from other people's content needs to be attributed correctly. Read the help centre link I gave you.
 
Hey guys. Me once again. Small question, can I assign value to variable with the help of COALESCE function? At the moment I am using if :new.field is not null then somevar := :new.field ELSE somevar := :old.field end if; could it be rewritten like somevar := COALESCE(:new.field, :old.field);? Thank you.
 
OK now i understand
@PaulWhite
 
@Eugene Which product?
 
@PaulWhite now i edit my answer , is that ok now?
or i miss something?
 
Look im not well in english
so im sorry ok?
Now you tell me if my answer on SO is ok?
If i should delete it i will
Now I Delete My Poste
& also today i learn something new
 
@Sami Ok well let me try to break it down. The important parts are:
* Provide a link to the original page or answer
* Quote only the relevant portion
* Provide the name of the original author
There is also an example.
 
That will be nice if you show me an example
@PaulWhite you can check my poste on SO now
i delete it
anyway it's not for me i just try to help him
without knowing the rules
so im so sorry
 
@Sami Yes I understand now. It wasn't clear before. Thanks.
The example in the link is:
An example also exists on the question you posted here, which I edited to attribute correctly:
1
A: Automatically stop SQL Server Agent when no jobs are running

PoldbaYou can query the system tables as shown by Dattatrey Sindol in the MSSQLTips.com article Querying SQL Server Agent Job Information: SELECT [sJOB].[job_id] AS [JobID] , [sJOB].[name] AS [JobName] , [sDBP].[name] AS [JobOwner] , [sCAT].[name] AS [JobCategory] , [sJOB].[descr...

Compare that to the original answer: dba.stackexchange.com/revisions/157267/1
 
Aaaah now i understand that
 
9:53 PM
@PaulWhite sorry. Yet again I'm forgetting to mark it. I was talking about PlSQL.
 
Ok i got it
Can you delete my Q please?
bc i can't delete it
 
@Sami That wouldn't really be fair to the people that spent time answering it.
That's why you can't delete it.
 
ok , so i add the reference in it
is that good?
 
Hm. What to do.
 
Just to clarify: What do you mean by "3 table linked by an "inheritance"? I assume that there should be some FOREIGN KEY constraints linking the relevant tables, or that wouldn't be necessary? — MDCCL Dec 1 at 1:05
@MDCCL It's a common issue in the way a product I work with implemented inheritance
 
9:56 PM
@Sami I think I'll migrate it to SO so the mods there can merge the answers.
 
at some point they find out they can't create an composed index on fields residing in both the base table and the child table
 
@PaulWhite As you like :)
 
Even if they are referenced by a foreign key
Take, for example you have a vehicle base table with a field "engine type" and a car subtype with a field "drivetrain", there is no way to create a composite index on engine type and drivetrain because the fields aren't in the same table
basically table inheritance doesn't work well in my opinion
 
10:11 PM
@PaulWhite any input regarding my question? Thank you.
 
@Eugene Looks OK. Is this for Oracle?
 
Yep.
 
I suggest you post a question at the site (dba.se), to have a thorough answer. It looks like this is part of some procedure or trigger, so I can't give you a definite answer.
 
@TomV A third party app, perhaps? I still find that Q quite unclear, I fail to see where's the inheritance in the CREATE TABLE statements shown, and the OP should've included the relevant queries that they find problematic.
 
Okay. So you are saying, that one could freely replace if ... then ... else ... end if; with somevar := coalesce(:new.field, :old.field); inside trigger, right?
 
10:15 PM
@Eugene Not from me, I can barely spell Orable.
 
Okay :)
 
@TomV What role would the composite index be playing in that case?
 
@QPaysTaxes OK.
@Eugene I'm saying it looks like you can. I'm not sure.
@TomV SQL limitations, hathat ;)
 
@TomV The thing is that commonly, inheritance has OOP connotations, which implies that the child object inherits (a) properties and (b) behaviour (the methods of a class). The behaviour part cannot be applied in a database structure because inheriting methods is completely unnecessary in a relational database. The properties part is also needless because in a relational database you use only one resource to represent the things of significance: a relation or table in SQL jargon.
You can combine two relations in order to produce another new relation via, e.g., a VIEW.
On the other hand, in order to enforce supertype-subtype integrity, it's SQL which kinda falls short, but you can use ACID transactions and stored procedures in order to guarantee that each supertype row is always complemented by its corresponding subtype row.
IMHO, the key is seeing supertype-subtype structures are not the same as class inheritance in Object Oriented programming.
A supertype table has its own set of DML operations, which are of course related to the set of DML operations that apply to the related subtype tables, but they are independent. In OOP a child class inherits all the properties methods that pertain to the parent classes which are not necessary in a relational database.
 
10:31 PM
@QPaysTaxes I don't think I've ever seen someone copy another user's question before. Certainly a novelty from that point of view.
 
@TomV The way I see it, object oriented inheritance ties the object hierarchy quite strongly (which add superfluous complexity), while supertype-subtype structures are very versatile. SQL could facilitate supertype-subtype implementation and management, yes, but that's a SQL issue, not a relational model limitation.
 
@MDCCL Why was the "temp" changed to "temporal"?
 
@ypercubeᵀᴹ Isn't that some kind abbreviation? If I am wrong feel free to correct the post.
 
temp usually means temporary
 
@ypercubeᵀᴹ Sure! You are totally right, I got lost in translation, so to speak. My bad.
 
10:38 PM
A temporal error, easily fixed.
 
@MDCCL No worries. I just wasn't sure if there was a story there, like a comment from the OP. But he seems to have disappeared.
 
See that works because I will have once said "temporary error" but the error itself used to be to replace temp with temporal instead of temporary. Please let me know if that is unclear at all. Now or in the future.
 
@PaulWhite Will you provide more explanation to make it only temporarily or temporally unclear?
 
@ypercubeᵀᴹ Yes, furthermore temporal might add another non-relevant connotations to the scenario.
 
@ypercubeᵀᴹ I could have a crack at both.
 
10:42 PM
@PaulWhite No, that's pretty clear :)
@PaulWhite Fortunately, DBA.SE has provided temporal capabilities to deal with this kind of temporary problems about the usage of the terms "temp", "temporal" and "temporary".
 
10:58 PM
@PaulWhite temporal lobe controls speech.
 
@ypercubeᵀᴹ Okay. Testing it. Thank you.
 
"O tempora o mores" is a sentence by Cicero in the fourth book of his second oration against Verres (chapter 25) and First Oration against Catiline. It translates as Oh the times! Oh the customs! (Oh what times! Oh what customs! or alternatively, Alas the times, and the manners ) It is often printed as O tempora! O mores!, with the interposition of exclamation marks (not present in Classical Latin). In his opening speech against Catiline, Cicero deplores the viciousness and corruption of his age. Cicero is frustrated that, despite all of the evidence that has been compiled against Catiline, who...
 
11:17 PM
O temporal o temporary!
 
This room is very silly at times.
 
@PaulWhite there were times when was also one of the official topics, IIRC
2
 
@TomV Some people suggests the effective implementation (in SQL platforms) of ASSERTIONS in order to, among other things, deal with the integrity of supertype-subtype structures, e.g., CREATE CONSTRAINT CarIsNotBoat NOT EXISTS (Car ( CarId ) JOIN (Boat ( BoatId ));
 
@MDCCL On a declarative level, that would be nice. On the performance aspect, it doesn't say anything.
 
So the french for time is temps.
 
11:27 PM
@ypercubeᵀᴹ That's a different story, yes. When abstract meets the physical plane.
 
The greek is χρόνος and ώρα (derivatives: chronological, hour)
 
@ypercubeᵀᴹ Something that sounds like cronos, right?
 
Everytime I see "temp" in a post now I am converting it to "time" on that basis.
 
tempo, tiempo, time, temps
l'air du temps
 
@MDCCL Yes, similar (not the same) sounds but probably different etymology
 
11:31 PM
times news roman
The creation of a tag for temporal db aspects might be worth investigating
 
Already been done at some point in the future.
Enough silly. Off for bit. Back later.
 
Yes, memories from the future
 
15
Q: Origin of the word cron?

chrisjleeTrying to settle a friendly argument. Is "cron" an acronym for something? Additionally, did it's current canonical name "cron" originate from something shortened for something like chronos or chronological? A quick google search didn't find what i was looking for. It ended up being a forum th...

 
@ypercubeᵀᴹ idő - go ask your example question: area51.stackexchange.com/proposals/104668/hungarian-language/…
 
@dezso But I know no Hungarian at all. Except the notation.
@dezso Why does that page show you as having only 166 rep? Have you registered a 2nd account?
Hm, no. It is linked to your account.
 
11:45 PM
@ypercubeᵀᴹ I see only 161, but nvm
apparently, in area51 things work differently
 
@dezso OK. 161 or 166 is your Area51 rep. What do you see on my rep there?
 
@ypercubeᵀᴹ I see 151
 
@ypercubeᵀᴹ interesting
 
@ypercubeᵀᴹ 131k?
 
11:48 PM
@MDCCL yes.
It seems there is an inconsistency there.
Showing the Arae51 rep for some and the whole network rep for others.
 
And dezso shows 166. Interesting, yes
 
I guess it's a cache issue.
 
It might have to do with the chronological/temporal/temporary aspect of time
 
Please stop. My temporal lobes hurt.
 
the most important aspect of time currently is that I have to go to bed urgently (now that my stollen is baked)
@ypercubeᵀᴹ in older times you would have received a lobotomy
 

« first day (2162 days earlier)      last day (2709 days later) »