Home > OS >  How to remove single inverted comma from stored proc
How to remove single inverted comma from stored proc

Time:06-09

I am stuck at the last movement, i need to remove single inverted commas from price variable that i am parsing in a stored proc

            Body_content = message.Body
            Body_content = Body_content[:Body_content.find("Regards")].strip()
            df = pd.DataFrame([Body_content])
            print(df.to_string())
            Ticker = df.to_string()[-82:-74]
            print(Ticker)
            price = df.to_string()[-8:]
            print(price)
            Date = df.to_string()[-21:-11]
            print(Date)
            Pkey = 116010910
            #print(EMAIL_CONTNT)

con = engine.connect()

date = datetime.datetime.strptime(Date,"%Y-%m-%d").strftime("%d%b%Y")
#print(date)
#tp = "call CORE_VALUATIONS.VALUATIONS.INSERTEQCLOSINGPRICE({,to_date(({Ticker}),'ddmonyyyy'),{price},NULL,NULL);"
con.execute('call CORE_VALUATIONS.VALUATIONS.INSERTEQCLOSINGPRICE(int(%s), %s,float(%s),NULL,NULL)',(Pkey,date,price))

enter image description here

CodePudding user response:

it got resolved using the following insert(%d, %s, %f, NULL, NULL)' % (int(Pkey), date, float(price))

CodePudding user response:

I am not well acquainted with Oracle SQL, but looking through the data conversion documentation and this SO question, the way to convert a string to a int or a float seems to either implicitly or via a TO_* function like TO_NUMBER.

  • Related