hours validation [message #600174] |
Fri, 01 November 2013 14:38 |
|
thelearner
Messages: 133 Registered: April 2013 Location: INDIA
|
Senior Member |
|
|
I want to validate dynamic hours value using decode in sql...
If value is greater than 24PM it should display some statement...
if value is less than 0AM it should display some statment...
Please give suggestions.
[Updated on: Fri, 01 November 2013 14:46] Report message to a moderator
|
|
|
|
|
Re: hours validation [message #600179 is a reply to message #600174] |
Fri, 01 November 2013 15:06 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
thelearner wrote on Fri, 01 November 2013 15:38I want to validate dynamic hours value using decode in sql...
If value is greater than 24PM it should display some statement...
if value is less than 0AM it should display some statment...
What is 0am and 24pm? If you use military time, there is no am and pm.
Are you looking for the difference between 2 times? It can never be more than 24 hours, unless a date is involved. If it's a date column, just subtract the first one from the second one and get the difference in days.
[Updated on: Fri, 01 November 2013 15:09] Report message to a moderator
|
|
|
|
|
|
|
|
Re: hours validation [message #600193 is a reply to message #600176] |
Sat, 02 November 2013 01:20 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
thelearner wrote on Sat, 02 November 2013 01:18actually am taking values from apex front end form....
like course calsses time 10 am to 11 AM like...
If I given greater than 24 hours it should display an error.
Why don't you store the complete timestamp, this will make the validation quite simple. Since you say the interval should not be > 24 hours, so you just need to check the interval between start and end time <=24 hours else throw an error. Timestamp is for compliance with ANSI.
Even if you use date datatype, the difference between start and end time in terms of days will still validate.
|
|
|
Re: hours validation [message #600197 is a reply to message #600193] |
Sat, 02 November 2013 11:29 |
|
Littlefoot
Messages: 21808 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
As it is about Apex, you should create a page item validation (for example, PL/SQL function that returns error text) which would take care about valid values.
|
|
|