1. Delete: Every time you read an email, decide if the information is relevant to you. If not, delete it.
2. Do: If you can do whatever the email is requesting in two minutes, do it there and then.
3. Delegate: If it can't be done in two minutes but you are in a position todelegate it, pass it on to somebody else.
4. Defer: If you can't do the task immediately but it will take longer than two minutes, pick a time when you will get it done and add it to a to-do list.
5. Diminish: Cut down your email load by making rules in your inbox and directing emails into different folders.
6. Daily: Get your unread email count down to zero and do it daily.
Ref: http://timesofindia.indiatimes.com/life-style/relationships/work/6-Ds-to-keep-your-inbox-clutter-free/articleshow/17570989.cms
Monday, December 17, 2012
Friday, December 14, 2012
Command line command to auto kill a command after a certain amount of time
Ref: http://stackoverflow.com/questions/601543/command-line-command-to-auto-kill-a-command-after-a-certain-amount-of-time
( /path/to/slow command with options ) & sleep 5 ; kill $!
This runs the first command, inside the parenthesis, for five seconds, and then kills it. The entire operation runs synchronously, i.e. you won't be able to use your shell while it is busy waiting for the slow command. If that is not what you wanted, it should be possible to add another &.
The $! variable is a Bash built in that contains the process ID of the most recently started subshell. It is important to not have the & inside the parenthesis, doing it that way loses the process ID.
Thursday, November 29, 2012
ORACLE Find host name of a currently connected Schema/Instance
This query would give you the server host name of ORACLE machine
SELECT sys_context('USERENV', 'SERVER_HOST') FROM DUAL;
SELECT sys_context('USERENV', 'SERVER_HOST') FROM DUAL;
Monday, November 12, 2012
Oracle: Merge Date between tales OR copy from table to table
Ref:
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:5646797700346972949
I have a requirement to update 2 columns (A, B) in a arbitrarily (very, very) large table. The values that needs to be updated relies on values from another table and must be consistent with the values from the other table. Since the values in A differ from B, currently, i have to do 2 updates to the table for each record in the cursor. This is obviously inefficient. It can take longer than 12 hours to complete (and has been confirmed as such). There surely must be some way to improve the process. All my reading and trawling the web seems to point to using FETCH, BULK COLLECT and LIMIT etc. Is this the way to go? Can you please perhaps furnish an example?
See the code example below:
Thanks!
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:5646797700346972949
You Asked
Hello,I have a requirement to update 2 columns (A, B) in a arbitrarily (very, very) large table. The values that needs to be updated relies on values from another table and must be consistent with the values from the other table. Since the values in A differ from B, currently, i have to do 2 updates to the table for each record in the cursor. This is obviously inefficient. It can take longer than 12 hours to complete (and has been confirmed as such). There surely must be some way to improve the process. All my reading and trawling the web seems to point to using FETCH, BULK COLLECT and LIMIT etc. Is this the way to go? Can you please perhaps furnish an example?
See the code example below:
declare
CURSOR tran
IS
SELECT oid, user_account_number FROM user_account001;
BEGIN
FOR t IN tran
LOOP
UPDATE transaction001
SET payer_account_number = t.user_account_number
WHERE payer_account_oid = t.oid;
UPDATE transaction001
SET payee_account_number = t.user_account_number
WHERE payee_account_oid = t.oid;
END LOOP;
END;
Thanks!
and we said...
why is this anything more than:begin merge into transaction001 t using user_account001 ua on ( t.payer_account_oid = ua.oid ) when matched then update set payer_account_number = ua.user_account_number; merge into transaction001 t using user_account001 ua on ( t.payee_account_oid = ua.oid ) when matched then update set payee_account_number = ua.user_account_number; end;
Sunday, November 11, 2012
Oracle: varying elements in IN list(comma separated string)
Ref: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:110612348061
You can use a bind variable in an IN but I don't think it'll do what you want. I believe
you want a string that has the value:
1, 2, 3
for example (a single variable) to be used in a query like:
select * from t where x in ( :that_variable );
and have all rows returned such that x is in the set of 1, 2, 3. What would happen
though is that every row in T such that x = "1, 2, 3" would be returned (if it worked the
other way -- you would never be able to IN on something with commas in it).
One 'trick' that works very well on Oracle8.0 and up is to use an object type that is a
nested table type and a simple parse routine that returns this nested table type given a
string input. What I mean is best explained via an example:
ops$tkyte@8i> create or replace type myTableType as table of number;
2 /
Type created.
ops$tkyte@8i> create or replace function str2tbl( p_str in varchar2 ) return myTableType
2 as
3 l_str long default p_str || ',';
4 l_n number;
5 l_data myTableType := myTabletype();
6 begin
7 loop
8 l_n := instr( l_str, ',' );
9 exit when (nvl(l_n,0) = 0);
10 l_data.extend;
11 l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
12 l_str := substr( l_str, l_n+1 );
13 end loop;
14 return l_data;
15 end;
16 /
Function created.
ops$tkyte@8i>
ops$tkyte@8i> select * from all_users
2 where user_id in ( select *
3 from THE ( select cast( str2tbl( '1, 3, 5, 7, 99' ) as mytableType ) from dual ) )
4 /
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
SYSTEM 5 20-APR-99
Sunday, November 4, 2012
Friday, November 2, 2012
Subscribe to:
Posts (Atom)