aruku
asked on
Please respond to this query
Conditions:
map table1.column1 if not null / spaces else table2.column2 if not null/spaces
else spaces
column 1 datatype is in char ----it should be in varchar2
column 2 datatypes is in numeric value ------it should be in varchar2
Query:
Select(case when table1.column1 is not null and table1.column1 = ''
then cast( table1.column1 as varchar2(25)) when table2.column2 is not null and
table2.column2 ='' then cast(table2.column2 as varchar2(25)) else '' end) from table1,table2
The error is as
table 1 has invalid identifier
map table1.column1 if not null / spaces else table2.column2 if not null/spaces
else spaces
column 1 datatype is in char ----it should be in varchar2
column 2 datatypes is in numeric value ------it should be in varchar2
Query:
Select(case when table1.column1 is not null and table1.column1 = ''
then cast( table1.column1 as varchar2(25)) when table2.column2 is not null and
table2.column2 ='' then cast(table2.column2 as varchar2(25)) else '' end) from table1,table2
The error is as
table 1 has invalid identifier
your code is seems clear... expect the relation between the tables... in your case there is a cross join... you should define the relation between the tables...
Select case when table1.column1 is not null and table1.column1 = '' then cast( table1.column1 as varchar2(25))
when table2.column2 is not null and table2.column2 ='' then cast(table2.column2 as varchar2(25))
else '' end
from table1,table2
ASKER
As there is no condition in common between the tables Do I need to join them?
as when the first condition is not satisfied it will go to the next one and the first one get
overlapped. I am running the same error in Oracle but i am getting the error as table 1 is indefinate. Do i need to join the table
as when the first condition is not satisfied it will go to the next one and the first one get
overlapped. I am running the same error in Oracle but i am getting the error as table 1 is indefinate. Do i need to join the table
please show some sample data from the 2 tables, as well as the resulting data requested...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is there no link/join between the 2 tables?
apart from that, I see no code that would raise that error.
can you clarify how exactly you run it, please?