1

I am running my Oracle query here but it's not working but the same query is working in SQL Server

Here is my query:

SELECT d.dept_code,
       d.dept_name,
       d.dept_desc,
       e.comp_name
FROM   dept_master d
       inner join comp_master e
               ON d.comp_id = e.comp_id 

where in dept_master.comp_id value is the same as in Dept_Master table.

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
Vikash
  • 340
  • 1
  • 5
  • 24

2 Answers2

1

The reason you are not getting any result is mainly because of the data

do this check to see if data is available in the tables

select * from dept_master;
select * from comp_master;

and see if both tables have any matching rows, i.e.; at least 1 row has same comp_id in both tables

I hope you will find the answer after doing this exercise

dejjub-AIS
  • 1,501
  • 2
  • 24
  • 50
1

Is comp_id a character field? In that case define it as VARCHAR2 in Oracle. or try trim(d.comp_id) = trim(e.comp_id)

See a demonstration in SQL Fiddle.

Geordee Naliyath
  • 1,799
  • 17
  • 28