473,379 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Greatest Function Problem

1
Hi,

studying to do my Oracle OCA and i do not seem to understand the example in the oracle certified books for the GREATEST function. What is written is:

select greatest ('19', '24',9) string from dual

The result of this is: 9.
I have also run this on Oracle SQL*PLUS which gives me the same answer.

I do not understand why this is the case if it is the 1st expression datatype which will be used for comparison by all values in the list. My books says: "the function returns the expression that sorts highest in the datatype of the first expression".
In this case, it would be a VARCHAR and i would think that the correct answer would have been 24.

Why is it 9?
Thanks
Elise
Feb 8 '07 #1
1 1742
the function consider the values as string. and for strings 9 is greatest than 24 because it compare it at 2

thanks


Hi,

studying to do my Oracle OCA and i do not seem to understand the example in the oracle certified books for the GREATEST function. What is written is:

select greatest ('19', '24',9) string from dual

The result of this is: 9.
I have also run this on Oracle SQL*PLUS which gives me the same answer.

I do not understand why this is the case if it is the 1st expression datatype which will be used for comparison by all values in the list. My books says: "the function returns the expression that sorts highest in the datatype of the first expression".
In this case, it would be a VARCHAR and i would think that the correct answer would have been 24.

Why is it 9?
Thanks
Elise
Mar 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: zaceti | last post by:
I'm new to MySQL and I am having a problem selecting the highest valued date/time for a particular day. Here is the table structure: ...
8
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
2
by: Marv Arnold | last post by:
Hi all. I'm looking for assistance to get the greatest value from 3 or more different columns. I'm assuming that the best way is to put the columns into a temp table and use 'max' function to...
7
by: Mathew Butler | last post by:
Suppose I have a table t with columns id, col1, col2, col3, col4, col5, col6 all numeric. I want to query the table and for each value of col<x> in the resultset I want to identify the largest value...
4
by: sdlt85 | last post by:
Hi, Can someone help me with an idea on how to start writing a C++ code for generating greatest common divisor and the linear combination of two intergers represented as gcd(m, n)= mx + ny and...
30
by: Amar Kumar Dubedy | last post by:
How to find the greatest of three numbers without using any comparison operator or ternary operator??
3
by: stressedstudent | last post by:
I dont know where I am going wrong so I dont know which part to post, this is what I have, can anyone help me figure out where I am going wrong? THanks for any and all help. // into to c++ //...
2
by: Shawn Minisall | last post by:
I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a...
35
by: aarklon | last post by:
Hi all, The following question is asked frequently in interviews How to find the greatest of 2 numbers without using relational operators ? the solution i have seen is ( a+b + abs(a-b) )...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.