
September 20th, 2002, 04:28 AM
|
|
Junior Member
|
|
Join Date: Sep 2002
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
how to convert a simple python code into oracle plsql
Hi,
I have a very simple and easy python code, and i want to convert it to equivalent oracle plsql code.
The problem is i dont have any idea about the python code at all.
The python code looks like this, how can i convert it to an equivalent oracle plsql code..
Any help is appreciated...
sendnumber={ '123':'8588',
'576':'8899',
'969':'9799' }
def convert_no(sNr_in):
sNo=""
for c in sNr_in:
try:
i = int(c)
sNo = s + c
except:
pass
return sNo
def NormNo(sNr_in):
sNr=string.replace(sNr_in,' ','')
#print "sNr='%s'" %sNr
if sendnumber.has_key(sNr):
return sendnumber[sNr]
elif sNr[0:8]=="01234577":
return "23456"
if not IsNumber(sNr):
return sNr_in
try:
#print "going into provider part"
if int(sNr[-10:-7]) in lst:
sNr_ok = "0044%s" %(sNr[-10:])
elif int(sNr[-11:-8]) in lst:
sNr_ok = "0044%s" %(sNr[-11:])
elif int(sNr[1:4]) in lst:
else:
raise # Telefonnummer mit unbekanntem Format
#print "NormNo from '%s' to '%s'" %(sNr_in, sNr_ok)
return sNr_ok
except:
sErrorString = "SMSStuff.py::NormNo> error in Norm number: %s" %sNr_in
print sErrorString
return sNr_in
def normNrExt(sMSIsdn):
s = convert_no(sdn)
s = NormNo(s)
return s
def isValiddn(sdn):
s = normNrExt(sdn)
if len(s) != 14 and len(s) != 15:
return FALSE
else:
return TRUE
if __name__=="__main__":
#s='0193993999'
s='0045454444444'
s1='94584383883'
s2='34343333329'
s3='445454444450'
s4='3434333343364'
print "NormNo('%s')='%s'" %(s,NormNo(s))
print "NormNo('%s')='%s'" %(s1,NormNo(s1))
print "NormNo('%s')='%s'" %(s2,NormNo(s2))
|