New member / outer join problem

2003-11-06 Thread attila.mosolygo
Hi All,

I'm a new member on this list. I'm not too familiar with ORA, but I have some 
experience in other RDBMS's.

I had run into the following problem.
My task is to write a query, which returns with an empty (full of NULLs) row, if the 
condition is false.

I'm thinking in outer joins.

I made a test. It returns all the matching rows (if there are such rows), but 
unfortunately returns with no row, if the condition is false.
Could someone help me, what could be the problem? My oppinion is that it must be work 
fine...  :-)

I use Oracle9i Enterprise Edition Release 9.2.0.1.0 .

My test is here:
--
create table ATTILA_1 (m1 varchar2(10));
insert into attila_1 values('a');
insert into attila_1 values('a');
insert into attila_1 values('b');

SELECT
b.*
FROM
  dual left outer JOIN ATTILA_1 b 
 ON (b.m1='c');

---

It returns correctly (with 2 or 1 rows) if the string in the condition is 'a' or 'b', 
but returns with no row (I'd like to see one row, with full of NULLs) if I call it 
with 'c'... :-(

Could you tell me, why is this? Or any idea to solve this task?

Thanks in advance:
Attila
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: [EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


RE: New member / outer join problem

2003-11-06 Thread Stephane Faroult
Attila,

  Review your logic. A row full of NULLs has no signification. If your statement is 
embedded into either some PL/SQL code or a 3rd generation language, Oracle will 
generate a 'no data found' error, and this is what you need to trap.
  For instance in PL/SQL

   begin
 select c1, c2, c3
 into var1, var2, var3
 from some_table
 where some_condition;
   exception
 when no_data_found yhen
 var1 := null;
 var2 := null;
 var3 := null;
   end;

   At this point, you have what you want into var1 ... varn.
 Assuming that the query may return several rows, you can do a BULK COLLECT into 
arrays.

  HTH,

  SF

- --- Original Message --- -
From: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L
[EMAIL PROTECTED]
Sent: Thu, 06 Nov 2003 04:04:38

Hi All,

I'm a new member on this list. I'm not too familiar
with ORA, but I have some experience in other
RDBMS's.

I had run into the following problem.
My task is to write a query, which returns with an
empty (full of NULLs) row, if the condition is
false.

I'm thinking in outer joins.

I made a test. It returns all the matching rows (if
there are such rows), but unfortunately returns
with no row, if the condition is false.
Could someone help me, what could be the problem?
My oppinion is that it must be work fine...  :-)

I use Oracle9i Enterprise Edition Release 9.2.0.1.0
.

My test is here:
--
create table ATTILA_1 (m1 varchar2(10));
insert into attila_1 values('a');
insert into attila_1 values('a');
insert into attila_1 values('b');

SELECT
b.*
FROM
  dual left outer JOIN ATTILA_1 b 
 ON (b.m1='c');

---

It returns correctly (with 2 or 1 rows) if the
string in the condition is 'a' or 'b', but returns
with no row (I'd like to see one row, with full of
NULLs) if I call it with 'c'... :-(

Could you tell me, why is this? Or any idea to
solve this task?

Thanks in advance:
Attila
-- 
Please see the official ORACLE-L FAQ:
http://www.orafaq.net
-- 
Author: [EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Stephane Faroult
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


RE: New member / outer join problem

2003-11-06 Thread attila.mosolygo
Hi Stephane,

  Review your logic. A row full of NULLs has no signification. If your statement is 
embedded into either some PL/SQL code or a 3rd generation language, Oracle will 
generate a 'no data found' error, and this is what you need to trap.

I want to run it in SQL, not in PL/SQL.

I Understand, what you mean - one of my collague asked me to solve this problem (the 
environment, in which he wants to embed this code requires some rows).
Of course, the full NULL row has no meaning. But our DB is very-very dirty (no 
comment), so in normal case where I want to use this statement, there is always a row.

Finally I solved this problem with a workaround:

-
SELECT
b.*
FROM
  dual left outer join ATTILA_1 b 
 ON ((b.m1=dummy or 1=1 )and b.m1='c')
-

So I realized, if there is no column from the left side in the join-expression, the 
select will return no rows if there is no matching row(s) in the right side. (If 
there are matching rows, the select will provide them). With this trick it will 
provide the required result...
I don't know, if this is a bug, or this is the normal operation


Thanks -
Attila
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: [EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


outer join problem

2001-09-06 Thread Harvinder Singh

Hi,

In one of our queries a table is participating in 3 outer joins ..but oracle
only allows one outer join per table
how can we achieve to have more than 1 outer join for a particular table :

for example like :

t_recur.id_prop = t_pl_map.id_pi_template(+) and
  t_discount.id_prop = t_pl_map.id_pi_template(+) and
  t_aggregate.id_prop = t_pl_map.id_pi_template(+) and


Thanks
-Harvinder   
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: outer join problem

2001-09-06 Thread Jan Pruner

May be???:

select xyz from t1 a, t1 b, t1 c, t2 d, t3 e, t4 f where
d.id_prop = a.id_pi_template(+) and
  e.id_prop = b.id_pi_template(+) and
   f.id_prop = c.id_pi_template(+) and
  a.rowid = b.rowid and a.row_id = c.rowid and ...

Jan Pruner

Dne ?t  6. zá?í 2001 19:26 jste napsal(a):
 Hi,

 In one of our queries a table is participating in 3 outer joins ..but
 oracle only allows one outer join per table
 how can we achieve to have more than 1 outer join for a particular table :

 for example like :

 t_recur.id_prop = t_pl_map.id_pi_template(+) and
   t_discount.id_prop = t_pl_map.id_pi_template(+) and
   t_aggregate.id_prop = t_pl_map.id_pi_template(+) and


 Thanks
 -Harvinder
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jan Pruner
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: outer join problem

2001-09-06 Thread Regina Harter

Why are you trying to join three different tables to values which may not 
exists?  Are those three tables related to each other outside of what you 
show here?  If not, and this statement worked, you would end up with a 
matrix join between those three tables.  Is that what you are looking for?

At 09:26 AM 9/6/01 -0800, you wrote:
Hi,

In one of our queries a table is participating in 3 outer joins ..but oracle
only allows one outer join per table
how can we achieve to have more than 1 outer join for a particular table :

for example like :

t_recur.id_prop = t_pl_map.id_pi_template(+) and
   t_discount.id_prop = t_pl_map.id_pi_template(+) and
   t_aggregate.id_prop = t_pl_map.id_pi_template(+) and


Thanks
-Harvinder
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Harvinder Singh
   INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Regina Harter
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: outer join problem

2001-09-06 Thread Mercadante, Thomas F

Harvinder,

in this particular case, I don't see the need to perform multiple outer
joins.

why not change it to:

t_recur.id_prop = t_pl_map.id_pi_template(+) and
t_discount.id_prop = t_recur.id_prop and
t_aggregate.id_prop = t_recur.id_prop and

This allows the outer join to the t_pl_map table, but hard-joins the other
tables together.

Would this work?


Tom Mercadante
Oracle Certified Professional


-Original Message-
Sent: Thursday, September 06, 2001 1:27 PM
To: Multiple recipients of list ORACLE-L


Hi,

In one of our queries a table is participating in 3 outer joins ..but oracle
only allows one outer join per table
how can we achieve to have more than 1 outer join for a particular table :

for example like :

t_recur.id_prop = t_pl_map.id_pi_template(+) and
  t_discount.id_prop = t_pl_map.id_pi_template(+) and
  t_aggregate.id_prop = t_pl_map.id_pi_template(+) and


Thanks
-Harvinder   
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mercadante, Thomas F
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: outer join problem

2001-09-06 Thread Koivu, Lisa
Title: RE: outer join problem





Try inline views. They will solve your problem.


Lisa Koivu
I can't believe I work here.
Fairfield Resorts, Inc.
954-935-4117



-Original Message-
From: Harvinder Singh [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 1:27 PM
To: Multiple recipients of list ORACLE-L
Subject: outer join problem


Hi,


In one of our queries a table is participating in 3 outer joins ..but oracle
only allows one outer join per table
how can we achieve to have more than 1 outer join for a particular table :


for example like :


t_recur.id_prop = t_pl_map.id_pi_template(+) and
 t_discount.id_prop = t_pl_map.id_pi_template(+) and
 t_aggregate.id_prop = t_pl_map.id_pi_template(+) and



Thanks
-Harvinder 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
 INET: [EMAIL PROTECTED]


Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).