Home » RDBMS Server » Server Administration » Using Decimal Point in substr parameters
Using Decimal Point in substr parameters [message #370745] Fri, 28 January 2000 15:19 Go to next message
Kumar
Messages: 115
Registered: December 1998
Senior Member
Could you please let me know what is the mean of
using decimal point in substr.
For eg.
select substr('abcdefg',3.1,4)
form dual

cdef
Thankyou
Re: Using Decimal Point in substr parameters [message #370746 is a reply to message #370745] Fri, 28 January 2000 17:29 Go to previous messageGo to next message
Edward Jayaraj
Messages: 7
Registered: December 1999
Junior Member
I don't think the function uses the decimal point. It truncates the values and uses the number.
Re: Using Decimal Point in substr parameters [message #370748 is a reply to message #370746] Sat, 29 January 2000 14:19 Go to previous messageGo to next message
Kamalesh
Messages: 2
Registered: January 2000
Junior Member
Hi,

Yes I know this is truncates the values !
Then what the mean of this . !!

Kamalesh
Re: Using Decimal Point in substr parameters [message #370751 is a reply to message #370746] Sun, 30 January 2000 07:54 Go to previous message
Paul
Messages: 164
Registered: April 1999
Senior Member
Kumar,
Well, if you think about it, SUBSTR requires integer values - it cannot possibly select the
2.3rd character or display 5.7 characters. So that leaves three possible behaviors if a decimal values are entered - round, truncate, or error off. Oracle chose to truncate them. It could be argued that rounding would be more 'logical', since this is the default behavior when you assign a decimal value to an integer, or that erroring off would actually be the 'correct' thing to do; but personally, I'm just happy that they chose to handle both parameters the same way.
Regards,
Paul
Previous Topic: How can I find Nth minimum number
Next Topic: selecting, updating user-defined data types
Goto Forum:
  


Current Time: Sat Oct 24 04:31:02 CDT 2020