Home » Developer & Programmer » Forms » How to use LIKE operator in develoepr 10g
How to use LIKE operator in develoepr 10g [message #271152] Sun, 30 September 2007 02:49 Go to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Dear Experts,

i wrote the following code, its executing and compiling
but no output found:
-----------------------------------------------
declare
cursor c is
select empno,ename,sal,job from emp
where UPPER(job) like 'UPPER(:emp.jname)%';

begin
---clear_block;
go_block('emp');
open c;
clear_block;
loop
fetch c into :emp.empno,:emp.ename,:emp.sal,:emp.JOB;
next_record;
exit when c%notfound;
end loop;
close c;

--EXCEPTION
-- WHEN NO_DATA_FOUND THEN
--MESSAGE('HELLO');
--first_record;
end;

-------------------------------------------------

***** My problem is the above code is executing
without any error but i am not getting any output.

is my Code Okay, to use the LIKE Operator in the above
code?

Note: as Example if i type PR instead of PRESIDENT
to view the data of employees who is President.
my query finds no output. but the PRESIDENT job is exists
in my emp table.

please help me.

Best Regards,

Kamal Hossain
Re: How to use LIKE operator in develoepr 10g [message #271153 is a reply to message #271152] Sun, 30 September 2007 03:23 Go to previous messageGo to next message
ora10g
Messages: 7
Registered: July 2006
Junior Member
below part is incorrect
select empno,ename,sal,job from emp
where UPPER(job) like 'UPPER(:emp.jname)%'

correct one should be
select empno,ename,sal,job from emp
where UPPER(job) like UPPER'(:emp.jname)%'
Re: How to use LIKE operator in develoepr 10g [message #271157 is a reply to message #271153] Sun, 30 September 2007 04:10 Go to previous messageGo to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Dear Mr. Ora10g,

i tried with your correction but still not working.......no datafound





Thanks

Kamal hossain

[Updated on: Sun, 30 September 2007 04:11]

Report message to a moderator

Re: How to use LIKE operator in develoepr 10g [message #271174 is a reply to message #271152] Sun, 30 September 2007 07:20 Go to previous messageGo to next message
hemavb
Messages: 103
Registered: May 2007
Location: Dubai , UAE
Senior Member
Modify your statement:

select empno,ename,sal,job
from emp
where UPPER(job) like UPPER(:emp.jname)||'%';

or

select empno,ename,sal,job
from emp
where INSTR(UPPER(job), UPPER(:emp.jname)) > 0;


Re: How to use LIKE operator in develoepr 10g [message #271228 is a reply to message #271174] Sun, 30 September 2007 23:44 Go to previous message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Dear HemaVb,

Thank you very much. your code working and i got my desired output.



Thank you,

Kamal Hossain
dhaka,Bangladesh






Previous Topic: search for excel.exe in computer
Next Topic: custom.pll
Goto Forum:
  


Current Time: Mon Mar 10 14:38:52 CDT 2025