Python Forum
inserting data into oracle db using python
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
inserting data into oracle db using python
#4
(May-21-2017, 08:47 PM)sahilsiddharth Wrote: import sys
import cx_Oracle

class Customer():    
   def createCustomer(self,fname):
       print ("name is %s" % fname)
       db = cx_Oracle.connect('system/12345678@localhost/XE' )
       cursor=db.cursor()
       cursor.execute("INSERT INTO telm  VALUES (fname)")
       db.commit()

fname=input("Enter your first name :")
c1=Customer();
c1.createCustomer(fname)
     

output---

Enter your first name :rahul
name is rahul
Traceback (most recent call last):
 File "E:\python\test_cust.py", line 14, in <module>
   c1.createCustomer(fname)
 File "E:\python\test_cust.py", line 9, in createCustomer
   cursor.execute("INSERT INTO telm  VALUES (fname)")
cx_Oracle.DatabaseError: ORA-00984: column not allowed here

See the "Bind Variable Patterns" section in this page.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
RE: inserting data into oracle db using python - by Ofnuts - May-21-2017, 09:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Load data in Oracle muzokh 0 330 Mar-08-2024, 11:19 PM
Last Post: muzokh
  python script for inserting rows into hbase table lravikumarvsp 7 7,279 Mar-24-2023, 04:44 AM
Last Post: parth_botadara
  Basic SQL query using Py: Inserting or querying sqlite3 database not returning data marlonbown 3 1,481 Nov-08-2022, 07:16 PM
Last Post: marlonbown
  Migrating data from oracle into postgres python_student 1 2,520 Feb-10-2022, 09:16 PM
Last Post: buran
  Encrypting Oracle Passwords / Python Library for That? bmccollum 1 2,665 Jun-11-2021, 07:59 PM
Last Post: Larz60+
  Load data from One oracle Table to Multiple tables amy83 1 1,830 Dec-02-2020, 01:57 AM
Last Post: Larz60+
  Calling Oracle REST SQL from Python johnjacob 2 2,112 Nov-05-2020, 04:19 AM
Last Post: johnjacob
  Python to Oracle Conn Issue chvsnarayana 2 46,704 Sep-06-2020, 04:33 PM
Last Post: Larz60+
  Conversion of Oracle PL/SQL(packages, functions, procedures) to python modules. DivyaKumar 2 6,628 Jul-09-2020, 04:46 PM
Last Post: srikanth7482
  Matching Regex in Python from Excelfile and inserting into database Shuzo 0 1,675 May-14-2020, 06:53 PM
Last Post: Shuzo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020