Return-Path: <root@fatcity.cts.com>
Received: from ensim.rackshack.net (root@localhost)
 by orafaq.net (8.11.6/8.11.6) with ESMTP id gBHGMFM16790
 for <oracle-l@orafaq.net>; Tue, 17 Dec 2002 10:22:15 -0600
X-ClientAddr: 209.68.248.164
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by ensim.rackshack.net (8.11.6/8.11.6) with ESMTP id gBHGMF316785
 for <oracle-l@orafaq.net>; Tue, 17 Dec 2002 10:22:15 -0600
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id FAA31359;
 Tue, 17 Dec 2002 05:03:20 -0800 (PST)
Received: by fatcity.com (26-Feb-2001/v1.0g-b72/bab) via UUCP id 0051B09F; Tue, 17 Dec 2002 03:44:41 -0800
Message-ID: <F001.0051B09F.20021217034441@fatcity.com>
Date: Tue, 17 Dec 2002 03:44:41 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: JayK@ibsplc.com
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: JayK@ibsplc.com
Subject: Re: Dynamic select query
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 72; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="=_alternative 004104F465256C92_="
--=_alternative 004104F465256C92_=
Content-Type: text/plain; charset="us-ascii"

Hi Kris,
You can do that using the following query :

select ship_id,ship_name from shipment where ship_name in
(select ship_name from test where instr(ship_name,ship_id)>1);

Best Regards
Jai





"Krishnaswamy, Ranganath" <Ranganath.Krishnaswamy@blr.hpsglobal.com>
Sent by: root@fatcity.com
12/17/02 04:08 PM
Please respond to ORACLE-L

 
        To:     Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
        cc: 
        Subject:        Dynamic select query


Hi all,

                 I have a table by name shipment with two columns say 
ship_id and
ship_name and data as follows:

SHIP_ID          SHIP_NAME
-------------            -------------------
ABC                              1ABCLMN
XYZ                              23XYZ1112
ABB                              123LM

                 I want to select all the columns in shipment table which 
has ship_id
as string in the ship_name column.  For example, ship_id 'ABC' is present 
in
'1ABCLMN'.  So that record should be selected.  The ship_id string may 
start
from any position and end at any position in ship_name column.  So I 
cannot
use the substr function in this case.  How do I write the select clause 
for
this requirement?

                 Any help in this regard is very much appreciated.

Thanks and Regards,

Ranganath
WARNING: The information in this message is confidential and may be 
legally
privileged. It is intended solely for the addressee.  Access to this 
message
by anyone else is unauthorised.  If you are not the intended recipient, 
any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be 
unlawful.
Please immediately contact the sender if you have received this message in
error. Thank you.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Krishnaswamy, Ranganath
  INET: Ranganath.Krishnaswamy@blr.hpsglobal.com

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: ListGuru@fatcity.com (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).




--=_alternative 004104F465256C92_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">Hi Kris,</font>
<br><font size=2 face="sans-serif">You can do that using the following query :</font>
<br>
<br><font size=2 face="sans-serif">select ship_id,ship_name from shipment where ship_name in</font>
<br><font size=2 face="sans-serif">(select ship_name from test where instr(ship_name,ship_id)&gt;1);</font>
<br><font size=2 face="sans-serif"><br>
Best Regards<br>
Jai</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>&quot;Krishnaswamy, Ranganath&quot; &lt;Ranganath.Krishnaswamy@blr.hpsglobal.com&gt;</b></font>
<br><font size=1 face="sans-serif">Sent by: root@fatcity.com</font>
<p><font size=1 face="sans-serif">12/17/02 04:08 PM</font>
<br><font size=1 face="sans-serif">Please respond to ORACLE-L</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;Multiple recipients of list ORACLE-L &lt;ORACLE-L@fatcity.com&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;Dynamic select query</font></table>
<br>
<br>
<br><font size=2><tt>Hi all,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I have a table by name shipment with two columns say ship_id and<br>
ship_name and data as follows:<br>
<br>
SHIP_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SHIP_NAME<br>
------------- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-------------------<br>
ABC &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1ABCLMN<br>
XYZ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 23XYZ1112<br>
ABB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 123LM<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I want to select all the columns in shipment table which has ship_id<br>
as string in the ship_name column. &nbsp;For example, ship_id 'ABC' is present in<br>
'1ABCLMN'. &nbsp;So that record should be selected. &nbsp;The ship_id string may start<br>
from any position and end at any position in ship_name column. &nbsp;So I cannot<br>
use the substr function in this case. &nbsp;How do I write the select clause for<br>
this requirement?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Any help in this regard is very much appreciated.<br>
<br>
Thanks and Regards,<br>
<br>
Ranganath<br>
WARNING: The information in this message is confidential and may be legally<br>
privileged. It is intended solely for the addressee. &nbsp;Access to this message<br>
by anyone else is unauthorised. &nbsp;If you are not the intended recipient, any<br>
disclosure, copying, or distribution of the message, or any action or<br>
omission taken by you in reliance on it, is prohibited and may be unlawful.<br>
Please immediately contact the sender if you have received this message in<br>
error. Thank you.<br>
-- <br>
Please see the official ORACLE-L FAQ: http://www.orafaq.com<br>
-- <br>
Author: Krishnaswamy, Ranganath<br>
 &nbsp;INET: Ranganath.Krishnaswamy@blr.hpsglobal.com<br>
<br>
Fat City Network Services &nbsp; &nbsp;-- 858-538-5051 http://www.fatcity.com<br>
San Diego, California &nbsp; &nbsp; &nbsp; &nbsp;-- Mailing list and web hosting services<br>
---------------------------------------------------------------------<br>
To REMOVE yourself from this mailing list, send an E-Mail message<br>
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in<br>
the message BODY, include a line containing: UNSUB ORACLE-L<br>
(or the name of mailing list you want to be removed from). &nbsp;You may<br>
also send the HELP command for other information (like subscribing).<br>
<br>
</tt></font>
<br>
<br>
--=_alternative 004104F465256C92_=--
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: JayK@ibsplc.com

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: ListGuru@fatcity.com (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).

