Home » RDBMS Server » Server Administration » Re: Oracle Query
Re: Oracle Query [message #373937] Thu, 17 May 2001 10:46
Sundar Venkatasubramaniam
Messages: 26
Registered: May 2001
Junior Member
assume that col1 is abcdef and col2 is cd then if you want know what percent of col1 is col2 then try

select decode(instr(col1,col2),0,0,length(col2))/length(col1)*100 from your table;

note i always assume length of col1 is greater than col2. if you want any one may be greater and you want percentage of smaller present in greater then

select decode(sign(length(col1)-length(col2)),1,
decode(instr(col1,col2),0,0,length(col2))/length(col1)*100,
-1,decode(instr(col2,col1),0,0,length(col1))/length(col2)*100,
decode(col1,col2,100))
from your table
Previous Topic: SYSDBA/SYSOPER Role
Next Topic: Re: Oracle Query
Goto Forum:
  


Current Time: Mon Dec 23 09:37:58 CST 2024