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
  Inserting Python Buttons into KV Files edand19941 3 511 Feb-19-2025, 07:44 PM
Last Post: buran
  Conversion of Oracle PL/SQL(packages, functions, procedures) to python modules. DivyaKumar 3 8,227 Oct-01-2024, 03:32 PM
Last Post: Alex_Kirpichny
  Load data in Oracle muzokh 0 1,198 Mar-08-2024, 11:19 PM
Last Post: muzokh
  python script for inserting rows into hbase table lravikumarvsp 7 8,691 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 3,088 Nov-08-2022, 07:16 PM
Last Post: marlonbown
  Migrating data from oracle into postgres python_student 1 3,354 Feb-10-2022, 09:16 PM
Last Post: buran
  Encrypting Oracle Passwords / Python Library for That? bmccollum 1 3,536 Jun-11-2021, 07:59 PM
Last Post: Larz60+
  Load data from One oracle Table to Multiple tables amy83 1 2,286 Dec-02-2020, 01:57 AM
Last Post: Larz60+
  Calling Oracle REST SQL from Python johnjacob 2 2,707 Nov-05-2020, 04:19 AM
Last Post: johnjacob
  Python to Oracle Conn Issue chvsnarayana 2 54,843 Sep-06-2020, 04:33 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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