March 10, 2011

Kill a session

To kill a session use:

ALTER SYSTEM KILL SESSION 'sid,serial#,@inst_id';



To kill a particular session use

ALTER SYSTEM KILL SESSION '7,15';(SID ID)

March 2, 2011

Query


Extract the first occuring numbers from the srting

select replace(:string, ltrim(:string, '1234567890')) from dual;

input parameter is 12Abdg345


Count the number of occurence of a letter

select instr('Meeraghee','e') from dual


select :str as "string", :chr as "character", length(:str) - length(translate(:str,chr(0)


:chr,chr(0))) as "count"from dual;
 
replace(:string, ltrim(:string, '1234567890')) from dual;

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...