Results 1 to 3 of 3

Thread: Find newer oracle version

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    9

    Find newer oracle version

    I need to compare to Oracle versions and decide which is newer/greater. Since the versions are 5 octets, I can't use the Version datatype. Does anyone have any recommendations?

    Version 1: 11.1.0.2.0
    Version 2: 11.2.0.3.0

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Find newer oracle version

    In your case, since you're certain that each version will always have 5 octets in them, you need to write a nice function.
    In this function, you must

    a) split the strings with a .
    b) compare the lists for each element.
    c) if they are both equal, then go to the next element.
    d) the element with the higher value has the newer version.

    You could write this function in any language of your choice.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    9

    Re: Find newer oracle version

    That's what I ended up writing:

    Dim Ver, NewVer, arrVer(), arrNewVer() As String
    Dim blnVer, blnNewVer As Boolean

    Ver = "11.2.0.3.0"
    NewVer = "11.02.0.3.1"
    arrVer = Ver.Split(".")
    arrNewVer = NewVer.Split(".")
    For z As Integer = 0 To 4
    If arrVer(z) = arrNewVer(z) Then
    'continue checking
    ElseIf CInt(arrVer(z)) > CInt(arrNewVer(z)) Then
    blnVer = True
    z = 4
    ElseIf CInt(arrVer(z)) < CInt(arrNewVer(z)) Then
    blnNewVer = True
    z = 4
    End If
    Next
    If blnVer = True Then
    Console.WriteLine(Ver & " is larger than " & NewVer)
    ElseIf blnNewVer = True Then
    Console.WriteLine(Ver & " is smaller than " & NewVer)
    Else
    Console.WriteLine(Ver & " is equal to " & NewVer)
    End If
    Console.WriteLine("Press enter to continue")
    Dim x As String = Console.ReadLine

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width