Lock + Insert..

Hi,
I have a job in my Oracle Forms 10g/ Oracle DB 10g application that runs every minute to identify if there is a Blocking Lock in the database.
I have been getting an INSERT statement as the cause of the blocking lock every day! How can an insert statement create a blocking?
I have not used LOCK TABLE tab1 IN EXCLUSIVE MODE;
The query I use in my job to get the Blocking SQL text is:
SELECT vs.SID, vs.username, vs.logon_time, vs.machine, vs.sql_hash_value,
vsql.piece, vsql.sql_text, vs.prev_hash_value
FROM v$session vs, v$sqltext vsql
WHERE SID IN (SELECT LPAD (' ', DECODE (vl.request, 0, 0, 1)) || SID
FROM v$lock vl
WHERE id1 IN (SELECT id1
FROM v$lock vl2
WHERE vl2.lmode = 0))
AND vs.sql_hash_value = vsql.hash_value
ORDER BY 2, 5, 6;
Please advice
Warm Regards
Sajan

DROP TABLE T1;
CREATE TABLE T1 (C1 NUMBER PRIMARY KEY);
-- Session 1:
INSERT INTO T1 VALUES (0);
-- Session 2:
INSERT INTO T1 VALUES (0);
-- The statement "hangs"
-- Session 3 (SYSTEM)
SELECT vs.SID, vs.username, vs.logon_time, vs.machine, vs.sql_hash_value,
     vsql.piece, vsql.sql_text, vs.prev_hash_value
     FROM v$session vs, v$sqltext vsql
     WHERE SID IN (SELECT LPAD (' ', DECODE (vl.request, 0, 0, 1)) || SID
     FROM v$lock vl
     WHERE id1 IN (SELECT id1
     FROM v$lock vl2
     WHERE vl2.lmode = 0))
     AND vs.sql_hash_value = vsql.hash_value
     ORDER BY 2, 5, 6;
SID USERNAME   LOGON_TIME          ..  SQL_TEXT                    
51 <......>   23.08.2006 13:15:50 ..  INSERT INTO T1 VALUES (0)
and
SELECT
           (SELECT USERNAME FROM V$SESSION WHERE SID = A.SID) Blocker
          ,A.SID
          ,' is blocking '
          ,(SELECT USERNAME FROM V$SESSION WHERE SID = B.SID) Blockee
          ,B.SID
     FROM V$LOCK A, V$LOCK B
     WHERE A.BLOCK = 1
          AND B.REQUEST > 1
          AND A.ID1 = B.ID1
          AND A.ID2 = B.ID2
BLOCKER               SID 'ISBLOCKING'  BLOCKEE               SID
<......>               31  is blocking  <......>                51

Similar Messages

  • Lock Insertion of new position in a Sales Order

    Hi guru!
    I've to lock the insertion of new position in a Sales Order from VA02 transaction, users can update only some fields of existing positions but thay can't insert a new position in order.
    I have to lock the blank position in a position's table control so they can't insert data for a new position.
    Is it possible to do?
    Thanks!!

    If you're talking about "new POSNR" (item), you could change the visibility of the insertion button, any menu drop downs, probably with user exit or (perhaps better) with screen variants (transaction SHD0) for transcode VA02....perhaps a combination of the two would get you the results you need.

  • Security locking insert ,update and delete

    Hi all,
    for security purpose i want a user to enter a form and not allow to him to insert or update or delete any data,
    i tried personalize form and set the update and insert and delete ALLOWED property to false in the trigger (WHEN-NEW-FORM-INSTANCE) it work but it generate severeal message to the user (FRM-41050: You cannot update this record) is there any way to do this issue or any modification to what i did??
    any advice will be approtiated.

    UPDATE emp_dept
    SET loc = 'BOSTON'
    WHERE ename = 'SMITH';But that doesn't make sense. You cannot just LOC for SMITH, because LOC is not an attribute of EMP. If you change the LOC in the view then you must change it for all employees in DEPT 30 (or whatever).
    The key preserved thing is merely about maintaining your data integrity.
    I rather not use Instead Of Trigger because it take a lot of PL/SQL code :(The problem is, your business rule is not clear. Are you wanting to change the LOC for the DEPT record which is the DEPTNO to which SMITH belongs? Or are you wanting to change SMITH's DEPTNO to be the one for the BOSTON office?
    Cheers, APC

  • PUK Locked insert SIM with no PIN lock to activate ipad

    please invistage to me this matter

    PUK locks are controlled by wireless carriers. Contact the source of the
    sim to get the PUK or change the sim. Unless the iPad was purchased
    as subsidized and therefore locked to a wireless provider, the iPad
    should not be locked.

  • Insert a vaild SIM with no PIN lock to activate iPAD

    PUK Locked 
    Insert a valid SIM with no PIN lock to active iPAD
    Unlock

    Your post is rather difficult to decipher. Please state a complete question so that we understand what it is you wish assistance with. Meanwhile, perhaps this will help:
    http://support.apple.com/kb/HT1316
    Regards.

  • How to insert image into table and to in Oracle 9i intermedia?

    Mr Lawrence,
    I want to ask something:
    I use Oracle 9i intermedia
    If i use this script:
    CREATE TABLE images (
    file_name VARCHAR2(100) NOT NULL,
    image ORDSYS.OrdImage
    then
    CREATE OR REPLACE DIRECTORY imgdir AS 'd:/data';
    then
    INSERT INTO images (file_name, image)
    VALUES ('tree', ORDSYS.ORDImage.init('file','imgdir','tree.jpg' ));
    I put tree.jpg in directory d:/data in my hard drive.
    Is my tree.jpg file had already get in to my images table?
    I'm little confuse, because when i check my table with this script:
    select file_name, i.image.getWidth() from images i;
    it's show that my i.image.getWidth() for file_name tree is empty.. that mean my tree.jpg doesn't get in to my table.. am i correct?
    N also i want to ask how to display to screen all of my image from images table?
    Is it posible Oracle 9i intermedia to support display image from table?
    How?
    thanks Mr Lawrence

    -- First step would be to create a directory in oracle and map it to the folder where your image resides.
    create directory image_dir as *'c:\image_dir';*
    Then you would have to use a procedure to insert the image in your table. SO first create a table to hold the image. Note that you have to use a BLOB to insert the image.
    CREATE TABLE test_image
    ID NUMBER,
    image_filename VARCHAR2(50),
    image BLOB
    Now let's write the procedure to insert the image in the table above.
    CREATE OR REPLACE PROCEDURE insert_image_file (p_id NUMBER, p_image_name IN VARCHAR2)
    IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := BFILENAME ('image_DIR', p_image_name);
    -- insert a NULL record to lock
    INSERT INTO temp_image
    (ID, image_name, image
    VALUES (p_id, p_image_name, EMPTY_BLOB ()
    RETURNING image
    INTO dst_file;
    -- lock record
    SELECT image
    INTO dst_file
    FROM temp_image
    WHERE ID = p_id AND image_name = p_image_name
    FOR UPDATE;
    -- open the file
    DBMS_LOB.fileopen (src_file, DBMS_LOB.file_readonly);
    -- determine length
    lgh_file := DBMS_LOB.getlength (src_file);
    -- read the file
    DBMS_LOB.loadfromfile (dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE temp_image
    SET image = dst_file
    WHERE ID = p_id AND image_name = p_image_name;
    -- close file
    DBMS_LOB.fileclose (src_file);
    END insert_image_file;
    Now execute the procedure to insert the image.
    EXECUTE insert_image_file(1,'test_image.jpg');
    Thanks,
    Aparna

  • Restful service unable to insert data using PL/SQL.

    Hi all,
    Am running: AL 2.01 standalone mode on OEL 4.8 in VM box A.
    Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.
    Able to performed oracle.example.hr Restful services with no problem.
    Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
    which uses the following table (under schema: scott):
    create table json_demo ( title varchar2(20), description varchar2(1000) );
    grant all on json_demo to apex_public_user; and below procedure ( scott's schema ):
    CREATE OR REPLACE
    PROCEDURE post(
        p_url     IN VARCHAR2,
        p_message IN VARCHAR2,
        p_response OUT VARCHAR2)
    IS
      l_end_loop BOOLEAN := false;
      l_http_req utl_http.req;
      l_http_resp utl_http.resp;
      l_buffer CLOB;
      l_data       VARCHAR2(20000); 
      C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
    BEGIN
      -- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
      -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
      -- rather than just returning the text of the error page.
      utl_http.set_response_error_check(false);
      -- Begin the post request
      l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
      -- Set the HTTP request headers
      utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
      utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
      utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
      -- Write the data to the body of the HTTP request
      utl_http.write_text(l_http_req, p_message);
      -- Process the request and get the response.
      l_http_resp := utl_http.get_response (l_http_req);
      dbms_output.put_line ('status code: ' || l_http_resp.status_code);
      dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
      LOOP
        EXIT
      WHEN l_end_loop;
        BEGIN
          utl_http.read_line(l_http_resp, l_buffer, true);
          IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
            l_data    := l_data||l_buffer;
          END IF;
        EXCEPTION
        WHEN utl_http.end_of_body THEN
          l_end_loop := true;
        END;
      END LOOP;
      dbms_output.put_line(l_data);
      p_response:= l_data;
      -- Look for client-side error and report it.
      IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
        dbms_output.put_line('Check the URL.');
        utl_http.end_response(l_http_resp);
        -- Look for server-side error and report it.
      elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
        dbms_output.put_line('Check if the Web site is up.');
        utl_http.end_response(l_http_resp);
        RETURN;
      END IF;
      utl_http.end_response (l_http_resp);
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line (sqlerrm);
      raise;
    END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585/apex/demo';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    anonymous block completed
    status code: 200
    reason phrase: OK
    with data inserted. Setup using 2.0.1
       Workspace : wsdemo
    RESTful Service Module:  demo/
              URI Template:      test
                    Method:  POST
               Source Type:  PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585//apex/wsdemo/demo/test';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    status code: 500
    reason phrase: Internal Server Error
    Listener's log:
    Request Path passes syntax validation
    Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
    Applied database connection info
    Attempting to process with PL/SQL Gateway
    Not processed as PL/SQL Gateway request
    Attempting to process as a RESTful Service
    demo/test matches: demo/test score: 0
    Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
    Determining if request can be dispatched as a Tenanted RESTful Service
    Request path has one path segment, continuing processing
    Tenant Principal already established, cannot dispatch
    Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
    demo/test is a public resource
    Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
    Performing JDBC request as: SCOTT
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: Error occurred during execution of: [CALL, begin
    insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
    end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
    java.sql.SQLException: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
            at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
            at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
            at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
            at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
            at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
            at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
            at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
            at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
            at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
            at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
            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:597)
            at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
            at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
            at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
            at $Proxy46.execute(Unknown Source)
            at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
            at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
            at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
            at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
            at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
            at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
            at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
            at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
            at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
            at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
            at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
            at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
            at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
            at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
            at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
            at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
            at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
            at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
            at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
            at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
            at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
            at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
            at java.lang.Thread.run(Thread.java:662)
    Error during evaluation of resource template: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-idPlease advise.
    Regards
    Zack

    Zack.L wrote:
    Hi Andy,
    Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
    Source
    begin
    insert into scott.json_demo values(:title,:description);
    end;
    it's failing during the insert?
    Yes, it failed during insert using AL2.0.1.
    So the above statement produces the following error message:
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem.

  • Errors with post-insert trigger

    I had a POST-INSERT TRIGGER here.but i encountered some problems.can someone help me with the errors?
    begin
         insert into user_acct
         userid_n, user_m, coy_c, contact_n, emp_n,
         work_loc_c, curr_passwd_t, prt_f, indv_pc_f, pc_deploy_c,      
         ext_email_addr_t, other_na_sys_t, status_c, status_rmk_t, upd_d)
         values
         (:user_acct.userid_n, :user_acct.user_m, :user_acct.coy_c, :user_acct.contact_n, :user_acct.emp_n,
         :user_acct.work_loc_c, :user_acct.curr_passwd_t, :user_acct.prt_f, :user_acct.indv_pc_f, :user_acct.pc_deploy_c,                
         :user_acct.ext_email_addr_t, :user_acct.other_na_sys_t, :user_acct.status_c, :user_acct.status_rmk_t,                
         :user_acct.upd_d);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Applicant Particulars failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
    begin
    insert into user_acct_na_detl
         na_sys_c)
         values
         (:na_sys_cd.na_sys_c);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Non-Application failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
              when others then
                   null;      
    end;     
    the error:
    Error 103 at line 31, column 3
    Encountered the symbol 'WHEN' when expecting one if the following:
    begin declare end exception exit for goto if loop mod null
    pragma raise return select update while <an identifier>
    <a double-quoted delimited-identifier><a bind variable><<
    close current delete fetch lock insert open rollback
    savepoint set sql commit<a single-quoted SQL string>
    The symbol "exception"was substituted for "WHEN" to continue
    Error 103 at line 2, column 1
    Encountered the symbol "END"

    i delete the "END" already but when i compile again, i encountered some error again.
    Error 370 at line 27, column
    OTHERS handler must be last among the exception handlers of a block
    Error 0 at line 1, column 1
    Statement ignored

  • Insert into table a (select * from table b) - need pk?

    Hi there.
    I'm going to insert into table FINAL (select * from table STAGING) - same structure but in STAGING the ID column has nulls.
    Do I need to provide the ID (primary key) for table FINAL or will it get created based on sequence/trigger?
    If I were doing this in a loop I'd get the next val from the sequence but on a simple insert, I'm curious.
    thanks!

    hmm.. what is ?
    it didn't like it.
    Error(11,4): PLS-00103: Encountered the symbol "[" when expecting one of the following:     begin case declare exit for goto if loop mod null pragma    raise return select update while with <an identifier>    <a double-quoted delimited-identifier> <a bind variable> <<    close current delete fetch lock insert open rollback    savepoint set sql execute commit forall merge    <a single-quoted SQL string> pipe
    9i, sqldeveloper                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Insert via DB-LINK

    Hi, i'm trying to insert via dblink data selected from local table. Here is the code:
    create or replace type T_DATA_IDS as table of number(19);
    export_process_ids t_data_ids;And here is the query:
        insert into process@archive
          (select * from process where process_id in
            (select * from table(export_process_ids)));And it throws
    ORA-22804: remote operations not permitted on object tables or user-defined type columns
    When i change '(select * from table(export_process_ids))' to some id's from that table data is inserted without errors.
    How can i work around that error?
    Edited by: 843706 on 2011-03-11 05:58

    843706 wrote:
    I tried
    create table temp2 as (select * from table(export_process_ids));But now i have error:
    Error(90,3): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:    
    begin case declare end exception exit for goto if loop mod    null pragma raise return select update while
    with    <an identifier> <a double-quoted delimited-identifier>    <a bind variable> << close current
    delete fetch lock insert    open rollback savepoint set sql execute commit forall merge    pipe So is it possible to use DDL in PL/SQL?You'r doing this within a plsql block, right?
    You need the following:
    begin
      execute immediate 'create table temp2 as (select * from table(export_process_ids))';
    end>
    [...] but with every iteration it executes one select query ((select * from process where process_id in my_rows.NOT_SURE_WHAT_THIS_NAME_IS) )) which i'd like to avoid.No. For inserts FORALL creates a bulk statement. Only for updates FORALL creates individual statements:
    CREATE OR REPLACE TYPE my_collection IS VARRAY (256) OF NUMBER;
    CREATE TABLE test_bulk (   test_id    NUMBER , id_test_1  NUMBER , id_test_2  NUMBER );
    CREATE OR REPLACE TRIGGER test_asi AFTER INSERT ON TEST_BULK  REFERENCING NEW AS NEW OLD AS Old DECLARE BEGIN  DBMS_OUTPUT.PUT_LINE('expensive action'); END;
    DECLARE
      my_collection_test  my_collection;
    BEGIN
          SELECT LEVEL
            BULK COLLECT INTO my_collection_test
            FROM DUAL
      CONNECT BY LEVEL < 15;
      DBMS_OUTPUT.PUT_LINE('forall');
    FORALL i IN 1..my_collection_test.COUNT
               INSERT INTO test_bulk(id_test_1,id_test_2) VALUES (1,my_collection_test(i));
      DBMS_OUTPUT.PUT_LINE('simple loop');
       FOR i IN 1..my_collection_test.COUNT LOOP
               INSERT INTO test_bulk(id_test_1,id_test_2) VALUES (1,my_collection_test(i));
       END LOOP;
    END;
    DROP TABLE test_bulk;
    DROP TYPE my_collection;returns:forall
    expensive action
    simple loop
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action
    expensive action

  • I was on my Iphone 4 and i updated it and then it said that the sim was locked how do i unlock it?

    i was on my Iphone 4 and i updated it and then it said that the sim was locked how do i unlock it?
    i upgraded it to the newest update and it came up sim locked enter three digit number to activate and then on the internet it said to restore it so i did that and now it says Sim locked insert a valid sim with no pin to activate :/

    The ONLY place that can unlock a locked iphone is the carrier to which it is locked ( if they offer this service).
    It sounds as if you may have a hacked/unofficially unlocked iphone and it locked back to the carrier when updated ( as it should if it is hacked).

  • Insert/Update table via DBLink

    I have a situation where the table that I want users to be able to maintain is owned by a different schema on a different database.
    TABLE1 is owned by SCHEMA1 on DB1
    select,insert,update,delete is granted to SCHEMA2 on DB1
    DBLINK is a DBLink from SCHEMA3 on DB2 to SCHEMA2 on DB1
    HTMLDB is running on SCHEMA3 on DB2
    This setup is necessary because SCHEMA1 is the main data repository, SCHEMA2 has limited access to SCHEMA1 for security reasons, and SCHEMA3 is where HTMLDB is installed
    i.e.
    SCHEMA3@DB2 --> SCHEMA2@DB1 --> SCHEMA1.TABLE1@DB1
    Whenever I try to use the wizards to create a standard Report/Form combo it fails when selecting the table for the Form - table TABLE1 is not in the select list because it's not owned by the schema assigned to the workspace.
    So I created a temporary copy of the table in SCHEMA3 and used the wizard to create the Report/Form combo. This works fine.
    I then dropped the table from SCHEMA3 and created a synonym pointing to SCHEMA1.TABLE1@DBLINK
    The report still works fine but the Automated Row Fetch fails with the error
    "ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored
    I presume this is because it's specifically looking for a table owned by SCHEMA3 when in fact it's a synonym.
    Is there any way around this without recoding all the optimistic locking, insert, update and delete code?

    Doh! After all that I answered my own question ... it's really simple.
    Create a view in SCHEMA3 pointing to the table in SCHEMA1 and create the Report/Form based on the view
    e.g. CREATE VIEW table1 AS SELECT * FROM schema1.table1@dblink;
    (Where's the Delete Post option when you need it?! ;)

  • Can't get inserts to work

    Im trying to insert values into a table and keep coming up with errors not sure how to fix the error. I wrote a procedure which complies correctly but does not execute properly.
    any help would be great below is the code:
    create or replace procedure basket_add_sp
    (p_baskid out number, p_prodid out number,
    p_price out number, p_qua out number,
    p_sizecode out number, p_formcode out number)
    IS
    CURSOR cur_bask is
    SELECT idproduct, price, quantity, idbasket, option1, option2
    INTO p_prodid, p_price, p_qua, p_baskid, p_sizecode, p_formcode
    FROM bb_basketitem
    WHERE idbasket = p_baskid;
    BEGIN
    FOR rec_bask IN cur_bask loop
    IF rec_bask.idbasket = 14 THEN
    INSERT into bb_basketitem (idproduct, price, quantity, idbasket, option1, option2)
    VALUES (14, 8, 10.80, 1, 2, 4);
    p_baskid := 14;
    p_prodid := 8;
    p_price := 10.80;
    p_qua := 1;
    p_sizecode := 2;
    p_formcode := 4;
    END IF;
    END LOOP;
    END;
    SQL> execute basket_add_sp(p_baskid, p_prodid, p_price, p_qua, p_sizecode, p_formcode);
    BEGIN basket_add_sp(p_baskid, p_prodid, p_price, p_qua, p_sizecode, p_formcode); END;
    ERROR at line 1:
    ORA-06550: line 1, column 21:
    PLS-00201: identifier 'P_BASKID' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    revised code from another user in the class...
    This code does not seem to work either.l What could be the problem with this revision.
    create or replace procedure basket_add_sp
    (p_baskid in out number, p_prodid in out number,
    p_price in out number, p_qua in out number,
    p_sizecode in out number, p_formcode in out number)
    IS
    BEGIN
    SELECT idproduct, price, quantity, idbasket, option1, option2
    INTO p_prodid, p_price, p_qua, p_baskid, p_sizecode, p_formcode
    FROM bb_basketitem
    WHERE idbasket = p_baskid;
    INSERT into bb_basketitem (idproduct, price, quantity, idbasket, option1, option2)
    VALUES (p_prodid, p_price, p_qua, p_baskid, p_sizecode, p_formcode);
    VALUES (bb_idbasketitem_seq.nextval,p_price, p_qua, p_baskid, p_sizecode, p_formcode);
    END;
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE BASKET_ADD_SP:
    LINE/COL ERROR
    13/1 PLS-00103: Encountered the symbol "VALUES" when expecting one of
    the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    <a single-quoted SQL string> pipe
    <an alternatively-quoted SQL string>
    The symbol "case was inserted before "VALUES" to conti
    LINE/COL ERROR
    13/86 PLS-00103: Encountered the symbol ";" when expecting one of the
    following:
    * & = - + < / > at in is mod remainder not rem when
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between overlaps || multiset year DAY_ member SUBMULTISET_

  • Unable to drop table

    Hello,
    I'm currently tring to drop a table using a process trigered by a button click
    Icreated my button and also a "PL/SQL process" and I put
    DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    inside field "source" with ticking the checkbox "Do not validate PL/SQL code (parse PL/SQL code at runtime only)."
    But when a click on the button I have the following error
    ORA-06550: line 1, column 7: PLS-00103: Encountered the symbol "DROP" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
         Error      Error while dropping table
    OK      
    Do anyone have a clue about this ?
    Debug trace is
    A C C E P T: Request="Purge"
    0.00: Metadata: Fetch application definition and shortcuts
    0.00: alter session set nls_language="AMERICAN"
    0.00: alter session set nls_territory="AMERICA"
    0.00: ...NLS: Set Decimal separator="."
    0.00: ...NLS: Set NLS Group separator=","
    0.00: ...NLS: Set date format="DD-MON-RR"
    0.00: ...Setting session time_zone to +02:00
    0.00: NLS: wwv_flow.g_flow_language_derived_from=0: wwv_flow.g_browser_language=en-us
    0.00: Fetch session state from database
    0.01: ...Check session 2289784661666743 owner
    0.01: ...Check for session expiration:
    0.01: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.01: Session: Fetch session header information
    0.01: ...Metadata: Fetch page attributes for application 121, page 2
    0.01: ...Validate item page affinity.
    0.03: ...Validate hidden_protected items.
    0.03: ...Check authorization security schemes
    0.03: Session State: Save form items and p_arg_values
    0.03: ...Session State: Save "P0_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TABLE_NAME" - saving same value: "STATPHI_595730051"
    0.04: ...Session State: Save "P2_TYPE" - saving same value: "2"
    0.04: ...Session State: Save "P2_CALENDAR" - saving same value: "PA"
    0.04: ...Session State: Save "P2_FILE_NAME" - saving same value: ""
    0.04: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.04: Branch point: BEFORE_COMPUTATION
    0.04: Computation point: AFTER_SUBMIT
    0.04: Tabs: Perform Branching for Tab Requests
    0.04: Branch point: BEFORE_VALIDATION
    0.04: Perform validations:
    0.04: Branch point: BEFORE_PROCESSING
    0.04: Processing point: AFTER_SUBMIT
    0.04: Item button "P2_PURGE_TABLE" pressed process.
    0.04: ...Process "DROP TABLE": PLSQL (AFTER_SUBMIT) DROP TABLE &P0_TABLE_NAME. CASCADE CONSTRAINTS;
    0.06: Encountered unhandled exception in process type PLSQL
    0.06: Show ERROR page...
    0.06: Performing rollback...
    ----

    Hi user631592 ;-)
    You can't used directly a DDL statment.
    But you can use an EXECUTE IMMEDIATE in your process.
    SO
    BEGIN
    EXECUTE IMMEDIATE ' DROP TABLE STATPHI_595730051';
    END;
    Regards

  • Creation of triggers using CFQUERY tag is giving error

    Hi,
    I am creating triggers and stored procedure on ORACLE data
    base using <CFQUERY>.
    <CFQUERY DATASOURCE="CRM">
    create or replace trigger AWC_ACCOUNTINGPERIODSID_TRI
    before insert on AWC_ACCOUNTINGPERIODS
    for each row
    begin
    select AWC_ACCOUNTINGPERIODSID_SEQ.nextval into :new.AP_ID
    from dual;
    end;
    </CFQUERY>
    But the created trigger is not compiled, it is giving the
    following error
    "Line # = 1 Column # = 6 Error Text = PLS-00103: Encountered the
    symbol "" when expecting one of the following: begin case declare
    exit for goto if loop mod null pragma raise return select update
    while with <an identifier> << close current delete
    fetch lock insert open rollback savepoint set sql execute commit
    forall merge pipe The symbol "" was ignored."
    If I edit that trigger in enterprise manager console by
    pressing space and compile that, it is working fine with out any
    error. If i run the above statement in sql *plus, It is working
    fine with out any error. Can you please tell me why this is
    happening if i run it using cfquery tag and also the possible
    solutions.
    Thanks in advance,
    Vinod

    I can't tell you why your particular trigger is failing, but
    here is some "typical" reasons from Oracle's metalink.
    Common reasons for PLS-00103
    Error Summary
    PLS-00103 Encountered the symbol "%s" when expecting one of
    the following (Oerr
    LS.103)
    Error Details
    ~~~~~~~~~~~~~
    Error: PLS-00103
    Text: Encountered the symbol "%s" when expecting one of the
    following:
    Cause: This error message is from the parser. It found a
    token
    (language element) that is inappropriate in this context.
    Action: Check previous tokens as well as the one given in the
    error message. The line and column numbers given in the
    error
    message refer to the end of the faulty language construct.
    PLS-00103 errors can often be difficult to localize what the
    error is so here are some
    common reasons for PLS-00103 errors..
    A very common reason for PLS-00103 is when a reserved word is
    used, with a reserved word
    means words that names an oracle object or a built in
    procedure, for example MOD, ABS,
    TABLE, VIEW etc..
    When trying to use SQL*PLUS commands in PL/SQL procedures,
    like SPOOL, SET and other
    commands that belongs to SQL*PLUS can result in this error.
    Using parameter declaration at the IN/OUT clause in a
    procedure, this works in versions
    prior to 8.0.4, but it just ignored the declaration.
    Using DDL commands in PL/SQL will fail in PLS-00103, the way
    to use DDL commands is
    to build a procedure in dynamic sql.
    When creating package specification and a package body, a
    PLS-00103 error will occur
    if there is no slash, '/', after the package specification.
    Phil

Maybe you are looking for

  • Mac Pro GPU Accelerator

    Premiere CS3 and AE are not fast at all at rendering. I believe this is because its rendered on the CPU. A few questions on this.. - I heard final cut uses the GPU to render, is this true? - In premiere is there a way to switch to GPU rendering, not

  • Podcasts missing from Music Playlists

    Front Row playlists used to show the same tracks as iTunes playlists, but in Leopard, Front Row fails to show podcast episodes in playlists. I just installed iTunes 8.0 and Front Row 2.1.6 on OSX 10.5.5, and the problem persists. What is the best wor

  • Installing new version of firefox to mac os x 10.2.8

    I have a Mac OS X Version 10.2.8 and recently changed cable companies. Since the change, Internet is SLOW, wheels spinning forever, ets. I clicked the upload new version of firefox and it is taking overnight to update.

  • NetWeaver RFC and IPv6

    One of the main benefits with the new-ish NetWeaver RFC SDK over its older librfc sibling is that the newer has support for IPv6 according to<a href="https://websmp101.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000701311&">the connectors page</a> Ba

  • CheckTLFFontsLoaded taking large amount of time every frame

    After trying to figure out why converting all our text fields to TLF is hammering performance for ages, I've finally discovered the culprit function that is taking so long on every single frame: RuntimeManager$.checkTLFFontsLoaded (fl.text) This func