Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle ASP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 15th, 2004, 05:39 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
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
  #2 (permalink)  
Old September 16th, 2004, 05:27 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , India.
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;




  #3 (permalink)  
Old September 16th, 2004, 03:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
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.
  #4 (permalink)  
Old September 17th, 2004, 11:09 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
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.



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:50 AM.


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