Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle ASP
|
Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle ASP 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 15th, 2004, 05:39 PM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default search by oracle dates using asp

If the following is the table structure in Oracle 8i...

table name: TEST

ID DATE
-- ----
11 8/15/2004
12 9/15/2004
13 10/15/2004
14 11/15/2004

I know it can be done through Oracle 8i SQL PLUS by..

select * from TEST where DATE > to_date('9/1/2004', 'mm/dd/yyyy') and DATE < to_date('10/30/2004', 'mm/dd/yyyy');

The result should display...

ID DATE
-- ----
12 9/15/2004
13 10/15/2004


The question is... how can I store '9/1/2004' and '10/30/2004' into two String variables and execute the same query with the same result.

For instance,

beginningDATE = '9/1/2004'
endingDate = '10/30/2004'

select * from TEST where DATE > to_date(beginningDATE, 'mm/dd/yyyy') and DATE < to_date(endingDate, 'mm/dd/yyyy');


When I execute the above, I get the following error message:

ORA-00907: missing right parenthesis


Thanks in advance.
--Brian
 
Old September 16th, 2004, 05:27 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

beginningDATE = '9/1/2004'
endingDate = '10/30/2004'

Can you change the initilization of variables into

beginningDATE = to_date('9/1/2004' , 'mm/dd/yyyy')
endingDate = to_date('10/30/2004', 'mm/dd/yyyy')

select * from TEST where DATE between beginningDATE and endingDate;




 
Old September 16th, 2004, 03:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

just take you SQL and use that as teh SQL you pass to the Oracle database.
 
Old September 17th, 2004, 11:09 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

gokul_blr,

Thanks for your prompt answer.

However, I keep getting a syntax error. Please see below.

Syntax error
/orderlinkdev/Invoices/DailyRight.asp, line 110, column 24
beginningDate = to_date('9/14/2004', 'mm/dd/yyyy')
-----------------------^


Any other ideas?? Thanks.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding asp.net calendar dates to sql database centaury ASP.NET 3.5 Basics 0 October 22nd, 2008 02:07 AM
Passing input Dates in a Crystal Report from ASP P preethig Classic ASP Basics 4 March 5th, 2008 08:50 AM
Search and Replace Using SQL Oracle i9 Corey Beginning PHP 1 April 28th, 2007 09:58 AM
Limit Selection of Dates from Calendaer in asp.net marvz ASP.NET 2.0 Basics 0 July 21st, 2005 04:29 AM
ASP - Drop Down Box with Dates HelpMe Classic ASP Databases 1 October 21st, 2004 10:39 AM





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