Tuesday, 5 March 2013
Using sql count/sum in a case statement in Oracle
Note :
For COUNT : need to use null value you like to ignore
For SUM : need to use null /zero value you like to ignore
select count(case
when retrieve_time is null then
null
else
1
END) as retrieved
from TABLE_A
where CREATED_TIME > gmt_sysdate - 30;
select sum(case
when retrieve_time is null then
0
else
1
END) as retrieved
from TABLE_A
where CREATED_TIME > gmt_sysdate - 30;
select sum(case
when retrieve_time is null then
null
else
1
END) as retrieved
from TABLE_A
where CREATED_TIME > gmt_sysdate - 30;
select to_char(CREATED_TIME, 'YYYY/MM/DD'),
count(case
when retrieve_time is null then
null
else
1
END) as retrieved
from TABLE_A
where CREATED_TIME > gmt_sysdate - 30
group by to_char(CREATED_TIME, 'YYYY/MM/DD');
Tuesday, 27 November 2012
Oracle Utilities
REF :
- http://www.orafaq.com/wiki/DBMS_SCHEDULER
- http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sched.htm
- http://www.oracleutilities.com/OSUtil/tkprof.html
- http://www.oracleutilities.com/
- http://www.oracleutilities.com/Packages/TraceAnalyzer_IOUG.pdf
- http://www.oracleutilities.com/Ora10GUtilities.pdf
- http://www.comp.nus.edu.sg/~ooibc/courses/sql/
Wednesday, 29 August 2012
File handling utilities
wget & curl
wget 'FILE_URL'
http://en.wikipedia.org/wiki/Wget
http://daniel.haxx.se/docs/curl-vs-wget.html
SCP
scp FILE USERNAME@HOST:DESTIONATION_DIR
FTP
Transfer multiple file through FTP mput , mget & mdelete.
#! /bin/sh
REMOTE='host'
USER='username'
PASSWORD='pwd'
FTPLOG='ftpmput.log'
date >> $FTPLOG
ftp -n $REMOTE <<_ftp>>$FTPLOG
quote USER $USER
quote PASS $PASSWORD
bin
cd /support/touat/
mput *.txt
quit
_FTP
lftp
sftp
Thursday, 12 July 2012
Expose local directory images through Tomcat Sever
Option 1
Enable directory listing for specific URL pattern in web.xml
listImages org.apache.catalina.servlets.DefaultServlet debug 0 listings true 100 listImages /listImages/*
Option 2 NOTE: This will affects all folders in the webapp. It is best to enable directory listing only for an individual folder by writing own Servlet to handle the request.
1.Create a Context element in an XML file: Image.xml
2.Copy the Image.xml file to $CATALINA_HOME/conf/Catalina/localhost/.
3.Enable Directory listing in in Tomcat. Edit the default servlet in the {$CATALINA_HOME}/conf/web.xml file.
default org.apache.catalina.servlets.DefaultServlet debug 0 listings true 1
4.Change the param-value; to true for the param-name listing section.
listings true
Thursday, 31 May 2012
SCM : Accurev
Just for the record, Accurev is a very good tool.
Software configuration management
http://www.accurev.com/accurev.html
http://www.accurev.com/demonstration.html
Subscribe to:
Posts (Atom)