max value from a string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kanthi84
    New Member
    • Feb 2007
    • 37

    #1

    max value from a string

    In my table there is a column having values like
    DC500
    DC5001
    ..............
    .......
    .........
    DC700
    please suggest a query to select maximum value(ie DC700) from that column.......
  • kanthi84
    New Member
    • Feb 2007
    • 37

    #2
    Originally posted by kanthi84
    In my table there is a column having values like
    DC500
    DC501
    ..............
    .......
    .........
    DC700
    please suggest a query to select maximum value(ie DC700) from that column.......
    Plz reply its urgent

    Comment

    • mivey4
      New Member
      • Dec 2006
      • 37

      #3
      Originally posted by kanthi84
      Plz reply its urgent
      SELECT MAX(myColumnNam e) FROM myTableName

      Comment

      • amr
        New Member
        • Mar 2007
        • 20

        #4
        sorry mivey4 you are answer is wrong because max function will not run
        in string value,the correct answer
        select max( trim(dc from cloumn name))
        from table name;

        Comment

        • mivey4
          New Member
          • Dec 2006
          • 37

          #5
          Originally posted by amr
          sorry mivey4 you are answer is wrong because max function will not run
          in string value,the correct answer
          select max( trim(dc from cloumn name))
          from table name;

          That is incorrect amr:

          The max function will work on strings as well. It is dependent on what was initially asked. If you need to find the max value of a string Oracle will do that using the max function with a string value provided.

          Your query is correct as well if he wanted to find the max value of the integer value in the string.

          So the correct answer would be either depending on what he wanted the max value of. The function is supported for integer and string. It is in the Oracle documentation.

          Comment

          • amr
            New Member
            • Mar 2007
            • 20

            #6
            sorry mivey4 max,avg,min are numeric fn only do not work in string value
            such as 'abc' and the qustion was about string contains integer so that
            the only way to solve is i said it

            Comment

            • amr
              New Member
              • Mar 2007
              • 20

              #7
              i have one question,plz mivey4 help me i made form using scott.dept
              and i made button in this form button to insert value 'a' in table called
              temp when i press on this button message error 'no changes to save' appear to me

              Comment

              • mivey4
                New Member
                • Dec 2006
                • 37

                #8
                Originally posted by amr
                i have one question,plz mivey4 help me i made form using scott.dept
                and i made button in this form button to insert value 'a' in table called
                temp when i press on this button message error 'no changes to save' appear to me
                First, I'd be happy to assist you with your problem if I can but you haven't provided enough information for me to determine what the issue may be and according to the forum rules, I believe that your question should be posted in a new thread.

                Secondly, you should review the Oracle documentation before disputing the post of another member. Please review the following link information concerning the Max function.

                http://www.psoug.org/reference/string_func.html

                Also use of the MAX function having relevancy for implementation with strings is included as one of the many questions included in the Oracle Exams.

                I'd recommend you read the documentation more thoroughly.

                Comment

                Working...