BJCooperIT
Programmer
I am writing PL/SQL scripts with dynamic SQL for a data conversion project. While testing, I exceeded the maximum number of open cursors. I was only loading 1415 rows and the max parameter is currently set to 650 (Oracle 8.0.5 database). I e-mailed the support DBAs and asked to have the maximum increased. They, in turn, have e-mailed me back (with a hint of attitude) demanding to know why I need it increased. This leads me to two sets of questions.
1. What is the impact of increasing the parameter to a larger number or to the max? Does it require more disk space? More memory? Why would they object to the increase?
2. I wrote a function to ease my code for executing dynamic sql as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create or replace
function F_EXECUTE_SQL (P_SQL in varchar2) return varchar2
is
/*============================*/
/* Execute an SQL text string */
/*============================*/
C_SUCCESS varchar2(10) := 'SUCCESS';
C_FAILURE varchar2(10) := 'FAILURE';
V_CURSOR_ID integer;
V_ROWS integer;
begin
/*==============================================*/
/* Open a cursor workarea - returns a cursor ID */
/*==============================================*/
V_CURSOR_ID := dbms_sql.open_cursor;
/*================================*/
/* Parse the statement for errors */
/*================================*/
dbms_sql.parse(V_CURSOR_ID, P_SQL, dbms_sql.native);
/*=======================*/
/* Execute the statement */
/*=======================*/
V_ROWS := dbms_sql.execute(V_CURSOR_ID);
/*==================*/
/* Close the cursor */
/*==================*/
dbms_sql.close_cursor(V_CURSOR_ID);
return(C_SUCCESS);
exception
when NO_DATA_FOUND then return(C_FAILURE);
when OTHERS then return(C_FAILURE);
end;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I am puzzled as to why I am exceeding the max. I call this function to drop a table, create a table, and create an index. I then use UTL_FILE to read my flat file and each row insert makes a call to this function. Does this leave a cursor open each time it is executed even though I explicitly close it? Would the result be different if I were in 8.1.7 using EXECUTE IMMEDIATE?
Thanks in advance for your help and insight.
(select * from life where brain is not null)
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
1. What is the impact of increasing the parameter to a larger number or to the max? Does it require more disk space? More memory? Why would they object to the increase?
2. I wrote a function to ease my code for executing dynamic sql as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create or replace
function F_EXECUTE_SQL (P_SQL in varchar2) return varchar2
is
/*============================*/
/* Execute an SQL text string */
/*============================*/
C_SUCCESS varchar2(10) := 'SUCCESS';
C_FAILURE varchar2(10) := 'FAILURE';
V_CURSOR_ID integer;
V_ROWS integer;
begin
/*==============================================*/
/* Open a cursor workarea - returns a cursor ID */
/*==============================================*/
V_CURSOR_ID := dbms_sql.open_cursor;
/*================================*/
/* Parse the statement for errors */
/*================================*/
dbms_sql.parse(V_CURSOR_ID, P_SQL, dbms_sql.native);
/*=======================*/
/* Execute the statement */
/*=======================*/
V_ROWS := dbms_sql.execute(V_CURSOR_ID);
/*==================*/
/* Close the cursor */
/*==================*/
dbms_sql.close_cursor(V_CURSOR_ID);
return(C_SUCCESS);
exception
when NO_DATA_FOUND then return(C_FAILURE);
when OTHERS then return(C_FAILURE);
end;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I am puzzled as to why I am exceeding the max. I call this function to drop a table, create a table, and create an index. I then use UTL_FILE to read my flat file and each row insert makes a call to this function. Does this leave a cursor open each time it is executed even though I explicitly close it? Would the result be different if I were in 8.1.7 using EXECUTE IMMEDIATE?
Thanks in advance for your help and insight.
(select * from life where brain is not null)
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000