DZone Forums
Go Back   DZone Forums > Community > Databases & SQL > Oracle
Reload this Page New member introduction
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Aug 2009
Default New member introduction - 08-26-2009, 12:59 PM

Hello all,
I am new to the forums, just joined today. What brings me here are my new adventures in learning hibernate, HQL, and Oracle at the same time.
I have sucessfully written my first HQL but am curious about comparing dates. If I say as part of my query

Code:
where myDate >= sysdate
will this return rows where the data in column myDate has a date that occurs at any time during "today" ? For example, if there are three rows in the table, and all of the myDate value's are dates that are at various times during today, 8AM, 10AM, 5PM, will that date compare return all three rows ? Does the time portion of sysdate matter?

Thank you!
Kim
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Aug 2009
Default 08-26-2009, 01:54 PM

My coworker just helped me to find the problem.

Turns out I am using a tool called "Oracle SQL Developer" which I used to manually set the date to make a row that would be returned by my query. I was not aware that this tool did not change the actual date in the table, I guess it just makes a "working" version for the time I am using the tool. I am still confused by this but I guess my HQL was fine, and there really was not a proper row in the database for it to return.
Reply With Quote
  (#3 (permalink)) Old
Moderator
 
jwenting's Avatar
 
Posts: 99
Thanks: 0
Thanked 8 Times in 8 Posts
Join Date: Feb 2008
Send a message via MSN to jwenting
Default 08-27-2009, 05:23 AM

SQL Developer (like all such tools, I use a commercial alternative instead that's more powerful) will not do anything.
You issue SQL commands through it, which get executed on the database.

Unless and until you execute a commit command however, all changes are exclusive to your own session and don't affect anyone else.
So when you closed SQL Developer your update was gone, permanently. No other client ever got to see it.
Reply With Quote
  (#4 (permalink)) Old
Member
 
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Aug 2009
Default 08-27-2009, 09:33 AM

Thank you jwenting, I had to learn this the hard way! I was used to using a gui called SQLYog to attach to a mysql database, the updates were automatically commited there, so I am not accustomed to using the commit command.

Now I will not forget!
Reply With Quote
  (#5 (permalink)) Old
Moderator
 
jwenting's Avatar
 
Posts: 99
Thanks: 0
Thanked 8 Times in 8 Posts
Join Date: Feb 2008
Send a message via MSN to jwenting
Default 08-31-2009, 01:29 AM

mySQL until quite recently didn't operate transactional so there was no need to commit (essentially it had autocommit with no option to turn it off).
Reply With Quote
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help setting up new .java member in Eclipse deepdave Eclipse 1 04-08-2009 10:39 PM
My Introduction... patty3m Social Bookmarking 0 03-05-2009 02:08 PM
Change member sorting in Eclipse grkuntzmd Eclipse 0 02-09-2009 02:16 PM
wrap member variable using code formatter peterramesh Eclipse 0 12-19-2008 03:40 AM
Move Member Type to New File jackm Eclipse 0 09-24-2008 06:59 PM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com