INSERT SQL Hangs sporadically

Oracle Version:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
OS Version:
Red Hat Enterprise Linux Server release 6.4
When this code runs successfully, it does so in 3-5 minutes:
Set Echo off
Set Head off
Set Space 0
Set Feedback ON
Set Pagesize 0
Set Termout OFF
Set Trimspool On
Set Linesize 200
Set Serveroutput On
set autotrace on
ALTER SESSION SET nls_date_format='yyyymmdd';
spool como.rs_create_kenshoo APPEND
truncate table DFS_DATA_A.WEB_KENSHOO_MDA;
INSERT INTO DFS_DATA_A.WEB_KENSHOO_MDA
select
       ken.ORDER_NUM,
       o.ORDER_DATE,
       o.DIVISION_CODE,
       CONV_DATE,
       CONV_TIME,
       CONV_DATETIME,
       KEYWORD,
       CHANNEL,
       CAMPAIGN,
       AD_GROUP,
       SEARCH_TERM,
       TYPE,
       DURATION,
       REVENUE,
       FILE_DATE,
       TO_DBASE_DATE,
       UPD_DBASE_DATE,
       SITE_ID
  from
      (select * from
        (select
               FILE_DATE,
               ORDER_NUM,
               T_CONV_DATE CONV_DATE,
               T_CONV_TIME CONV_TIME,
               T_CONV_DATETIME CONV_DATETIME,
               KEYWORD,
               CHANNEL,
               CAMPAIGN,
               AD_GROUP,
               SEARCH_TERM,
               TYPE,
               DURATION,
               T_REVENUE REVENUE,
               TO_DBASE_DATE,
               UPD_DBASE_DATE,
               SITE_ID,
               row_number () over (partition by order_num,t_conv_datetime,keyword,channel,campaign,ad_group,t_revenue,site_id order by file_date desc) rnum
          from
               DFS_STAGE.web_kenshoo_history
             ) ken_tmp
        where rnum = 1) ken
     left outer join
       (select order_num,
               order_date,
               division_code
          from orders where order_date >= '20080101'
        ) o
    on ken.order_num = o.order_num
spool off
exit
I am running it right now, and it hangs. I use the following to identify progress:
select
         case when v.piece = 0 then s.sql_exec_start else null end sql_exec_start,
         case when v.piece = 0 then s.osuser else null end osuser,
         case when v.piece = 0 then s.username else null end username,
         case when v.piece = 0 then s.sid else null end sid,
         case when v.piece = 0 then s.serial# else null end serial#,
         v.sql_text
from    gv$session s
          inner join
         gv$process p
          on p.addr = s.paddr
          and p.inst_id = s.inst_id
          left outer join
        sys.v_$sqltext v
          on s.sql_address = v.address
where    case when v.piece is null then 0 else 1 end = 1
        and to_char(sql_exec_start, 'YYYY-MM-DD HH24:MI:SS') < to_char(current_date - (1/24/60/60*1), 'YYYY-MM-DD HH24:MI:SS')
order by s.sql_exec_start,
         sid,
         s.serial#,
         v.piece
accept p_sid prompt 'Enter SID:'
accept p_serial prompt 'Enter Serial#:'
select   l.opname,
         l.target,
         to_char((1 - (l.totalwork - l.sofar) / totalwork) * 100, 9999.99) || '%' pct_complete,
         l.start_time,
         l.last_update_time,
         to_char(l.time_remaining / 60, '999,999,999') min_remain,
         to_char(l.elapsed_seconds / 60, '999,999,999') min_elapsd
from     v$session_longops l
where    l.sid = &p_sid
         and l.serial# = &p_serial
order by l.start_time,
        l.last_update_time
It read the table DFS_STAGE.web_kenshoo_history for about 30 minutes (100% according to my 2nd query), now no longer shows up in v$session_longops. I have verified there are no locks with:
SELECT
s1.username || '@' || s1.machine ||
' ( SID=' || s1.sid || ' )  is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS
blocking_status
FROM v$lock l1, v$session s1, v$lock l2, v$session s2
WHERE
s1.sid=l1.sid and s2.sid=l2.sid
AND l1.BLOCK=1 and l2.request > 0
AND l1.id1 = l2.id1
AND l2.id2 = l2.id2
System load is not too high:
11:28:53 up 22 days,  7:04,  1 user,  load average: 3.00, 3.01, 2.92
Nothing out of the ordinary in the alert.log.
I am stumped. Any suggestions would be appreciated.

Oracle Version:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
OS Version:
Red Hat Enterprise Linux Server release 6.4
When this code runs successfully, it does so in 3-5 minutes:
Set Echo off
Set Head off
Set Space 0
Set Feedback ON
Set Pagesize 0
Set Termout OFF
Set Trimspool On
Set Linesize 200
Set Serveroutput On
set autotrace on
ALTER SESSION SET nls_date_format='yyyymmdd';
spool como.rs_create_kenshoo APPEND
truncate table DFS_DATA_A.WEB_KENSHOO_MDA;
INSERT INTO DFS_DATA_A.WEB_KENSHOO_MDA
select
       ken.ORDER_NUM,
       o.ORDER_DATE,
       o.DIVISION_CODE,
       CONV_DATE,
       CONV_TIME,
       CONV_DATETIME,
       KEYWORD,
       CHANNEL,
       CAMPAIGN,
       AD_GROUP,
       SEARCH_TERM,
       TYPE,
       DURATION,
       REVENUE,
       FILE_DATE,
       TO_DBASE_DATE,
       UPD_DBASE_DATE,
       SITE_ID
  from
      (select * from
        (select
               FILE_DATE,
               ORDER_NUM,
               T_CONV_DATE CONV_DATE,
               T_CONV_TIME CONV_TIME,
               T_CONV_DATETIME CONV_DATETIME,
               KEYWORD,
               CHANNEL,
               CAMPAIGN,
               AD_GROUP,
               SEARCH_TERM,
               TYPE,
               DURATION,
               T_REVENUE REVENUE,
               TO_DBASE_DATE,
               UPD_DBASE_DATE,
               SITE_ID,
               row_number () over (partition by order_num,t_conv_datetime,keyword,channel,campaign,ad_group,t_revenue,site_id order by file_date desc) rnum
          from
               DFS_STAGE.web_kenshoo_history
             ) ken_tmp
        where rnum = 1) ken
     left outer join
       (select order_num,
               order_date,
               division_code
          from orders where order_date >= '20080101'
        ) o
    on ken.order_num = o.order_num
spool off
exit
I am running it right now, and it hangs. I use the following to identify progress:
select
         case when v.piece = 0 then s.sql_exec_start else null end sql_exec_start,
         case when v.piece = 0 then s.osuser else null end osuser,
         case when v.piece = 0 then s.username else null end username,
         case when v.piece = 0 then s.sid else null end sid,
         case when v.piece = 0 then s.serial# else null end serial#,
         v.sql_text
from    gv$session s
          inner join
         gv$process p
          on p.addr = s.paddr
          and p.inst_id = s.inst_id
          left outer join
        sys.v_$sqltext v
          on s.sql_address = v.address
where    case when v.piece is null then 0 else 1 end = 1
        and to_char(sql_exec_start, 'YYYY-MM-DD HH24:MI:SS') < to_char(current_date - (1/24/60/60*1), 'YYYY-MM-DD HH24:MI:SS')
order by s.sql_exec_start,
         sid,
         s.serial#,
         v.piece
accept p_sid prompt 'Enter SID:'
accept p_serial prompt 'Enter Serial#:'
select   l.opname,
         l.target,
         to_char((1 - (l.totalwork - l.sofar) / totalwork) * 100, 9999.99) || '%' pct_complete,
         l.start_time,
         l.last_update_time,
         to_char(l.time_remaining / 60, '999,999,999') min_remain,
         to_char(l.elapsed_seconds / 60, '999,999,999') min_elapsd
from     v$session_longops l
where    l.sid = &p_sid
         and l.serial# = &p_serial
order by l.start_time,
        l.last_update_time
It read the table DFS_STAGE.web_kenshoo_history for about 30 minutes (100% according to my 2nd query), now no longer shows up in v$session_longops. I have verified there are no locks with:
SELECT
s1.username || '@' || s1.machine ||
' ( SID=' || s1.sid || ' )  is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS
blocking_status
FROM v$lock l1, v$session s1, v$lock l2, v$session s2
WHERE
s1.sid=l1.sid and s2.sid=l2.sid
AND l1.BLOCK=1 and l2.request > 0
AND l1.id1 = l2.id1
AND l2.id2 = l2.id2
System load is not too high:
11:28:53 up 22 days,  7:04,  1 user,  load average: 3.00, 3.01, 2.92
Nothing out of the ordinary in the alert.log.
I am stumped. Any suggestions would be appreciated.

Similar Messages

  • Insert SQL does not work properly when called using CALL

    I have a stored procedure (TEST_SP) which is used to insert a record in this perticular case. The SQL statement is 2526 characters long. I'm using
    dim Params : Params=chr(1) & "Insert query" & Chr(1) & "=300"
    runsql=&"{call TEST_SP(?,?)}"&Params 
    dim db : db=dbSelect("",0,"","")
    dbExecSQL db,runsqlto execute the stored procedure. I'm facing an issue when the 2000th character on the insert SQL (pUPDSQL) is a single quote, where the SQL is not getting executed (i.e. record is not getting created).
    The same stored procedure and the same SQL when run as below
    runsql=runsql&"DECLARE "
    runsql=runsql&"PUPDSQL VARCHAR2(4000); "
    runsql=runsql&"PRES VARCHAR2(300); "
    runsql=runsql&"BEGIN "
    runsql=runsql&"PUPDSQL := 'INSERT query..."
    runsql=runsql&"PRES:=300; "
    runsql=runsql&"MRT_LKIDFULUP(PUPDSQL => PUPDSQL,PRES => PRES); "
    runsql=runsql&"END; "
    dim db : db=dbSelect("",0,"","")
    dbExecSQL db,runsqlis working fine. Does anyone know if there is a limitaion in ODBC Call function or any explanation to above behaviour? I'm connecting to a Oracle 11g database using Microsoft ODBC for Oracle driver on Window 7
    The stored procedures:
    create or replace procedure TEST_SP(pUPDSQL IN VARCHAR2,pRES OUT VARCHAR2)
    AS
    BEGIN
    DECLARE
      emsg VARCHAR2(100);
    BEGIN
    if pUPDSQL&lt;&gt;'-1' then
      emsg:='Cant exec UPDATE';
      EXECUTE IMMEDIATE pUPDSQL;
        if SQL%RowCount=0 then
        pRES:='ERR:No row updated';
        return;
      end if;
    end if;
    pRES:='OK:';
    EXCEPTION
      WHEN OTHERS THEN
       pRES:='ERR:' || emsg;
    END;
    END;Edited by: BluShadow on 11-Dec-2012 15:47
    added {noformat}{noformat} tags for readability.  Please read {message:id=9360002} and learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    ... I'm facing an issue when the 2000th character on the insert SQL (pUPDSQL) is a single quote, ...Perhaps you need two single quotes? like:
    runsql=runsql&"PUPDSQL := 'INSERT query...Values(..,..,,,''This value in two single quotes'',..,...)' "
    ... I'm connecting to a Oracle 11g database using Microsoft ODBC ...Dump windoze ODBC and better use the Oracle client ODBC.
    :p

  • JBO-26041: Failed to post data to database during "Insert": SQL Statement "

    Dear All,
    I am trying to insert the data into custom table,getting the following error. Please help me to resolve the issues.
    I have created one custom table in APPS schema having the primary key and History Columns.
    Created the EO based on the custom table and generate the create method.
    Created the VO based on the EO and generated the VOImpl, RowImpl Java Files.
    I am using the PER_PEOPLE_S sequence to populate the value into Primary key column.
    Calling the below code into create method of EO object to populate the value into Primarykey column.
    setPersPersonid(getOADBTransaction().getSequenceValue("PER_PEOPLE_S"));
    oracle.apps.fnd.framework.OAException: oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO XXUTS_PERSON_T(PERS_PERSONID,PERS_FIRSTNAME,PERS_LASTNAME,CREATION_DATE,CREATED_BY,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN) VALUES (?,?,?,?,?,?,?,?)".
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(Unknown Source)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
         at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:72)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.sql.SQLException: ORA-00911: invalid character
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
         at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
         at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
         at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
         at xxuts.oracle.apps.csc.person.server.XXPersonMainAMImpl.savePersonToDatabase(XXPersonMainAMImpl.java:39)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
         at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:72)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    java.sql.SQLException: ORA-00911: invalid character
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
         at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:427)
         at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:5740)
         at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:4539)
         at oracle.apps.fnd.framework.server.OAEntityImpl.postChanges(Unknown Source)
         at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2996)
         at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2807)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1971)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2173)
         at oracle.apps.fnd.framework.server.OADBTransactionImpl.commit(Unknown Source)
         at xxuts.oracle.apps.csc.person.server.XXPersonMainAMImpl.savePersonToDatabase(XXPersonMainAMImpl.java:39)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(Unknown Source)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(Unknown Source)
         at xxuts.oracle.apps.csc.person.webui.XXCreatePersonCO.processFormRequest(XXCreatePersonCO.java:67)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:72)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Thanksm
    Sai Sankilisetty

    Dear Kumar,
    I have checked the datatypes of the table and datatypes of the Pageitems, both the datatypes are same.
    I have created the region using the wizard based on the VO.
    My custom table having only 3 columns and History Columns.Out of 3 columns PersPersonid is Primary key column and I am assigning the sequence value to the column in create method of EO as below
    public void create(AttributeList attributeList) {
    super.create(attributeList);
    setPersPersonid(getOADBTransaction().getSequenceValue("PER_PEOPLE_S"));
    //Here PER_PEOPLE_S is the Sequence
    Thanks,
    Sai

  • Inserting sql scripts in Oracle Warehouse Builder 10g

    Dear all,
    Can anyone please tell me if we can use a process flow to insert scripts in OWB 10g..
    If so, how can i do it??
    I am having a problem to insert sql scripts in OWB 10g r2.
    Infact, i have to write a script and insert it in OWB to populate data from a souce table to a target table.
    I have checked the script in sqlplus and it's working correctly (update being done).
    The problem is that how do i insert the script in OWB?? Can i use a process flow other than OMB PLUS??
    Please help me!!!
    Regards,
    Amrish

    Dear all,
    I have inserted the following script in the sqlplus activity in my process flow.
    INSERT INTO BMADW.TARGET_SALGRADE (GRADE, LOSAL, HISAL) SELECT GRADE, LOSAL, HISAL FROM SCOTT.SALGRADE;
    COMMIT;
    EXIT
    When i run the script in sql*plus, it does the insert and the commit part successfully. I have to press 'ENTER' for SQL*PLUS to exit.
    If i have to end the script, is the word 'EXIT' the right command to use??
    My process flow is deploying successfully but when starting it, still no 'INSERT' has been done. It's taking too much time to run (without giving any error).
    Please help me !!!
    Regards,
    Amrish

  • Running catpatch.sql hangs

    Hi,
    After I applied 9.2.0.8 patch set, I ran catpatch.sql. However, I noticed it hangs. I checked the alert<SID>.log , I see the following interesting line below:
    Completed: ALTER DATABASE OPEN MIGRATE
    Sat Jun 20 00:10:25 2009
    Thread 1 cannot allocate new log, sequence 3805
    All online logs needed archiving
    Current log# 2 seq# 3804 mem# 0: C:\ORACLE\ORADATA\<DB_NAME>\REDO02.LOG
    This is a development server. I've just learned that this server has archive mode on and automatic archiving is disabled. The drive free space is around 5 GB. I'm afraid that if I enable automatic archiving , this might eat up a lot of space although nobody is using it at this time except me.
    Below are the values of parameters related to this hang:
    OPEN_CURSORS = 300
    SHARED_POOL_SIZE = 50331648
    JAVA_POOL_SIZE = 33554432
    JOB_QUEUE_PROCESSES = 0
    SBGA_MAX_SIZE = 157818330
    My question is What could be the cause of catpatch.sql hanging and what can I do to resolve this?
    Edited by: user5470917 on Jun 19, 2009 4:14 PM
    Edited by: user5470917 on Jun 19, 2009 4:18 PM
    Edited by: user5470917 on Jun 19, 2009 4:34 PM

    Yes, you are right nothing prevents me from deleting those archive log files.
    What I did are:
    1. Kill the hanging catpatch.sql session
    2. shutdown
    3. startup
    4. Enable auto archiving using 'alter system set archive_log_start=true'
    5. shutdown
    6. startup migrate
    7. Check auto archive using ' archive log list'
    7. Run catpatch.sql
    8. Run utlrp.sql
    I have successfully ran the catpatch.sql and utlrp.sql
    Thanks.

  • Generate Insert sqls

    Hi All,
    I need to create INSERT sql statements from 20+ tables that contains Static data (e.g. Postal_code).
    Our policy does not allow me to connect to production DB using third party tool like TOAD.
    An alternative would be to use exp/imp; but my plan is to create shell script and include the Insert sql so that it can be deployed to any db.
    Please suggest.
    Thanks in advanced
    Bhupinder

    You can try something like this
    SQL>SELECT * FROM DEPT;
        DEPTNO DNAME          LOC
            50 NewName        NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    SELECT 'INSERT INTO DEPT VALUES('''||DEPTNO||''','''||DNAME||''','''||LOC||''');' from DEPT;
    INSERT_STATEMENT
    INSERT INTO DEPT VALUES('50','NewName','NEW YORK');
    INSERT INTO DEPT VALUES('20','RESEARCH','DALLAS');
    INSERT INTO DEPT VALUES('30','SALES','CHICAGO');
    INSERT INTO DEPT VALUES('40','OPERATIONS','BOSTON');
    Elapsed: 00:00:00.76
    SQL>Regards
    Arun

  • Sql insert is hang/no respond

    hi
    i had writing a simple porgram to insert data into oracle database.
    my code like this
    Connection conn = ..
    Statement stat= ..
    stat.executeUpdate("select sysdate from dual") //this one ok
    but when i running like this
    stat.executeUpdate("insert ...") //this one not ok
    it just hang and no respond.
    my database is oracle 10g, driver version = 10.2.0.4.0
    any idea ?
    regards,
    kiwi

    Are you using username password for System? or any other user? First psosibility is the table was created in read-only mode if you think you have privileges to alter insert delte like that. Next is your insert query is wrong which you have not shown here. for which schema and table name.

  • JDBC batch query with insert sometimes hangs on executeBatch

    We have the following problem:
    Java client sends through JDBC INSERT query using batch,
    and sometimes this query hangs.
    In V$SESSION ACTIVE session appears, which remains ACTIVE forever.
    Also locked object appears in V$LOCKED_OBJECT and open coursor appears.
    How to know what happens inside the query? Why it hangs?
    This is a thread dump for jdbc thread:
    The thread dump is listed below:
    "SdrWriterThread-1" prio=5 tid=0x184264c8 nid=0x214 runnable [18f1f000..18f1fd94]
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at oracle.net.ns.Packet.receive(Unknown Source)
    at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
    at oracle.net.ns.NetInputStream.read(Unknown Source)
    at oracle.net.ns.NetInputStream.read(Unknown Source)
    at oracle.net.ns.NetInputStream.read(Unknown Source)
    at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:718)
    at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:690)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:373)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
    - locked <0x10641b80> (a oracle.jdbc.ttc7.TTC7Protocol)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:2883)
    - locked <0x100900d0> (a oracle.jdbc.driver.OraclePreparedStatement)
    at com.jnetx.xr.persistence.DAO.executeBatch(DAO.java:66)

    Anton,
    Why it hangs?It's waiting for a lock to be released. The default behaviour of Oracle is to wait indefinitely for a lock to be released.
    You can see this behaviour if you try to update the same row from tw different "SQL*Plus" sessions, for example (since the default behaviour of "SQL*Plus" is not to automatically commit changes).
    In one "SQL*Plus" session, update a row -- but do not commit. In the second session, try to update the same row -- it "hangs". It will remain like this until the first session releases the lock. The simplest way to release the lock is for the first session to execute either a "commit" or "rollback". As soon as you do that, you will see the first session become unstuck.
    Of-course, from the [lack of] information you have posted, I cannot tell you what is holding the lock, or why.
    Good Luck,
    Avi.

  • APEX4-How can I see the insert sql apex is creating to insert form into db?

    Hi,
    I've a table with around 78 columns and a form to submit the values. Till around 68 columns it was working fine, when I added another 10 fields and modified names of few other, on clicking Create or Apply it throws duplicate column name error. I've given the exact error below.
    How can I find out which is the duplicate column? or where the problem lies? The form is quite big and complex so I don't want to recreate it.
    Is it possible for me to see the sql apex is generating to insert or update the value?
    When I try to create a new entry, application throws this error:
    ORA-06550: line 1, column 79: PL/SQL: ORA-00957: duplicate column name ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
    On editing an existing entry, application throws error:
    ORA-20505: Error in DML: p_rowid=181, p_alt_rowid=RT_ID, p_rowid2=, p_alt_rowid2=. ORA-00957: duplicate column name
    Thanks for you time.
    Thanks,
    Hozy

    Fixed, I was referring to same column name twice.

  • 9.2.0.7 Catpatch.sql hangs

    Windows 2000
    9.2.0.1
    I've applied the 9.2.0.7 to my db successfully, but when I run catpatch.sql in migrate mode, the system gets to a certain point and hangs. I thought maybe since the db was a 15G db restored from a cold backup that maybe it was a db size issue, but I let it run for well over 30 hours and no dice. If I reboot the server to see if it processed, this is what I get:
    SQL> column comp_id format a15
    SQL> column status format a10
    SQL> column version format a10
    SQL> column comp_name format a35
    SQL> select comp_id, status, version, comp_name from dba_registry order by 1;
    COMP_ID STATUS VERSION COMP_NAME
    AMD INVALID 9.2.0.1.0 OLAP Catalog
    APS LOADED 9.2.0.1.0 OLAP Analytic Workspace
    CATALOG VALID 9.2.0.1.0 Oracle9i Catalog Views
    CATJAVA VALID 9.2.0.1.0 Oracle9i Java Packages
    CATPROC INVALID 9.2.0.1.0 Oracle9i Packages and Types
    CONTEXT VALID 9.2.0.1.0 Oracle Text
    JAVAVM VALID 9.2.0.1.0 JServer JAVA Virtual Machine
    ODM LOADED 9.2.0.1.0 Oracle Data Mining
    ORDIM LOADED 9.2.0.1.0 Oracle interMedia
    OWM VALID 9.2.0.1.0 Oracle Workspace Manager
    SDO LOADED 9.2.0.1.0 Spatial
    COMP_ID STATUS VERSION COMP_NAME
    WK VALID 9.2.0.1.0 Oracle Ultra Search
    XDB INVALID 9.2.0.1.0 Oracle XML Database
    XML VALID 9.2.0.2.0 Oracle XDK for Java
    XOQ LOADED 9.2.0.1.0 Oracle OLAP API
    15 rows selected.
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Disabled
    Archive destination C:\oracle\ora92\RDBMS
    Oldest online log sequence 1984
    Next log sequence to archive 1984
    Current log sequence 1986
    SQL> show parameter shared_pool_size;
    NAME TYPE VALUE
    shared_pool_size big integer 50331648
    SQL> show parameter java_pool_size;
    NAME TYPE VALUE
    java_pool_size big integer 33554432
    SQL> show parameter job_queue_processes;
    NAME TYPE VALUE
    job_queue_processes integer 10
    However, if I create a new empty 9.2.0.1 db, I can patch that to 9.2.0.7 and run catpatch with no problems. I've upgraded before with no issues, so I don't know what the problem is now.
    Thanks!!!

    I don't follow you. Your db was currently in archivelog mode, but not in automatic. Which seems to implies hang issue.
    If your db is not in archivelog mode at all, so, you don't have to put it in archivelog mode.
    Nicolas.

  • A function to insert SQL which creates insert SQL

    I realise this is a bit recursive, but my users are a demanding lot! We want to store in a table the instruction to check if AUDIT_SYS_OPERATIONS is TRUE and to store the result of that check in some sort of an audit table.
    In other words, the basic SQL you'd run directly might be:
    select case when value='TRUE' then 1 else 0 end as passfail
    from v$parameter where upper(name)='AUDIT_SYS_OPERATIONS';But we want to convert this into something which will generate an INSERT statement and which itself can be inserted into a table full of these sorts of audit checks:
    insert into myaudit_checks values ('select ''insert into myaudit_table values (''||case when value=''TRUE'' then 1 else 0 end ||'');'' as passfail
    from v$parameter where upper(name)=''AUDIT_SYS_OPERATIONS'';');I find the rules for doing this to be quite easy:
    1. Add 'insert into myaudit_test values ('|| before the original CASE keyword
    2. Add ||');' before the original 'AS PASSFAIL' keywords
    3. Wrap the whole lot in single quotes
    4. Double up any quotes inside those new ones
    5. Wrap the new statement inside a standard INSERT statement.
    My users don't think that's easy, though. So I thought I'd write them a function which would return the double-quoted insert statement when fed the non-quoted basic select. It works OK, on the whole, except that calling it involves... doubling up the quotes. That is:
    select create_insert_stmt('select case when value=''TRUE'' then 1 else 0 end as passfail
    from v$parameter where upper(name)=''AUDIT_SYS_OPERATIONS'';') from dual;...works OK, but the parameter being passed to the CREATE_INSERT function requires the 'TRUE' and 'AUDIT_SYS_OPERATIONS' strings to be double-single-quoted up-front, which defeats the purpose a bit. I want them to be able to feed the completely original select statement, with single-quoted strings, into the function... but, syntactically, this looks impossible.
    Anyone got any ideas on how to spit out the final 'select 'insert...'' given the original, single-quoted select statement, without requiring too much from my users by way of thought or effort?
    The only thing I thought of was to have them store the original select in a text file and read it via UTL_FILE... but if anyone's got any better ideas, I'd be pleased to hear them.

    >
    Anyone got any ideas on how to spit out the final 'select 'insert...'' given the original, single-quoted select statement, without requiring too much from my users by way of thought or effort?
    >
    For anything that might include quotes use alternative quoting. See Text Literals in the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements003.htm
    >
    In the bottom branch of the syntax:
    •Q or q indicates that the alternative quoting mechanism will be used. This mechanism allows a wide range of delimiters for the text string.
    •The outermost ' ' are two single quotation marks that precede and follow, respectively, the opening and closing quote_delimiter.
    •c is any member of the user's character set. You can include quotation marks (") in the text literal made up of c characters. You can also include the quote_delimiter, as long as it is not immediately followed by a single quotation mark.
    •quote_delimiter is any single- or multibyte character except space, tab, and return. The quote_delimiter can be a single quotation mark. However, if the quote_delimiter appears in the text literal itself, ensure that it is not immediately followed by a single quotation mark.
    If the opening quote_delimiter is one of [, {, <, or (, then the closing quote_delimiter must be the corresponding ], }, >, or ). In all other cases, the opening and closing quote_delimiter must be the same character.
    Here are some valid text literals:
    'Hello'
    'ORACLE.dbs'
    'Jackie''s raincoat'
    '09-MAR-98'
    N'nchar literal'
    Here are some valid text literals using the alternative quoting mechanism:
    q'!name LIKE '%DBMS_%%'!'
    q'<'So,' she said, 'It's finished.'>'
    q'{SELECT * FROM employees WHERE last_name = 'Smith';}'
    nq'ï Ÿ1234 ï'
    q'"name like '['"'
    {quote}

  • Service that uses several insert sql statements

    Hello!  Is it possible to use one service, which updates two DB tables?  Also, one field in these two tables is the same, like the ProcessID? For example, here is the service:
    <tr>
      <td>EUM_WORKFLOW_UPDATE_ACTIONS</td>
      <td>Service
      3
      null
      null
      null<br>
      null</td>
      <td>2:IEumWorkflowActions:::null
            2:IEumWorkflowDocumentProcess:::null</td>-->
    </tr>
    Here are two separate SQL queries called from the above service:
    <tr>
      <td>IEumWorkflowActions</td>
      <td>INSERT INTO EUM_WORKFLOW_ACTIONS(WORKFLOWACTION, WKFLACTIONID) values (?, ?)</td>
      <td>WORKFLOWACTION varchar
      WKFLACTIONID int</td>
    </tr>
    <tr>
      <td>IEumWorkflowDocumentProcess</td>
      <td>INSERT INTO EUM_WORKFLOW_ACTIONS(WKFLACTIONID, DocumentProcessID, dDocName, dRevLabel) values (?, ?, ?, ?)</td>
      <td>WKFLACTIONIDint
      DocumentProcessID int
      dDocName varchar
      dRevLabel varchar</td>
    </tr>
    And here is how I call this service via GenericSoapPort call:  
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body xmlns:ns1="http://www.oracle.com/UCM">
        <ns1:GenericRequest webKey="cs">
          <ns1:Service IdcService="EUM_WORKFLOW_UPDATE_ACTIONS">
            <ns1:User></ns1:User>
            <ns1:Document>
              <ns1:Field name="WORKFLOWACTION">Reject</ns1:Field>
              <ns1:Field name="WKFLACTIONID">123</ns1:Field>
              <ns1:Field name="WKFLACTIONID">123</ns1:Field>
              <ns1:Field name="DocumentProcessID">45234</ns1:Field>
              <ns1:Field name="dDocName">1554322</ns1:Field>
              <ns1:Field name="dRevLabel">1A</ns1:Field>
            </ns1:Document>
          </ns1:Service>
        </ns1:GenericRequest>
      </soap:Body>
    </soap:Envelope>
    Would it be possible NOT to use the WKFLACTIONID twice in the service call somehow?
    Thank you for your help!

    Thank you for the confirmation that this would work.  I've also tried the Insert query like this:
    insert all
    into EUM_WORKFLOW_ACTIONS (WORKFLOWACTION, WKFLACTIONID) values (?, ?)
    into EUM_WORKFLOW_DOCUMENT_PROCESS (WKFLACTIONID, DOCUMENTPROCESSID) values (?, ?)
    select * from dual
    Would this single SQL be better for my purposes then the two statements?  If that would matter at all?
    Thank you!

  • Jdbc insert query hangs

    We have 2 instances of the same program running in parallel. The application inserts data to a database table. one of the instance just hangs when it is trying to insert a query to database i.e. when executing statement.executeUpdate(). We are using a prepared statement to bind all parameter values. Instance 1 keeps running but instance 2 hangs and goes in a waiting state.
    Is there any suggestions on how can this issue be investigated. I know a possible reason for hanging could be database lock, but I cannot understand, how it can have a database lock for insert query.
    oracle : 9.2.0.7
    java : jre 1.4

    user551224,
    Are you running two separate Threads that both use the same database connection?
    This issue has been discussed previously in this forum.
    Search the forum archives for more details.
    It could also be because of a database lock.
    Are you trying to insert rows into the same table?
    You could try using the FOR UPDATE NOWAIT clause to verify.
    Good Luck,
    Avi.

  • Catalog.sql hangs

    I understand that you must run catalog.sql after creating a new database so that data dictionaries are updated otherwise the Oracle Enterprise Manager (OEM) will not be able to view details of the new database.
    So ... I've run catalog.sql but it hangs immediately. While it's hung, I cannot log into SQL*Plus from another session -- that hangs too. A little ivestigation into what catalog.sql does suggests that it is the standard.sql script (run by @@standard) that is hanging and looking into that suggests that stdspec.sql is hanging.
    Any tips on how to determine the cause of the underlying hang? Note that I can log into my database and run SQL queries without any problems; I simply can't use OEM to administer it (which is why I'm running catalog.sql).
    Thanks.

    Thanks Joel. I ran that script but it failed with:
    2 (u.ebytes/a.fbytes)*100 USEDPCT
    ERROR at line 2:
    ORA-00923: FROM keyword not found where expected
    So I changed it slightly to this:
    SQL> select u.tblspc "TBLSPC", a.fbytes "ALLOC", u.ebytes USED, a.fbytes-u.ebytes UNUSED
    2 from (select tablespace_name tblspc, sum(bytes) ebytes
    from sys.dba_extents
    3 4 group by tablespace_name) u,
    5 (select tablespace_name tblspc, sum(bytes) fbytes
    6 from sys.dba_data_files
    7 group by tablespace_name) a
    8 where u.tblspc = a.tblspc
    9 ;
    and that fails (when run as sysdba or as system, both of whom I assume have privileges to select catalog) with:
    from sys.dba_data_files
    ERROR at line 6:
    ORA-00942: table or view does not exist
    I can't help but feel that something may have gone badly wrong with this Oracle installation.
    Would it be a sensible option to drop all databases (by manually removing all their files) and then try to run catalog.sql on an (allegedly) empty system?

  • Constructor behaviour via INSERT SQL

    Interestingly, using an object constructor itself as the insert value seems to have overheads, with the constructor being called multiple times for instantiating the single same object. Cannot recall seeing this documented.
    Here's an example (on 11.2.0.2):
    // the object type with a custom constructor
    SQL> create or replace type TMyRow is object(
      2          id      integer,
      3          day     date,
      4          val     varchar2(10),
      5 
      6          constructor function TMyRow( i integer, d date ) return self as result
      7  );
      8  /
    Type created.
    // implementation of custom constructor - it uses a dynamic SQL to
    // add some "SQL processing noise" for evaluation on how noisy it
    // was after a call
    SQL> create or replace type body TMyRow as
      2          constructor function TMyRow( i integer, d date ) return self as result is
      3          begin
      4                  DBMS_OUTPUT.put_line( 'constructing TMyRow(): id='||i||' day='||d );
      5                  self.id := i;
      6                  self.day := d;
      7                  self.val := 'TMyRow()';
      8 
      9                  execute immediate 'select '||i||' from dual foo where '||i||'='||i;
    10                  return;
    11          end;
    12  end;
    13  /
    Type body created.
    // table based on object type
    SQL> create table mytab of TMyRow(
      2          id primary key,
      3          val default null
      4  ) organization index;
    Table created.
    // not what I expected - the constructor is actually called 3x and
    // not a single time
    SQL> insert into mytab values( TMyRow(1, sysdate) );
    constructing TMyRow(): id=1 day=2012/04/10 10:21:34
    constructing TMyRow(): id=1 day=2012/04/10 10:21:34
    constructing TMyRow(): id=1 day=2012/04/10 10:21:34
    1 row created.
    // from PL/SQL, the constructor is called once only and the
    // insert works without "repeating constructor" calls
    SQL> declare
      2          myRow TMyRow := new TMyRow(2, sysdate);
      3  begin
      4          insert into mytab values myRow;
      5  end;
      6  /
    constructing TMyRow(): id=2 day=2012/04/10 10:21:34
    PL/SQL procedure successfully completed.
    // as an alternative to the above 2 approaches, one can also
    // use a select against DUAL to generate the object to insert -
    // however it also shows 3x constructor executions
    SQL> insert into mytab select TMyRow(3, sysdate) from dual;
    constructing TMyRow(): id=3 day=2012/04/10 10:21:34
    constructing TMyRow(): id=3 day=2012/04/10 10:21:34
    constructing TMyRow(): id=3 day=2012/04/10 10:21:34
    1 row created.
    // the rows in the table (no duplicates of course created)
    SQL> select * from mytab;
            ID DAY                 VAL
             1 2012/04/10 10:21:34 TMyRow()
             2 2012/04/10 10:21:34 TMyRow()
             3 2012/04/10 10:21:34 TMyRow()
    // and here we can see the "noise factor" of the constructor - including
    // that it indeed executed 3x for the same object instantiation
    SQL> select executions, sql_text from v$sqlarea where upper(sql_text) like 'SELECT%FROM DUAL FOO%' order by 2;
    EXECUTIONS SQL_TEXT
             3 select 1 from dual foo where 1=1
             1 select 2 from dual foo where 2=2
             3 select 3 from dual foo where 3=3
             1 select executions, sql_text from v$sqlarea where upper(sql_text) like 'SELECT%FROM DUAL FOO%' order by 2
    // if the DUAL select is unbundled from the above SQL insert, the
    // constructor is only executed once
    SQL> select TMyRow(3, sysdate) from dual;
    TMYROW(3,SYSDATE)(ID, DAY, VAL)
    TMYROW(3, '2012/04/10 10:21:47', 'TMyRow()')
    constructing TMyRow(): id=3 day=2012/04/10 10:21:47Why 3x? The reason seems to be the column count. 3 columns in table (3 properties in object).
    4 properties or columns? Constructor is called 4x. 8 properties or columns? Constructor is called 8x.
    Ugly, and very much an unexpected, overhead. Is this behaviour documented somewhere? (I could not find anything - but then I was also not sure how express this issue as a meaningful search term)

    But it does not occur when calling a PL/SQL function that is not a constructorWith respect yes it does. You did not either explicitly or implicitly reference the result of that function multiple times. Try with a PL/SQL function that returns and object type with multiple attributes...
    SQL> CREATE OR REPLACE FUNCTION f_tmyrow (i INTEGER, d DATE)
      2     RETURN tmyrow
      3  AS
      4     rtn tmyrow;
      5  BEGIN
      6     DBMS_OUTPUT.put_line ('returning TMyRow(): id=' || i || ' day=' || d);
      7     RETURN tmyrow (i, d, 'TMyRow()');
      8  END f_tmyrow;
      9  /
    SQL> INSERT INTO mytab VALUES (f_tmyrow (1, SYSDATE));
    returning TMyRow(): id=1 day=10-APR-12
    returning TMyRow(): id=1 day=10-APR-12
    returning TMyRow(): id=1 day=10-APR-12
    1 row created.
    SQL> CREATE OR REPLACE FUNCTION f_tmyrow (i INTEGER, d DATE)
      2     RETURN tmyrow DETERMINISTIC
      3  AS
      4     rtn tmyrow;
      5  BEGIN
      6     DBMS_OUTPUT.put_line ('returning TMyRow(): id=' || i || ' day=' || d);
      7     RETURN tmyrow (i, d, 'TMyRow()');
      8  END f_tmyrow;
      9  /
    Function created.
    SQL> INSERT INTO mytab VALUES (f_tmyrow (1, SYSDATE));
    returning TMyRow(): id=1 day=10-APR-12
    1 row created.
    SQL>Which also rather interestingly shows that the DETERMINISTIC keyword is observed in SQL (in a within-row context) other than as a requirement for function-based indexes, something which I don't recall noticing before.
    When we create a straightforward table of object type (ignoring the matter of substitutable subtypes for the moment) rather than create a single representation of the object Oracle actually creates a relational table with a column for each attribute.
    Hence my educated guess would be that an SQL of the form...
    INSERT INTO mytab
       SELECT tmyrow (1, SYSDATE)
       FROM   DUAL;...would need to be silently re-written (or at this would be one way of implementing this) to accomodate the above, something like...
    INSERT INTO mytab (id, day, val)
       SELECT tmyrow (1, SYSDATE).id,
              tmyrow (1, SYSDATE).day,
              tmyrow (1, SYSDATE).val
       FROM   DUAL d;Note that this is behaviour is similar whether the function being called is a type constructor function, other type method or standalone/packaged PL/SQL function returning object type.
    At which point we are tempted to write the above (or question why Oracle does not) to avoid this rather obvious inefficiency.
    SELECT d.t.id, d.t.day, d.t.val
       FROM  (SELECT tmyrow (1, SYSDATE) t
              FROM   DUAL) d;Those who have worked with PL/SQL functions in SQL will not be surprised that we do not succeed. Looking at the projection column from explain plan for COUNT (id), COUNT (day), COUNT (val) of this SELECT (the plain SELECT does not yield a value in the projection column), we see we once again have three calls to the function.
    COUNT(SYS_OP_ATG("TMYROW"."TMYROW"(1,SYSDATE@!),3,4,2))[22], COUNT(SYS_OP_ATG("TMYROW"."TMYROW"(1,SYSDATE@!),2,3,2))[22], COUNT(SYS_OP_ATG("TMYROW"."TMYROW"(1,SYSDATE@!),1,2,2))[22]If we go a step further and prevent the above view from being merged it forces our projection to be what we want, and we can see from debug that the function is now executed once only.
    "ID"[NUMBER,22], "DAY"[DATE,7], "VAL"[VARCHAR2,10]This is all of course identical to how PL/SQL functions behave when queried through in-line views, hence my approach in the previous thread of tuning this as per a normal PL/SQL function call.
    What I am unable to explain from the above is that there is an obvious counter-case.
    SQL> INSERT INTO mytab (id, day, val)
      2     SELECT d.t.id, d.t.day, d.t.val
      3     FROM   (SELECT tmyrow (1, SYSDATE) t
      4             FROM   DUAL) d;
    constructing TMyRow(): id=1 day=10-APR-12
    1 row created.
    SQL> From what we have seen I would expect this view to be merged and the function to be called three times, as it is with the standalone SQL...
    SQL> SELECT d.t.id, d.t.day, d.t.val
      2  FROM   (SELECT tmyrow (1, SYSDATE) t
      3          FROM   DUAL) d;
          T.ID T.DAY     T.VAL
             1 10-APR-12 TMyRow()
    SQL> exec null;
    constructing TMyRow(): id=1 day=10-APR-12
    constructing TMyRow(): id=1 day=10-APR-12
    constructing TMyRow(): id=1 day=10-APR-12
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • How do you reset a password for an email account that I don't have anymore?

    My email address for my original i-pod is not in use anymore and I can't get it back. I can't remember the secret question and having them send a temporary password to the old email address is useless. I have the music from my i-pod in my i-tunes lib

  • Cookies appearing even when set to "Never"

    Hi, Ever since the new Safari update, I constantly get cookies from Google, even though I have NEVER set in preferences under "accept cookies". This happens many times during the day, and I am constantly deleting it, but soon after it's there again.

  • Time schedule in two languages

    We are not able to create a time schedule in English and Russian. We created a user defined field to enter the russian description of the acitivity but this does not work for summary levels. For one print only one language is necessary so we wanted t

  • OIM 11g installation : Create Oracle Internet Directory Failed

    Hi, everyone, I have try to install OIM 11g for many times , but also error happened.... I did like follow: 1, install OS, window 2008 R2 64bit.(I have install oracle database 11g on another machine.) 2, install weblogic 10.3.3 (without config domain

  • 101 Problems with my iPod Touch and iTunes...Almost

    It really feels like I have 101 problems with my iPod touch and iTunes. For some time now my iPod Touch have been using alot of batterypower and the battery is often discharged very fast. It discharges alot faster now than when I brought the Touch. A