Re: [cx-oracle-users] Cx_Oracle Module Problem
Brought to you by:
atuining
From: Amaury F. d'A. <ama...@gm...> - 2011-02-03 23:46:51
|
Hi, 2011/2/3 Roberto Badillo Ibarra <bet...@ho...>: > Can I run a SQL Script Using Cx_Oracle Module ?? Not with cx_Oracle, but cx_OracleTools can run a SQL script. http://cx-oracletools.sourceforge.net/ See the PatchDB utility. > Can I run cursos.execute With the data I put here Below ??? > > truncate table missed_int_day; > truncate table missed_int_hr; > > DECLARE > ORG_EXTERNAL_ID VARCHAR2(100) := 'Company'; > B_DATE NUMBER := '20100322'; > E_DATE NUMBER := '20110103' ; > > BEGIN > missed_pk.missed_int_day ( > ORG_EXTERNAL_ID, -- IN VARCHAR2, > B_DATE, -- IN NUMBER, -- '20101101' > E_DATE-- IN NUMBER -- '20101201' > ) ; This snippet contains 3 statements, to be executed separately: - two "truncate" statements: pass them to a cursor.execute(), and don't forget to remove the semicolons at the end. - one PL/SQL block (a "END;" is probably missing): you can pass a whole pl/sql block to cursor.execute(), it can look this way: cursor.execute(""" DECLARE .... BEGIN ... END; """) A pl/sql block ends with "END;" (with a semicolon). The trailing '/' that you see in sqlplus scripts should be removed. I've never used it, but cx_OracleTools will certainly handle all this. -- Amaury Forgeot d'Arc |