Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2010, 02:22 AM
Authorized User
 
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default How to use IN statement with asc/desc in ORACLE queries?

How to use IN statement with asc/desc in ORACLE queries?

Following queries worked properly, which are without IN statement:


1-SELECT ROLE,NAME,INSTITUTION
FROM ROLE
ORDER BY INSTITUTION ASC


2-Select Error, NAME,DESCRIPTION,FILE,CATEGORY
from errorcodes ORDER BY CODE ASC;

but when I use ORACLE query with IN it gives error, the query is:

3-SELECT *
FROM CUST
WHERE ORDER BY Channel IN ('0007', '9999','0001') ASC;

How can I write the above query properly?

Thanks in advance.
__________________
How to do programming?
 
Old September 20th, 2010, 03:38 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm no Oracle expert but usually the IN operator is part of the WHERE clause:
Code:
SELECT * FROM CUST
WHERE Channel IN ('0007', '9999','0001')
ORDER BY Channel ASC;
__________________
Joe
http://joe.fawcett.name/





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use IN statement with asc/desc in ORACLE/SQL queries? arbab SQL Language 1 September 20th, 2010 08:46 AM
Using the Asc function langsha BOOK: Access 2003 VBA Programmer's Reference 3 November 25th, 2008 12:13 PM
Get charactor from Asc value hiruni Beginning VB 6 2 February 7th, 2006 10:51 PM
ORDER BY id ASC gilgalbiblewheel Classic ASP Databases 1 January 5th, 2005 12:20 AM
How to put Desc/Asc triangle symbol on List View? hplim18 VB How-To 1 May 10th, 2004 12:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.