Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Dynamic select query

RE: Dynamic select query

From: Naveen Nahata <naveen_nahata_at_mindtree.com>
Date: Tue, 17 Dec 2002 22:38:59 -0800
Message-ID: <F001.0051C527.20021217223859@fatcity.com>


THIS WILL WORK and shud be more efficient than instr() or 'select from dual'

SELECT * FROM shipment WHERE ship_name like '%' || ship_id || '%';

Regards
Naveen

-----Original Message-----
Sent: Tuesday, December 17, 2002 6:44 PM To: Multiple recipients of list ORACLE-L

Another way to perform the same task:

select * from shipment a
where ship_name like (select '%' || a.ship_id || '%' from dual);

I wonder how efficient this is compared to using the INSTR() function.

Regards,
Charu

-----Original Message-----
Kevin
Sent: Tuesday, December 17, 2002 12:45 PM To: Multiple recipients of list ORACLE-L

Try:

SQL> SELECT *
  2 FROM shipment
  3 WHERE ship_name LIKE '%ABC%';

SHI SHIP_NAME
--- ----------
ABC 1ABC123
DEF ABC1234
GHI 1234ABC K.

-----Original Message-----
[mailto:Ranganath.Krishnaswamy_at_blr.hpsglobal.com] Sent: 17 December 2002 10:39
To: Multiple recipients of list ORACLE-L

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_at_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_at_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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Thomas, Kevin INET: KEVIN.THOMAS_at_saic.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_at_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). ********************************************************* Disclaimer This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Charu Joshi INET: joshic_at_mahindrabt.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_at_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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Naveen Nahata INET: naveen_nahata_at_mindtree.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_at_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).
Received on Wed Dec 18 2002 - 00:38:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US