Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7089351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:54:40+00:00 2026-05-28T07:54:40+00:00

I am trying to run these commands using cx_oracle: begin add_command_pkg.add_command ( command_id =>

  • 0

I am trying to run these commands using cx_oracle:

begin
add_command_pkg.add_command
(  command_id    => 7,
   expiry_time   => sysdate + 7
 );

add_command_pkg.add_command
(  command_id    => 12,
   expiry_time   => sysdate + 7
 );
commit;
end;

So this is my Python code:

dsn = cx_Oracle.makedsn(hostname, port, sid)
orcl = cx_Oracle.connect(username + '/' + password + '@' + dsn)

curs = orcl.cursor()
cmd = "begin \n\
       add_command_pkg.add_command \n\
       (  command_id    => 7, \n\
          expiry_time   => sysdate + 7 \n\
       ); \n\
       \n\
       add_command_pkg.add_command \n\
       (  command_id    => 12, \n\
          expiry_time   => sysdate + 7 \n\
       ); \n\
       commit; \n\
       end;"

curs.execute(cmd)
orcl.close()

When I run this code, I get this error:

cx_Oracle.InterfaceError: not a query

So how do I run these sql commands that aren’t queries using cx_oracle?

Edit:

After making changes this is what I have now:

            curs.callproc('add_command_pkg.add_command', [],
                          { 'command_id' : 7,
                            'session_id' : 'null',
                            'p_expiry_time' : 'sysdate + 7',
                            'config_id' : 6 })

When I run this, I get this error:

File “N:\App\MainWidget.py”, line 456, in myFunc
‘config_id’ : 6 })
cx_Oracle.DatabaseError: ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at line 1

Also, how do I commit this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:54:41+00:00Added an answer on May 28, 2026 at 7:54 am

    The best way is to call the procedure directly using callproc.

    curs.callproc['add_command_pkg.add_command',['7', 'sysdate + 7']]
    orcl.commit()
    

    or if you need to use keyword arguments directly use a dictionary not a list.

    curs.callproc['add_command_pkg.add_command'
                 , {'command_id' : '7', 'expiry_time' : 'sysdate + 7'}]
    orcl.commit()
    

    The actual syntax is

    curs.callproc['package_name.procedure_name'
                 , ['list_argument1', 'list_argument2']
                 , {'keyword_argument1' : 'keyword1'}
                 ]
    

    Which is the same as the following in Oracle

    begin
        package_name.procedure_name( 'list_argument1', 'list_argument2'
                                   , keywork_argument1 => 'keyword1');
    end;
    

    Whilst I’m about the connect method can be called in the following way without the need for concatenation:

     cx_Oracle.connect(username, password, dsn)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to run an Eclipse Dynamic Web Project under a Tomcat setup using
Im trying to implement a scenario using threads to execute concurrent commands on a
I'm trying to execute a series of commands using Pythons subprocess module, however I
I am trying to run a series of HTML selenium tests using the selenese
I'm trying to run the following commands: replace -x must A2input.txt replace -x a
I am trying to run these two .data files from my c++ code for
I am trying to include ngen to my installer using this article . I
I am using python 2.7 and the cx_Oracle module. When I try to run
I am trying to run an awk script using python, so I can process
I am trying to run simple shell commands in my script, but am unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.