How to use sub queries while inserting record into db using cx_Oracle in python?

I need to add a symbol with the value of self.wrkArea variable like this

(select chr(182) from dual) || self.wrkArea || (select chr(182) from dual)

i.e. ¶workarea¶ will be the result. how to substitute this in following query?

cursor.execute("""insert into MDP_ERR_MASTER (MARKERID, FILENAME, ERRORCODE, USERID, CHECKEDBY, CHECKEDDT, STATUS, COMMENTS, X1, Y1, Z1, X2, Y2, Z2, RECNO, PROJECT_CODE, SRC_ACC_NUM, WORKAREA, CONFIGID, ELEMENTID)
        values (:markerid,:shapename,:errcode,'0',:sysid,sysdate,'OPEN',:usercomment,:x1,:y1,0,:x2,:y2,0,1,:jobno,:srcacnum,:workarea,0,0)""",
        {"markerid" : markerId,
         "shapename" : str(errorMarkerLayer.name()),
         "errcode" : errCode ,
         "sysid" : self.sysid ,
         "usercomment" : str(comments),
         "x1" : startPnt[0],
         "y1" : startPnt[1],
         "x2" : endPnt[0],
         "y2" : endPnt[1],
         "jobno" : self.jobNo,
         "srcacnum" : src_AcNum,
         "workarea" : self.wrkArea
         })

Answers


Try changing :workarea to chr(182) || :workarea || chr(182) in the values clause.


Need Your Help

Torque job logging configuration file

logging configuration jobs pbs torque

I'm using PBS Torque and I have it in a production setting but I just realized that /var/spool/torque/job_logs is empty, I just checked the manual and it reads:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.