Error on procedure which using dblink

Hi,
i am created an procedure under one (x) database .
CREATE OR REPLACE PROCEDURE IBSOIFC.Schedule_insert(period date) IS
      CURSOR c1 IS
      SELECT *
        FROM ibsoifc.ibs_x_t_schedule@testarch
       WHERE month_yr <= period; -- AND bpref_no = :cons;
      TYPE tsch IS TABLE OF c1%ROWTYPE;
      vtsch      tsch;
      cnt        NUMBER := 0;
      stime      NUMBER;
      etime      NUMBER;
      DURATION   NUMBER;
      rcount     NUMBER;
      errorsd   PLS_INTEGER;
      ecode     NUMBER;
      column1   VARCHAR2 (100);
      column2   VARCHAR2 (100);
      column3   VARCHAR2 (100);
      column4   VARCHAR2 (100);
BEGIN
         BEGIN
         stime := DBMS_UTILITY.get_time ();
         OPEN c1;
         LOOP
            FETCH c1
            BULK COLLECT INTO vtsch LIMIT 1000;
            IF vtsch.COUNT = 1000
            THEN
               cnt := cnt + 1;
            END IF;
            FORALL i IN 1 .. vtsch.COUNT SAVE EXCEPTIONS
               INSERT INTO ibs_x_t_schedule_x
                    VALUES vtsch (i);
            EXIT WHEN c1%NOTFOUND;
         END LOOP;
         etime := DBMS_UTILITY.get_time ();
         DURATION := ((etime - stime) / 100) / 60;
         rcount :=
             (cnt * 1000) + vtsch.COUNT - NVL (SQL%BULK_EXCEPTIONS.COUNT, 0);
         INSERT INTO process_stage_log
              VALUES (SYSDATE, 'IBS_X_T_SCHEDULE', DURATION, rcount);
         CLOSE c1;
         COMMIT;
      EXCEPTION
         WHEN OTHERS
         THEN
            errorsd := SQL%BULK_EXCEPTIONS.COUNT;
            IF errorsd > 0
            THEN
               FOR j IN 1 .. errorsd
               LOOP
                  ecode := SQL%BULK_EXCEPTIONS (j).ERROR_CODE;
                  column1 :=
                       vtsch (SQL%BULK_EXCEPTIONS (j).ERROR_INDEX).sch_code;
                  column2 :=
                       vtsch (SQL%BULK_EXCEPTIONS (j).ERROR_INDEX).bpref_no;
                  column3 :=
                       vtsch (SQL%BULK_EXCEPTIONS (j).ERROR_INDEX).month_yr;
                  column4 :=
                     vtsch (SQL%BULK_EXCEPTIONS (j).ERROR_INDEX).service_code;
                  INSERT INTO process_error_log
                       VALUES (SYSDATE, ecode, 'IBS_X_T_SCHEDULE', column1,
                               column2, column3, column4);
               END LOOP;
            END IF;
      END;
END;The above procedue is calling through form 6i on when-button-pressed event by using the following code
Declare
      errm varchar2(1000);
Begin
Begin
     Select process_dt into :period
       from ibs_m_archive_process
       where app_flag = 'Y'
         and process_status = 'L';
Exception
       When no_data_found Then
          :titl.msg_fld := ' No data found on ibs_m_archive_process !!!';          
          raise form_trigger_failure;
       When too_many_rows Then
          :titl.msg_fld := ' Two many process is available !!!';
          raise form_trigger_failure;
       When others Then
          :titl.msg_fld := ' Error on ibs_m_archive_process fetch !!!';
          raise form_trigger_failure;
end;               
      message(:period);
      break;
      Begin
      Schedule_insert(:period);
      exception
            when others then
              message('error'||sqlerrm);
              errm := sqlerrm;
              insert into test values(errm);
              commit;
              raise form_trigger_failure;
      end;        
end;The exception handler catch the following error.
ORA-06531: Reference to uninitialized collection
ORA-06512: at "IBSOIFC.SCHEDULE_INSERT", line 63
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from TESTARCHThe same procedure invoked from database itself is working fine instead of from form 6i.
please guide me how to solve the problem.
kanish
Edited by: Kanish on Apr 28, 2012 11:57 PM

Hi Kanish,
SQL%BULK_EXCEPTION.COUNT is only initialized if FORALL statement is executed. Below is explained what happen if your program error
There are two possibilities.
1. DB link user/password is incorrect which raise ORA-01017 and wrongly catched in your exception block as Bulk Exception.
2. Cursor c1 retrieves zero record
CURSOR c1 IS
      SELECT *
        FROM ibsoifc.ibs_x_t_schedule@testarch
       WHERE month_yr <= period; -- AND bpref_no = :cons;# Suppose parameter period is given such a date value that cursor c1 pull 0 record
IF vtsch.COUNT = 1000
            THEN
               cnt := cnt + 1;
            END IF;
            FORALL i IN 1 .. vtsch.COUNT SAVE EXCEPTIONS
               INSERT INTO ibs_x_t_schedule_x
                    VALUES vtsch (i);
            EXIT WHEN c1%NOTFOUND;
         END LOOP;# In above code vtsch.COUNT = 0 and FORALL - INSERT statement will be never executed
rcount :=   (cnt * 1000) + vtsch.COUNT - NVL (SQL%BULK_EXCEPTIONS.COUNT, 0);# Going down you reference NVL (SQL%BULK_EXCEPTIONS.COUNT, 0) which will throw error code - ORA-06531 as bulk exceptions are not initialized
EXCEPTION
         WHEN OTHERS
         THEN
            errorsd := SQL%BULK_EXCEPTIONS.COUNT;# As a good practice you must use error code = -24381 for catching bulk bind exceptions and OTHERS for unknown exception.
# Now again you reference - SQL%BULK_EXCEPTIONS.COUNT which again throw ORA-06531 as bulk exceptions are not initialized. Hence you get message - "ORA-06512: at "IBSOIFC.SCHEDULE_INSERT", line 63"
Hope that helps

Similar Messages

  • ORA-06502 during a procedure which uses Bulk collect feature and nested tab

    Hello Friends,
    have created one procedure which uses Bulk collect and nested table to hold the bulk data. This procedure was using one cursor and a nested table with the same type as the cursor to hold data fetched from cursor. Bulk collection technique was used to collect data from cursor to nested table. But it is giving ORA-06502 error.
    I reduced code of procedure to following to trace the error point. But still error is comming. Please help us to find the cause and solve it.
    Script which is giving error:
    declare
    v_Errorflag BINARY_INTEGER;
    v_flag number := 1;
    CURSOR cur_terminal_info Is
    SELECT distinct
    'a' SettlementType
    FROM
    dual;
    TYPE typ_cur_terminal IS TABLE OF cur_terminal_info%ROWTYPE;
    Tab_Terminal_info typ_cur_Terminal;
    BEGIN
    v_Errorflag := 2;
    OPEN cur_terminal_info;
    LOOP
    v_Errorflag := 4;
    FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
    EXIT WHEN cur_terminal_info%rowcount &lt;= 0;
    v_Errorflag := 5;
    FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
    LOOP
    dbms_output.put_line(v_flag);
    v_flag := v_flag + 1;
    end loop;
    END LOOP;
    v_Errorflag := 13;
    COMMIT;
    END;
    I have updated script as following to change datatype as varchar2 for nested table, but still same error is
    comming..
    declare
    v_Errorflag BINARY_INTEGER;
    v_flag number := 1;
    CURSOR cur_terminal_info Is
    SELECT distinct
    'a' SettlementType
    FROM
    dual;
    TYPE typ_cur_terminal IS TABLE OF varchar2(50);
    Tab_Terminal_info typ_cur_Terminal;
    BEGIN
    v_Errorflag := 2;
    OPEN cur_terminal_info;
    LOOP
    v_Errorflag := 4;
    FETCH cur_terminal_info BULK COLLECT INTO tab_terminal_info LIMIT 300;
    EXIT WHEN cur_terminal_info%rowcount &lt;= 0;
    v_Errorflag := 5;
    FOR Y IN Tab_Terminal_Info.FIRST..tab_terminal_info.LAST
    LOOP
    dbms_output.put_line(v_flag);
    v_flag := v_flag + 1;
    end loop;
    END LOOP;
    v_Errorflag := 13;
    COMMIT;
    I could not find the exact reason of error.
    Please help us to solve this error.
    Thanks and Regards..
    Dipali..

    Hello Friends,
    I got the solution.. :)
    I did one mistake in procedure where the loop should end.
    I used the statemetn: EXIT WHEN cur_terminal_info%rowcount &lt;= 0;
    But it should be: EXIT WHEN Tab_Terminal_Info.COUNT &lt;= 0;
    Now my script is working fine.. :)
    Thanks and Regards,
    Dipali..

  • How to Execute Remote procedures that use DBLinks?

    Using Oracle 10g (RAC Linux) to remote connect Windows 10g to dblink to AS/400 <
    <I have created a procedure that I execute remotely by issuing the following:
    CALL GLOBAL.REFRESH_STAGING@KRONOSLINK();
    The procedure errors as
    Error at line 2
    ORA-20001: ERROR OCCURED
    ORA-06512: at "GLOBAL.REFRESH_STAGING", line 47
    ORA-06512: at line 1
    The procedure runs without error from the host database. The problem is when the procedure makes a call to the dblink.
    I unsuccessfully attempted to capture the error message.
    Question: Is it possible to execute remote procedures that use dblinks? If so, How is that accomplished.
    Question: What is the proper way to handle exceptions in this case?
    Bonus: What can be done to improve this procedure? (Suggestions, like adding return on the procedure).
    CREATE OR REPLACE PROCEDURE GLOBAL.REFRESH_STAGING IS
    NOOBJECT EXCEPTION;
    OBJECTEXIST EXCEPTION;
    PRAGMA EXCEPTION_INIT(NOOBJECT, -00942); -- Exception handling for ORA-00942 - table or view does not exist
    PRAGMA EXCEPTION_INIT(OBJECTEXIST, -00955); -- Exception handling for ORA-009555 - name is already used by an existing object
    sT LONG := '';
    sS LONG := '';
    sST LONG := '';
    cursor csrO is
    SELECT
    SCHEMANAME,
    TABLENAME
    FROM GLOBAL.STAGING_TABLES;
    csrR csrO%ROWTYPE;
    BEGIN
    FOR csrR IN csrO
    LOOP
    sT := csrR.TABLENAME;
    sS := csrR.SCHEMANAME;
    sST := sS || '.' || sT;
    BEGIN
    EXECUTE IMMEDIATE 'drop table global.' || sT || ' purge';
    EXCEPTION
    WHEN NOOBJECT THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    BEGIN
    EXECUTE IMMEDIATE 'create table global.' || sT || ' nologging as select * from ' || sST || '@thebosslink';
    COMMIT;
    EXCEPTION
    WHEN OBJECTEXIST THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    DBMS_OUTPUT.PUT_LINE(SQLCODE || ' - ' || SQLERRM);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    END LOOP;
    END REFRESH_STAGING;
    Thanks,
    blevels

    SET LINESIZE 500;
    COLUMN DB_LINK FORMAT a20
    COLUMN HOST FORMAT a20
    COLUMN USERNAME FORMAT a20
    COLUMN OWNER FORMAT a10
    COLUMN TABLE_NAME FORMAT a20
    select db_link,username, host from all_db_links where db_link = 'KRONOSLINK';
    select privilege from dba_sys_privs where grantee = 'SYSTEM';
    select owner, table_name from dba_tab_privs where grantee='SYSTEM';
    DBLINK_ USERNAME HOST
    KRONOSLINK SYSTEM ORCL
    1 row selected.
    PRIVILEGE
    GLOBAL QUERY REWRITE
    CREATE MATERIALIZED VIEW
    CREATE TABLE
    UNLIMITED TABLESPACE
    SELECT ANY TABLE
    5 rows selected.
    OWNER TABLENAME_
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS DBMS_ALERT
    SYS DBMS_SYS_ERROR
    SYS DBMS_RULE_EXIMP
    SYS DBMS_AQ
    SYS DBMS_AQADM
    SYS DBMS_AQ_IMPORT_INTER
    NAL
    SYS DBMS_AQELM
    SYS DBMS_TRANSFORM_EXIMP
    SYS SYS_GROUP
    SYS DBMS_DEFER_IMPORT_IN
    TERNAL
    SYS DBMS_REPCAT
    WMSYS WM$UDTRIG_INFO
    SYS SET_TABLESPACE
    SYS CHECK_UPGRADE
    SYS AVINASH
    SYS AVINASH
    SYS AVINASH1
    SYS AVINASH1
    SYS DB_PMP
    SYS DB_PMP
    SYS DIR_TESTCASE
    SYS DIR_TESTCASE
    SYS EXPORT_FULL_DIR
    SYS EXPORT_FULL_DIR
    SYS PUMP
    SYS PUMP
    SYS LOGS
    SYS LOGS
    SYS DPUMP_DIR2
    SYS DPUMP_DIR2
    SYS AVIS
    SYS AVIS
    SYS DPDIR_LCLLGS
    SYS DPDIR_LCLLGS
    67 rows selected.
    Edited by: user10860953 on Jan 28, 2010 10:43 AM

  • Calling Stored procedure which uses Bulk Collect

    Hi All, I have Oracle stored procedure which uses Bulk Collect and returns table type parameter as output. Can anyone please help me how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. (I am successfully able to call using MS ODBC driver, but I want to use OraOLEDB driver.)

    861412 wrote:
    how Can I call this kind of stored procedures which returns table type output using VB and Oracle's Driver. This forum deals with the server-side languages SQL and PL/SQL.
    Your question deals with the client side and Visual Basic language.

  • Error Ora-12500 when using dblink

    Hi all,
    I have a database that I can connect directly with no problem, but there's error when I try to connect to that db from another db by using dblink
    (Select * from someTab@link_name)
    The error is Ora-12500
    (Sure that tnsname.ora file is OK, I meant SID that using in dblink)
    What can I do to deal with this prob?
    Thank you!

    Mr_what wrote:
    Thank you guys! Of course I've known what Ora-12500 means, google is always the first thing I do when have to deal with any prob.Then you should have run across the cause of the problem..?
    The client (in this case, the PL/SQL code using the db-link) uses a TNS alias to connect to an Oracle Listener. Part of the TNS alias is specifying the database the client wants to connect to (e.g. using SID or SERVICE_NAME).
    The Listener confirms that it services this SID or service (it needs to be registered with the Listener). It then "+hands off+" the connection to that database. It can do this either as a dedicated or shared server process.
    In your case, your TNS connection does not request a shared server connection. So the Listener needs to provide a dedicated server to service your client connection. It does so by executing +$ORACLE_HOME/bin/oracle+ - using the settings for that registered database (which includes the +$ORACLE_HOME+ dir). It passes command line parameters to this process (typically +(LOCAL=NO)+ ), and other data via the call (such as the socket handle this oracle executable needs to use to communicate with your client session).
    This is the step that fails. The Listener fails to create this dedicated process. It uses a specific kernel call (differs from o/s to o/s) to create this dedicated server (a process on Linux/Unix, or thread on Windows). This call is usually what fails and results in the error you see on the client side.
    There can be a number of reasons why this failed. The usual two suspects are:
    - the kernel not allowing the Oracle o/s user to create more processes as it has reached it resource quota
    - invalid +$ORACLE_HOME+ and the call fails to load the bin/oracle executable process
    I would first eliminate these two as the cause of the problem. If it is not caused by these, then I would enable listener tracing and troubleshoot a connection that results in this error. There are various levels of diagnostics that can be enabled for tracing. At the lowest level one can trace the actual calls made by the listener, including the parameters values passed.

  • Problem with the procedure Which uses DB links in it.

    hello All,
    I am working on Oracle 9.2.0.8.0
    In Select Statement when i use dblinks its working,
    but when i use same select statement in procedure its giving me error
    error info:
    PL/SQL: ORA-04052: error occurred when looking up remote object PUBLIX_2PT.PDX_DRUG@ERX2PT1
    ORA-00604: error occurred at recursive SQL level 1
    ORA-03106: fatal two-task communication protocol error
    Code:
    select distinct field1,t2.field2,t3.field3
    from
    table1 t1,
    schema.table 2@2pt1 t2,
    scema.table2@2pt1 t3,
    and follows where conditions
    I need to create procedure for Crystal
    I created synonym locally and then tried to create procedure but still giving me the same error
    Any help will be appreciated

    On what platforms are the two databases running?
    If the 'Endianness' of the two platforms differs you are likely running into Bug #5671074
    (There is a one-off patch available for this bug)
    Message was edited by:
    Jens Petersen

  • How to compile packge inside procedure which uses this package

    ORACLE 10g, 11g
    CREATE OR REPLACE PACKAGE PKG_TEST_COMMIT
    PROCEDURE Insert_into_table_T1;
    PROCEDURE Update_table_T1;
    END PKG_TEST_COMMIT;
    CREATE OR REPLACE PROCEDURE PROC_TEST_COMMIT As
    Begin
    PKG_TEST_COMMIT. Insert_into_table_T1; --insert data into table T1
    EXECUTE IMMEDIATE 'DROP table T1';
    EXECUTE IMMEDIATE
    'create table T1 as select ''1'', ''d'', ''s' from DUAL'; -- now package PKG_TEST_COMMIT in uncompiled stage
    -- compile package
    DBMS_DDL.alter_compile('PACKAGE', 'OWNER', 'PKG_TEST_COMMIT');
    PKG_TEST_COMMIT. Update_into_table_T1;
    End PROC_TEST_COMMIT;
    When I try to run PKG_TEST_COMMIT I’Ve got an error: can’t lock the package.
    I tried to create separate procedure for compilation, but result is the same.
    If I finish PROC_TEST_COMMIT before compiling, then compile – OK.
    Is there is a way to compile package inside the procedure?

    I need to automate the process which first call some procedure from the package, then invalidate this package by dropping and recreating the table (I didn't create the code, but I can see thepoint init - this is the farstest way to populate huge table) and then call another proc from the same package (using table just cretated).
    Otherwise I need human attention to this process. If it is imposible I can substitude "drop table and create table" for truncate and insert", but I am afraid it will take too long.

  • Strange problem in executing procedure using dblink

    I have this strange problem coming in the execution of a procedure accessed using dblink. I will try to explain the scenario. We have one procedure in our schema which is executed using a dblink from another database as we have a integration of systems. This was working fine but after we did a fresh export and import of this schema as we migrated our database to a new better configuration DB server, the execution of this procedure is hanging when it is executed from the dblink from the other database. I hope, I have been able to explain the scenario.
    I hope, my question is clear.
    Please, help in solving the doubt.
    regards

    No starting version number.
    No current version number.
    No indication of whether the link is valid and you can SELECT across it.
    No error message of any kind.
    Nothing from your alert log.
    No indication of whether you have a global names issue.
    Please do the research required to identify the nature of the problem, check the related docs at metalink, and if you still have a problem give us the rest of the story.
    Then perhaps we can help you.

  • Executing A Procedure In a Package Using DBLink

    I need to execute a procedure which is residing in a package using dblink.
    The package got a execute PUBLIC grant.
    When I execute the following statement, I am getting error ORA: 00904, Invalid Identifier
    select PKG_NAME.PROCEDURE_NAME@dblink(null,null,null,null,null,null,null,null,null,null,null) from dual
    How can I execute the above statement.
    Thanks in advance

    I have a database INLABNEW in that i have done this
    SQL> create table temp(no number)
      2  /
    Table created.
    SQL> create or replace package pkg
      2  as
      3     procedure p;
      4  end;
      5  /
    Package created.
    SQL>  create or replace package body pkg
      2   as
      3      procedure p
      4      is
      5      begin
      6             insert into temp values(1);
      7      end;
      8   end;
      9  /
    Package body created.
    SQL> select * from temp
      2  /
    no rows selectedNow i executed the procedure pkg.p from another database
    SQL> exec pkg.p@to_inlabnew
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /And i query the table tmp in INLABNEW
    SQL> select * from temp
      2  /
            NO
             1Now question is have you given your procedure name properly.
    as your procedure is in a package it should be Your_package_name.Your_procedure_name@Your_db_link

  • DBLink error in procedure

    Hi,
    Please help me to solve this DBLink error in procedure.
    Created a below DBLink and it is working fine all sql statements in sql plus.
    DBLink created statement
    CREATE DATABASE LINK "OFFICE2"
    CONNECT TO "SALES" IDENTIFIED BY "SALES"
    USING 'TNSOFFICE2';
    SELECT TRANSACTIONID
    FROM RECEIPT_DETAIL@OFFICE2
    INSERT INTO RECEIPT_DETAIL@OFFICE2
    (TRANSACTIONID)
    VALUES
    (665035);
    While I am using this same statements in procedure, I am getting a error
    'ORA-00942 table or view does not exist' in dblink used statements and procedure is not compiling.
    Please help me to solve this problem
    CREATE OR REPLACE
    PROCEDURE TEST_PROC1 AS
    L_REC_NO NUMBER(10);
    CURSOR C1 IS
    SELECT TRANSACTIONID
    FROM RECEIPT_DETAIL@OFFICE2
    BEGIN
    OPEN C1;
    FETCH C1 INTO L_REC_NO;
    CLOSE C1;
    INSERT INTO RECEIPT_DETAIL@OFFICE2
    (TRANSACTIONID)
    VALUES
    (665035);
    END TEST_PROC1;
    Thanks & Regards,
    Jen.

    Jen. wrote:
    Created a below DBLink and it is working fine all sql statements in sql plus.Who owns this database link? (name of the schema)
    While I am using this same statements in procedure, I am getting a error
    'ORA-00942 table or view does not exist' in dblink used statements and procedure is not compiling.Who owns this stored procedure?
    CURSOR C1 IS
    SELECT TRANSACTIONID
    FROM RECEIPT_DETAIL@OFFICE2
    BEGIN
    OPEN C1;
    FETCH C1 INTO L_REC_NO;
    CLOSE C1;Why? The following is a lot less code, easier to read and more maintainable.
      L_REC_NO NUMBER(10);
    begin
      select transationid into  l_rec_no from from receipt_detail@office2;
    end;No need for an explicit cursor.
    Also why are you using a L_ prefix for variables? And why underscores? This is an extremely silly standard that fails to understand the impact of Hungarian-like notation, how to correctly manage scope resolution, and using camelcase for variables (a standard in most modern programming languages).
    The very worse place you can look at for programming standards is PL/SQL code from Oracle (as they have no consistent set standard as proved by the packages supplied by them, and often resort to COBOL-like standards of the 80's - which has no place in the 21st century software engineering)

  • Running a procedure which has parameters using dbms_job.submit

    I have a procedure which accepts some parameter and i need to schedule this using dbms_job in another procedure. My intention is to execute test_proc without waiting for test_asynch_proc
    CREATE or REPLACE PROCEDURE test_asynch_proc(p_1 in number) as
    i number;
    BEGIN
    for i in 1.. 100000
    loop
         insert into item_p values (dbms_random.random, p_1,sysdate);
    end loop;
    commit;
    END;
    I have another procedure which does an asynchronous call to this procedure by scheduling this procedure.
    create or replace procedure test_proc is
    jobno binary_integer;
    --x number :=100;
    begin
         insert into test_table values(1,sysdate);
         dbms_job.submit(job => jobNo,
         what=>'test_asynch_proc(''100'');',
         next_date=>sysdate );
    commit;
    dbms_output.put_line ('insert complete at '|| to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS'));
    end;
    but here instead of
    what=>'test_asynch_proc(''100'');'
    i need to give a variable. How can i do that?
    Thanks,
    mv

    There is another possibility where job parameters are stored in a parameter table with the job number that can be retrieved by the job code:
    bas002>
    bas002> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    bas002>
    bas002> drop table t;
    Table dropped.
    bas002> drop table p;
    Table dropped.
    bas002>
    bas002> create table t(x int,d date);
    Table created.
    bas002> create table p(jn int, jp int);
    Table created.
    bas002>
    bas002>
    bas002> create or replace procedure test_asynch_proc as
      2  begin
      3  insert into t select jp, (select sysdate from dual)
      4   from p where jn = sys_context('USERENV','BG_JOB_ID');
      5  commit;
      6  end;
      7  /
    Procedure created.
    bas002> show errors
    No errors.
    bas002>
    bas002> create or replace procedure test_proc (tp number) is
      2  jobno binary_integer;
      3  begin
      4  dbms_job.submit(
      5   job => jobno,
      6   what=>'test_asynch_proc;',
      7   next_date=>sysdate );
      8   insert into p values(jobno, tp);
      9  commit;
    10  end;
    11  /
    Procedure created.
    bas002> show errors
    No errors.
    bas002>
    bas002> alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
    Session altered.
    bas002> select sysdate from dual;
    SYSDATE
    28-FEB-2008 10:40:13
    bas002>
    bas002> exec test_proc(1);dbms_lock.sleep(5);
    PL/SQL procedure successfully completed.
    bas002> select * from t;
             X D
             1 28-FEB-2008 10:40:17
    bas002> exec test_proc(2);dbms_lock.sleep(5);
    PL/SQL procedure successfully completed.
    bas002> select * from t;
             X D
             1 28-FEB-2008 10:40:17
             2 28-FEB-2008 10:40:22Message was edited by:
    Pierre Forstmann
    Message was edited by:
    Pierre Forstmann

  • ORA-29855 - Error creating Spatial Index using a Stored Procedure

    Hi
    I am using Oracle 10gR2 database and I have written a stored procedure to create spatial index. But when i execute this function i get the following error message.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_217C1$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE FGDABZ40.MDRT_217C1$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    ORA-06512: at line 1
    ORA-06512: at "FGDABZ40.PKG_PSSDBE_APPLICATION", line 298
    ORA-06512: at line 17
    The tables that i am passing are registered in metadata and I am able to create indexes directly in sql plus. But when i try to create using this stored procedure, it fails.
    it should be possible to create indexes using a generic function. Has any faced a similar problem?
    regards
    sam

    Hi,
    I am having a same error on Oracle 10gR2 database. When I execute the same statement in sqlplus, it works. But it gives this error when I call the procedure which has this create spatial index statement.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_20CDA$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE "SDOMGR".MDRT_20CDA$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: i
    Any help will be appreciated.
    Thanks,
    Sri

  • I have installed the new up to date itunes which i can open on my PC, however when i connect my ipad or iphone i get an error saying i cannot use the device as the require software isn't installed?? I'm very confused please help......

    I have installed the new up to date itunes which i can open on my PC, however when i connect my ipad or iphone i get an error saying i cannot use the device as the require software isn't installed?? I'm very confused please help......

    Let's try a standalone Apple Mobile Device Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of why it's not installing under normal conditions.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleMobileDeviceSupport.msi (or AppleMobileDeviceSupport64.msi) to do a standalone AMDS install.
    (If it offers you the choice to remove or repair, choose "Remove", and if the uninstall goes through successfully, see if you can reinstall by doubleclicking the AppleMobileDeviceSupport.msi again.)
    Does it install (or uninstall and then reinstall) properly for you? If so, can you get a normal iTunes install to go through properly now?
    If instead you get an error message during the install (or uninstall), let us know what it says. (Precise text, please.)

  • Loader shows error when loading cs4 movies which uses matrix 3d class

    I am trying to load an swf which is made using cs4 and which uses the classes "flash.geom.Matrix3d" and "flash.text.engine", but when i load it it shows error and the swf is not getting loaded. i am getting the following error.
    ReferenceError: Error #1065: Variable flash.geom::Matrix3D is not defined.
    at prova_fla::MainTimeline()
    VerifyError: Error #1014: Class flash.text.engine::ContentElement could not be found.
    at global$init()
    at visup.utils::AdvancedText()
    at prova_fla::MainTimeline/frame1()
    The issue happens only when i try to load the swf using the loader. Opening the loading swf seperatly does not have any issues. I am using flex builder 3 and using Actionscript 3.
    Thanks in advance.

    are you publishing for flash 10?

  • Error in ASP page using storedprocedure which contain cursor

    Hi All,
    I am updating connection string perviously used MSDAOR.1 provider, Now updating ORAOLEDB.ORACLE provider. The ASP page executing storedprocedure which using cursor. Error message is "OraOLEDB error '80040e14'
    ORA-06550: PLS-00201: identifier 'CURINVCUR' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
    remaining PL/SQL query are working fine.
    if any boby facing simillar kind of issue. please post your answer.
    Thanks in advance,
    Ranjith kumar S

    Hi All,
    I am updating connection string perviously used MSDAOR.1 provider, Now updating ORAOLEDB.ORACLE provider. The ASP page executing storedprocedure which using cursor. Error message is "OraOLEDB error '80040e14'
    ORA-06550: PLS-00201: identifier 'CURINVCUR' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
    remaining PL/SQL query are working fine.
    if any boby facing simillar kind of issue. please post your answer.
    Thanks in advance,
    Ranjith kumar S

Maybe you are looking for