.NET and Oracle: joining a table into an empty set of another table
I am trying to concatenate table A with some data into an empty set of another table B. The main purpose is to get all columns of table B. I don't need any data from table B.
I created the following SQL:
SELECT uar.*, s.screen_id, s.screen_name
FROM crs_screens
LEFT JOIN crs\_user\_access\_right uar
ON s.rid IS NOT NULL AND uar.rid IS NULL
This SQL works fine on TOAD, but returns an error when I use it in my VB.NET OracleDataAdapter.Fill (DataTable) statement.
It is good if there is a workaround to achieve the same effect. Many thanks.
Error message:
OCI-22060: Argument [2] is invalid or uninitialized number
Config:
.NET Framework: 1.1
Oracle 9i
source to share
I'm not too familiar with Oracle (so I can't tell if this is an Oracle problem on purpose), but perhaps to rephrase your SQL, how this would work:
SELECT
uar.*, s.screen_id, s.screen_name
FROM
crs_screen s
LEFT JOIN crs_user_access_right uar ON uar.rid <> uar.rid
You don't need to compare data on s.rid as on the left side the crs_screen will always be included in the left outer join.
source to share
I know this is an old thread, but if anyone else had the problem "OCI-22060: argument [2] is invalid or uninitialized number", I found a solution that works for me.
for the original cursor:
select l.t_id, r.t_name, r.t_desc
left_table l left join right_table r
on r.t_id = l.t_id;
... simple refactoring ...
select -99999999 t_id, 'XXXXXXXXX' t_name, 'YYYYYYYYYYYY' t_desc from dual
union all
select l.t_id, r.t_name, r.t_desc
left_table l left join right_table r
on r.t_id = l.t_id;
... works. I just needed to filter out the dummy string in my client.
source to share