May 2, 2008

Configure network in CentOS5

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0

for Static


DEVICE=eth0

ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
IPADDR=172.16.1.3
NETMASK=255.255.0.0
GATEWAY=172.16.10.1

for dhcp

DEVICE=eth0
ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
BOOTPROTO=dhcp

Mar 7, 2008

Working with Procedures

CREATE OR REPLACE PROCEDURE archive_orders
(cust_id IN NUMBER
,retention IN NUMBER) IS
BEGIN
DELETE orders
WHERE customer = cust_id
AND order_date < SYSDATE - retention;
INSERT INTO maint_log
(action, action_date, who) VALUES
('archive orders '||retention||' for '||cust_id
,SYSDATE ,USER);
END;

EXEC DBMS_OUTPUT.PUT_LINE('Hello world!');
CALL DBMS_OUTPUT.PUT_LINE('Hello world!');

Working with Functions

CREATE OR REPLACE FUNCTION is_weekend(
check_date IN DATE DEFAULT SYSDATE)
RETURN VARCHAR2 AS
BEGIN
CASE TO_CHAR(check_date,'DY')
WHEN 'SAT' THEN
RETURN 'YES';
WHEN 'SUN' THEN
RETURN 'YES';
ELSE
RETURN 'NO';
END CASE;
END;

Mar 5, 2008

ldd command - shared libraries

ldd command: prints the shared libraries required by each program or shared library specified on the command line.

Mar 3, 2008

Sort the null or blank value in SQL

ORDER BY
CASE
WHEN #sort_column IS NULL THEN '2'
WHEN #sort_column = '' THEN '1'
ELSE '0'
END,
#sort_column [ASC or DESC]

Feb 29, 2008

Remove .svn

When we need to remove .svn from each directories in a project (Using Subversion to control code), run following command in Unix/Linux:
$ find . -name .svn -print0 | xargs -0 rm -rf

*Note
using zip to compress file/folder in Unix/Linux

$ zip -r FCH.zip FCH
$ upzip FCH.zip

Feb 1, 2008

Jdeveloper and SVN

JDeveloper with svn (Subversion)
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/subversion/subversion.html