hi mandy,
following is the stored procedure code for your task and it really works,
here cval is the character you want to search and sval is the string
that you want to compare. just execute the procedure and pass
the above two parameters to get output.
create or replace procedure charval(cval in char,sval in varchar2)
as
pos number;
begin
if (instr(sval,cval) > 0) then
begin
pos:=ascii(cval);
if(pos>=65 and pos<=91) then
pos:=pos-64;
else
if(pos>=97 and pos<=123) then
pos:=pos-96;
end if;
end if;
end;
end if;
dbms_output.put_line('value of character is'||pos);
end;
/
do write if you don't understand the logic behind the procedure
|