Home » SQL & PL/SQL » SQL & PL/SQL » Comparing a varchar and number
Comparing a varchar and number [message #969] Sat, 16 March 2002 10:02 Go to next message
KK
Messages: 24
Registered: March 2002
Junior Member
Hi!!

I have a variable which contains the following dept info:
v_dept = (1010,1011,1012)
**v_dept is a varchar2(500)**
**v_dept contains all the depts**

I want to compare this to the dept.dept_no to get the dept name.

**dept.dept_no is a number**

This is what I am trying to do:
select dept.dept_name
from dept
where dept.dept_no in (v_dept)
and dept.type = 'A';

I want to search through all the values in the variable - v_dept and only return those that have a dept type = 'A'. How do I compare a number to a character?

Any suggestions would be greatly appreciated!! Thanks!!
Re: Comparing a varchar and number [message #972 is a reply to message #969] Sun, 17 March 2002 15:19 Go to previous message
seng
Messages: 191
Registered: February 2002
Senior Member
using To_Char the number to varchar . Hope this is helping.
Previous Topic: need help with an outer join?
Next Topic: different databases
Goto Forum:
  


Current Time: Thu Apr 18 04:52:37 CDT 2024