Execution of the procedure-

Hello

Could you tell me how to run a procedure that lies under different scheme serve in a schema to another without mentioning the name of schema before the procedure every time?


Below is the code in the right way, say, if there are two schemas, test1 and test2 and I want the procedure in Test2 will run under the Test1 schema?

Connect to test2 schema and grant permission to run for test1
grant exec on test2.prc to test1; 

create a public synonym for procedure... with execute privilege...

so that you can use wth on the schema name.

Tags: Database

Similar Questions

  • ODI-1226: Error_log_procedure step fails after 1 attempt. ODI-1232: the execution of the procedure error_log_procedure failed. ODI-1246: the logical schema has not been defined for error_log_procedure.

    I created a procedure running during the mapping fails but I am facing this error

    ODI-1226: Error_log_procedure step fails after 1 attempt.

    ODI-1232: the execution of the procedure error_log_procedure failed.

    ODI-1246: the logical schema has not been defined for error_log_procedure.

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:754)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:730)

    at oracle.odi.runtime.agent.execution.SessionTask.getExecutor(SessionTask.java:239)

    at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:152)

    at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:111)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:864)

    to oracle.odi.runtime.agent.execution.SessionExecutor$ SerialTrain.runTasks (SessionExecutor.java:2024)

    at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:562)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:718)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:611)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)

    at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 1400 (StartSessRequestProcessor.java:74)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:702)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:108)

    to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:471)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Navigate to the ODI object with the name error_log_procedure , which I assume is an ODI procedure. On the target tab (and if this source) make sure that you have specified a logical schema in the appropriate drop-down box

  • How to find the last time that the execution of the procedure and by whom?

    Hi all

    Can be found as the last run and the procedure by which the user in the dictionary of data or something else?

    Thanks in advance.

    At least that audit you, you can probably not.

    If the goal is a particular stored procedure, you can maintain a work table so he can follow the execution time, audit owner etc.

    Concerning

    Biju

  • why there is no output after execution of the procedure

    Hi all

    SQL > set serveroutput size 1000000

    SQL > set echo on

    SQL > set comments on

    SQL > declare

    2 number (19) n;

    3 v_startday varchar2 (100): = ' 01 /' 07/2013;

    4 v_owner varchar2 (100): = "SLIMSINTDM";

    5 v_audit_tab audit_var: = audit_var();

    v_table_name 6 varchar2 (40);

    7 type cur_type is ref cursor;

    8 v_cur cur_type.

    v_first_name 9 varchar2 (100);

    v_last_name 10-varchar2 (100);

    11 v_out_tab varchar2 (100);

    v_lab_code 12 varchar2 (10);

    13 v_sql varchar2 (20000);

    14 v_sql_1 varchar2 (10000): = q']

    15 select distinct au.first_name, au.last_name,.

    16: v_table_name table_name, lab_code

    Lab 17 l

    18 join aus app_user_security on AUS.owning_lab_id = l.lab_id

    19 join app_user AU AU. APP_USER_ID = AUS. Join APP_USER]';

    20 v_sql_2 varchar2 (10000): = q'[t on (t.ADDED_BY = to THE.)] APP_USER_ID

    21 or t.last_modified_by = au.app_user_id)

    22 where lab_locale = 'en_AU '.

    23 and (t.added_date > to_date (: v_startday, "MM/DD/YYYY"))

    24 or t.last_modified_date > to_date (: v_startday, "MM/DD/YYYY"))

    25 order by last_name, first_name

    26     ]';

    start 27

    28 n: = 0;

    29 because me to (select table_name from all_tables where owner = v_owner order of table_name)

    loop 30

    31 v_table_name: = substr (i.table_name, 1, instr (i.table_name, '_JN') - 1);

    32 - dbms_output.put_line ('v_table_name: ' | v_table_name |'; i.table_name: ' | i.table_name);

    33 v_sql: = v_sql_1 | i.table_name | v_sql_2;

    34 - dbms_output.put_line (v_sql);

    start at 35

    36 open v_cur for v_sql using v_table_name, v_startday, v_startday;

    37 loop

    38 extract v_cur in v_first_name, v_last_name, v_out_tab, v_lab_code;

    39 exit when v_cur % NOTFOUND;

    40               n := n + 1;

    41 v_audit_tab.extend;

    42 v_audit_tab (n): = audit_type (v_first_name, v_last_name, v_out_tab, v_lab_code);

    43 end loop;

    44 close v_cur;

    45 emergency

    46 then than others then

    then 47 cases sqlcode = - 1030 - insufficient privileges

    48 dbms_output.put_line (' no privs to ' |) THE USER | "on" | i.table_name);

    49 exit;

    50 end if;

    51 end;

    52 end loop;

    53 x in (select * from table (v_audit_tab))

    loop 54

    55 dbms_output.put_line (x.first_name |) «, » || x.last_name | ',' | x.table_name | ',' | x.lab_code);

    loop end 56;

    end 57;

    58.

    PL/SQL procedure successfully completed.

    Issue in this case, developer you can't find any (results) output as expected after the execution of this procedure, so is there something wrong?

    Thank you very much.

    When you try this below is query it returns all the lines?

    Select table_name

    from all_tables

    where owner = "SLIMSINTDM."

    order of table_name;

  • 403 Forbidden error of execution of the procedures of the URL of the browser stored

    I am currently trying to run a simple stored procedure (ea.hello_world, where "ea" is the pattern and "hello_world" is the name of the procedure) a URL from the browser, but am getting a 403 Forbidden - error message "you don't have permission to access /pls/apex/ea.hello_world on this server. I use APEX 3.2 with Oracle 11 g and mod_plsql and gave the steps of apex_public_user. Any thoughts on what I am doing wrong?

    Here is the process I have used so far:

    Create the "Hello_World" procedure in the "EA: schema

    create or replace
    procedure hello_world
    is
    Start
    HTP. Print ("'Hello World!");
    end;

    I then successfully granted to run the apex_public_user procedure:

    Grant execute on ea.hello_world to apex_public_user;

    Then, I tried to call the stored procedure from the browser using the following syntax:

    http:// < Server >: < port > / pls/apex/< schema >. < Procedure & gt;

    I also experimented with the use of a public synonym and the configuration of the wwv_flow_epg_include_mod_local, but I do not think that the function s relevant since I'm using mod_plsql and not the embedded pl/sql gateway.

    Hello

    If you have below the line in dads.conf, then wwv_flow_epg_include_mod_local sets

    PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
    

    Try:
    Create public synonym

    CREATE PUBLIC SYNONYM hello_world FOR ea.hello_world;
    

    Grant privilege to execute procedure to the public

    GRANT execute on hello_world to public;
    

    Then change the APEX_030200.wwv_flow_epg_include_mod_local function

    CREATE OR REPLACE FUNCTION
    APEX_030200.wwv_flow_epg_include_mod_local(
        PROCEDURE_NAME IN VARCHAR2)
    RETURN BOOLEAN
    IS
    BEGIN  
    
        IF UPPER(procedure_name) IN (
              UPPER('hello_world'))
       THEN
            RETURN TRUE;
        ELSE
            RETURN FALSE;
        END IF;
    END;
    /
    

    Then try
    http://:/pls/apex/hello_world

    If you can now run your procedure in URL, you can then low and e.g. grant execute procedure to the user of DAD.

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

    Published by: jarola on December 6, 2011 16:20

    Published by: jarola on December 6, 2011 16:24

    typo in the name of the function

  • simultaneous execution of the procedures

    I have a requrement in which I want to call different instances of a procedure of passing different parameter values at the same time. I am currently selecting data in a slider and make the entire process one by one. But this approach is time consuming. The only other way I know to fix the problem is to store the cursor data into a java array and then call the procedure for each value of the slider by Threading.

    The scenario is something like this:

    Create procedure prc_process
    is
    Start
    I'm in (departmentid selection of departments)
    loop
    ...
    some complexes of treatment which includes DML operations in the employee table, based on the departmentid
    ...
    end loop;
    end;

    Now, the employees table contains something around 20 million data.

    I want to have a such scenario for all departments in the departments table, I can call the procedure in this way:

    Create procedure prc_process (deptid number)
    is
    Start
    ...
    some complexes of treatment which includes DML operations in the employee table, based on the departmentid entry
    ...
    end;

    Personally, I'm not going to do such thing. I'd like to try to bring the list of departments in the basic procedure and try to do it in one fell swoop. Don't not passing one by one.

    But if this is not feasible and that you want to run the procedure for each service separately then Yes, submitting to a job is a way to allow a run in parallel.

  • Execution of the procedure of Oracle APEX

    Hello

    I've written a procedure ' create or replace PROCEDURE process_csvfile (p_filename IN VARCHAR2); " et I want to execute this procedure to Oracle Apex.


    PROCEDURE:

    create or replace PROCEDURE process_csvfile(p_filename IN VARCHAR2)
    AS
    statement1 varchar2(1000);
    statement2 varchar2(1000);
    statement3 varchar2(1000);
    
    begin
    dbms_output.put_Line(p_filename );
    statement1:= 'alter table adb.external_bcc_test location ( '  ||chr(39)|| p_filename||chr(39)|| ')' ;
    dbms_output.put_line(statement1);
    EXECUTE immediate statement1;
    dbms_output.put_line('statement1-> completed');
    EXECUTE immediate 'truncate table ADB.ADB_BCC_TEST';
    dbms_output.put_line('statement2-> completed');
    statement3:='insert /*+ append */ into ADB.ADB_BCC_TEST(BCC_ID,BCC_ADD,"NO_OF_BCC(GEO)") select * from adb.external_BCC_test';
    dbms_output.put_line(statement3);
    EXECUTE immediate statement3;
    dbms_output.put_line('statement3 insert-> completed');
    
    EXCEPTION
    WHEN OTHERS
    then
    raise;
    END;
    
    

    I created the button and the action as a dynamic Action where I wrote below PL/SQ as dynamic Action to perform this procedure


    BEGIN
    
    process_csvfile;
    END;
    
    


    But I get an error" " " ORA-06550: line 4, column 3: PLS-00306: wrong number or types of arguments in the call to 'PROCESS_CSVFILE' ORA-06550: line 4, column 3: PL/SQL: statement ignored (go to error) "

    Oracle Apex Version: 4.2.1

    Thank you

    BO.

    BO123 wrote:

    I've written a procedure ' create or replace PROCEDURE process_csvfile (p_filename IN VARCHAR2); " and I want to run this procedure from Oracle Apex.

    1. create or replace PROCEDURE process_csvfile (p_filename IN VARCHAR2)
    2. AS
    3. statement1 varchar2 (1000);
    4. statement2 varchar2 (1000);
    5. statement3 varchar2 (1000);
    6. Start
    7. dbms_output.put_Line (p_filename);
    8. statement1: = ' change the location of the table adb.external_bcc_test (' |) Chr (39) | p_filename | Chr (39) | ')' ;
    9. dbms_output.put_line (statement1);
    10. EXECUTE immediate statement1;
    11. dbms_output.put_line ('end statement1->');
    12. EXECUTE immediate ' truncate table ADB. ADB_BCC_TEST';
    13. dbms_output.put_line ('end of reporting2->');
    14. statement3: = "insert / * + append * / into ADB." ADB_BCC_TEST (BCC_ID, BCC_ADD, ' NO_OF_BCC (GEO) ') select * from adb.external_BCC_test';
    15. dbms_output.put_line (statement3);
    16. EXECUTE immediate statement3;
    17. dbms_output.put_line ('end statement3 insertion->');
    18. EXCEPTION
    19. WHILE OTHERS
    20. then
    21. lift;
    22. END;

    The treatment is an external table. How to get the source file in the specified location?

    dbms_output.put_linethe instrumentation is unnecessary in an environment of APEX (unless the apex_debug.log_dbms_output method has been called). Use apex_debug API methods instead so that information is available in debug mode.

    There is no reason to use dynamic SQL statements in lines 15-17.

    Creating a column named "NO_OF_BCC (GEO)" is not a good idea and is in conflict with the recommendation of the Oracle do not use identifiers in quotes for the names of database objects. This objects will only cause problems and confusion.

    Lines 20 to 23 are a bug. It doesn't hide where any exception occurred in fact. If there is no specific exception that must be handled in this procedure, it should not contain an exception block.

  • execution of the procedure with refcursor as output parameter

    Hi I have the package following a procedure with parameter as refcursor OUT.
    Here is an example of sample with the same structure with name in the other table, handling exceptions in my dev environment
    CREATE OR REPLACE PACKAGE TEST_PACK
      IS
    Type refCursor  is  REF CURSOR;
    PROCEDURE TEST_PROC (out_data out refCursor);
    END;
    
    
    CREATE OR REPLACE PACKAGE BODY TEST_PACK 
     IS
     Procedure test_proc (
            out_data out refCursor
                ) is
        --
        v_sql varchar2(4000);
       
        --
        begin
    
               v_sql := 'select
                        * from emp';
                       
            DBMS_OUTPUT.PUT_LINE ( 'Select Query is: '||v_sql );
    
            open out_data for v_sql;
    
            Exception
                when others then
                    DBMS_OUTPUT.PUT_LINE ( 'Error '|| SQLCODE ||','||SQLERRM );
    
       END;   
    end ;
    When I try to execute this procedure with the followig block
    DECLARE
       TYPE my_newcursor IS REF CURSOR;
       test_cur   my_newcursor;
      out_text      VARCHAR2 (4000);
    BEGIN
       TEST_PACK.test_proc(TEST_CUR) ;
       LOOP
          FETCH test_cur INTO out_text;    
          EXIT WHEN test_cur%NOTFOUND;
          dbms_output.put_line('Value of refcur is:'||out_text);
       END LOOP;
         CLOSE test_cur;  
    END;
    I get the following error
    ORA-00932: inconsistent datatypes: expected - got -
    ORA-06512: at line 8
    Could you please help me where I am doing wrong

    Thank you

    You must extract your data to an appropriate data type.

    (and note there is no need to declare your own ref cursor type as Oracle provides sys_refcursor at the end)

    for example

    SQL> set serverout on
    SQL>
    SQL> create or replace procedure test_proc(out_data out sys_refcursor) is
      2    v_sql varchar2(4000);
      3  begin
      4    v_sql := 'select * from emp';
      5    DBMS_OUTPUT.PUT_LINE ( 'Select Query is: '||v_sql );
      6    open out_data for v_sql;
      7  end;
      8  /
    
    Procedure created.
    
    SQL>
    SQL> declare
      2    rc     sys_refcursor;
      3    empRec emp%rowtype;
      4  begin
      5    test_proc(rc);
      6    loop
      7      fetch rc into empRec;
      8      exit when rc%notfound;
      9      dbms_output.put_line('Employee: '||empRec.empno||' - '||empRec.ename);
     10    end loop;
     11    close rc;
     12  end;
     13  /
    Select Query is: select * from emp
    Employee: 7369 - SMITH
    Employee: 7499 - ALLEN
    Employee: 7521 - WARD
    Employee: 7566 - JONES
    Employee: 7654 - MARTIN
    Employee: 7698 - BLAKE
    Employee: 7782 - CLARK
    Employee: 7788 - SCOTT
    Employee: 7839 - KING
    Employee: 7844 - TURNER
    Employee: 7876 - ADAMS
    Employee: 7900 - JAMES
    Employee: 7902 - FORD
    Employee: 7934 - MILLER
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    Why do you use a slider ref anyway?

    {: identifier of the thread = 886365}

  • Error during execution of the procedure

    Hello

    This is my procedure,

    create or replace
    PROCEDURE PRC_PARSE_XML (P_XML, CLOB,
    P_XPATH VARCHAR2,
    P_LIST ON PKG_SAM. REF_CURSOR_TYPE)
    IS

    CURSOR C_COLUMNS IS
    SELECT * FROM
    (SELECT ".") / SubLedgerKey' PASS,'VARCHAR2 (20)' the DOUBLE DATATYPE
    UNION ALL
    SELECT '. (/ SubLedgerFlag' PASS,'VARCHAR2 (20)' THE DOUBLE DATATYPE);

    LC_SQL VARCHAR2 (4000);
    LC_COL VARCHAR2 (1000);
    LC_COL_1 VARCHAR2 (1000);
    LC_PASS VARCHAR2 (1000);
    LC_PASS_1 VARCHAR2 (1000);
    LC_QUERY VARCHAR2 (4000);
    BEGIN

    C_COLUMNS J
    LOOP
    LC_COL: = "XTAB." | REPLACE(J.COL,'./');
    IF LC_COL_1 IS NULL THEN
    LC_COL_1: = LC_COL;
    ON THE OTHER
    LC_COL_1: = LC_COL_1 | «, » || LC_COL;
    END IF;
    LC_COL: = NULL;
    END LOOP;

    C_COLUMNS J
    LOOP
    LC_PASS: = REPLACE(J.COL,'./'). » '|| J.DATATYPE |' PATH ' | CHR (39) | J.COL | CHR (39);
    IF LC_PASS_1 IS NULL THEN
    LC_PASS_1: = LC_PASS;
    ON THE OTHER
    LC_PASS_1: = LC_PASS_1 | «, » || LC_PASS;
    END IF;
    LC_PASS: = NULL;
    END LOOP;

    LC_SQL: = 'SELECT'. LC_COL_1 | CHR (10) |
    ' FROM (select xmltype('||) CHR (39) | P_XML | CHR (39) |') double x) you. CHR (10) |
    ', xmltable('||) CHR (39) | P_XPATH | CHR (39) | CHR (10) |
    "in passing t.x' | CHR (10) |
    "COLUMNS". LC_PASS_1 | CHR (10) |
    ') XTAB;';

    LC_QUERY: = 'P_LIST OPEN FOR' | CHR (10) | LC_SQL;
    -P_LIST: = LC_QUERY; IMMEDIATELY RUN LC_QUERY;

    / * EXCEPTION
    WHILE OTHERS THEN
    RAISE_APPLICATION_ERROR (-20001,'PRC_PARSE_XML_DOCUMENT:-' |) SQLERRM) ;*/

    END PRC_PARSE_XML;

    Note:
    P_LIST ON PKG_SAM. REF_CURSOR_TYPE is a ref cursor,

    If I run the above procedure it displays error,.

    DECLARE
    P_LIST PKG_SAM. REF_CURSOR_TYPE;
    BEGIN
    PRC_PARSE_XML ("< SubLedgerList >
    < subledger >
    < SubLedgerKey > 101 < / SubLedgerKey >
    < SubLedgerFlag > Y < / SubLedgerFlag >
    < / subledger >
    < subledger >
    < SubLedgerKey > 102 < / SubLedgerKey >
    < SubLedgerFlag > Y < / SubLedgerFlag >
    < / subledger >
    < subledger >
    < SubLedgerKey > 103 < / SubLedgerKey >
    < SubLedgerFlag > N < / SubLedgerFlag >
    < / subledger >
    < / SubLedgerList > «,» (/ SubLedgerList/large auxiliary book ', P_LIST);

    END;


    Error report:
    ORA-00900: invalid SQL statement
    ORA-06512: at "SHIPLUS_PUB. PKG_XML_PARSER', line 253
    ORA-06512: at line 4 level
    00900 00000 - "invalid SQL statement.


    Kind regards
    Fame

    Published by: fame on 9 may 2012 12:27
  • Problem with the execution of the procedure

    Hello
    Kindly help me. It is a matter of urgency

    When I execute the block anonymous as @Tmp.sql, it has successfully passed.
    The anonymous block
    DECLARE
     TYPE curVar IS REF CURSOR;
      curIndex            curVar;
      IDX_Name            varchar2(38);
      parseString         varchar2(5000);
      parseString2        varchar2(5000);
      int_cur             int;
      bck                 number;
    BEGIN
    
      parseString :=                'select index_name from USER_INDEXES ';
      parseString := parseString || ' where index_name not like '||chr(39)||'%MXTEMPOID%'||chr(39);
    
    --  DBMS_OUTPUT.PUT_LINE(parseString);
    
      open curIndex for parseString;
          loop
            fetch curIndex into IDX_Name;
            exit when (curIndex%NOTFOUND);
    
            parseString2 :=                 'alter index '||IDX_Name||' rebuild  online compute statistics parallel';
    
    --    DBMS_OUTPUT.PUT_LINE(parseString2);
          int_cur := dbms_sql.open_cursor;
          dbms_sql.parse(int_cur,parseString2,dbms_sql.native);
          bck := dbms_sql.execute(int_cur);
          dbms_sql.close_cursor(int_cur);
    --        DBMS_OUTPUT.PUT_LINE('Index '||IDX_Name||' rebuilt.');
    
          end loop;
        close curIndex;
    
        -- DBMS_OUTPUT.PUT_LINE('All Indexes are rebuilt.');
    
    END ;
    But when I'm putting in a procedure and trying to run it, I get the error:
    create or replace
    PROCEDURE REBUILD_INDEX AS
      TYPE curVar IS REF CURSOR;
      curIndex            curVar;
      IDX_Name            varchar2(38);
      parseString         varchar2(5000);
      parseString2        varchar2(5000);
      int_cur             int;
      bck                 number;
    BEGIN
    
      parseString :=                'select index_name from USER_INDEXES ';
      parseString := parseString || ' where index_name not like '||chr(39)||'%MXTEMPOID%'||chr(39);
    
    --  DBMS_OUTPUT.PUT_LINE(parseString);
    
      open curIndex for parseString;
          loop
            fetch curIndex into IDX_Name;
            exit when (curIndex%NOTFOUND);
    
            parseString2 :=                 'alter index '||IDX_Name||' rebuild  online compute statistics parallel';
    
    --    DBMS_OUTPUT.PUT_LINE(parseString2);
          int_cur := dbms_sql.open_cursor;
          dbms_sql.parse(int_cur,parseString2,dbms_sql.native);
          bck := dbms_sql.execute(int_cur);
          dbms_sql.close_cursor(int_cur);
    --        DBMS_OUTPUT.PUT_LINE('Index '||IDX_Name||' rebuilt.');
    
          end loop;
        close curIndex;
    
        -- DBMS_OUTPUT.PUT_LINE('All Indexes are rebuilt.');
    
    END REBUILD_INDEX;
    Run
       BEGIN
       REBUILD_INDEX();
       END;
    Error
    Connecting to the database qqraida.
    ORA-01031: insufficient privileges
    ORA-06512: at "SYS.DBMS_SQL", line 1199
    ORA-06512: at "QQRAIDA.REBUILD_INDEX", line 25
    ORA-06512: at line 2
    Process exited.
    Disconnecting from the database qqraida.
    Published by: Dhabas on August 9, 2011 12:55

    Dhabas wrote:
    Thanks for your quick response. I saw the error.
    But, how then I don't get the same with anonymous block?

    Code that runs through procedures/functions/packages is based on explicit grants to the user who runs it.
    Anonymous blocks use subsidies based on the roles that are ignored by the functions/procedures/packages.

    Do not depend on subsidies based on the roles for your access, get explicitly grants to the user.

  • Configure the execution of the procedure at regular intervals?

    I have a package with PL/SQL functions and procedures, and I want to run some of them on a regular basis. Is it possible to configure the database server to run a procedure, say every Monday at 02:00 (AM)?

    Published by: user7095399 on 05:42 19.aug.2010

    DBMS_SCHEDULER serves your purpose. Check out the following:

    http://www.Oracle-base.com/articles/10G/Scheduler10g.php

  • strange behavior on the procedure

    Hello

    Today, in my class I came across a very mysterious behavior of Oracle DB without logical explanation. If anyone knows what this could mean that it would be useful.


    Some cases of training:

    SELECT name
    Employees
    WHERE id_employee IN (SELECT id_employee
    Of employees_seminars
    natural join seminars
    WHERE seminar_name = 'PHP');

    -> This works, lists employees who participated in PHP seminar

    same case with NOT IN:

    SELECT name
    Employees
    WHERE id_employee NOT IN (SELECT id_employee
    Of employees_seminars
    natural join seminars
    WHERE seminar_name = 'PHP');

    -> This works, employees of lists who NOT attended the PHP seminar

    And now comes the interesting - even put in the procedure with cursor + loop + fetch dbms_output (not paste complete SQL here, but would be also possible if necessary) and execution of the procedure, only the variant with NOT IN worked, the other (with only IN) shows nothing!

    Any ideas what could be wrong with that?

    I don't need to work, I was wondering as even the professor asked himself with me, so I decided try to check if this is a bug or what is magic.

    Thanks a lot if anyone would be interested in solving this mystery :-)

    (we use version 10.2.0.1.0 XE)

    Filip

    Hello

    905502 wrote:
    And now comes the interesting - even put in the procedure with cursor + loop + fetch dbms_output (not paste complete SQL here, but would be also possible if necessary) and execution of the procedure, only the variant with NOT IN worked, the other (with only IN) shows nothing!

    In your last post, you posted a procedure of NOT IN. Why, after the procedure which worked and not one that you don't understand?

    Any ideas what could be wrong with that?

    Yes:

    CREATE TABLE "STUDENT2"."SKOLENI"
    ( "ID_SKOLENI" NUMBER(*,0),
    "NAZEV" CHAR(25 BYTE), ...
    

    I suspect that the problem is the CHAR data type.
    Here's everything you need to know about the datayype TANK: do not use it. Use rather VARCHAR2.

    There are rules on how tanks are compared to the VARCHAR2s, and there is probably a subtle difference between what you do one place (where you get them expected results) and somewhere else (where you have not), such as the use of a literal in one place and a variable in another. Such a difference would not matter with a VARCHAR2, but it might with a TANK.
    You can search comparison rules in the manual of the SQL language if you really want to, but it is simpler, just to avoid the completely CHAR data type.

  • execution time of the procedure

    Hello

    I'm working on the Conversion project, there are 7 different procedures that execute one after the other. It takes nearly 17 hours to complete one conversion.
    My question is how can I find out what procedure and/or SQL takes maximum time so that I can fix it. We used dynmaic sql strongly to INSERT/CHANGE/REMOVE.
    We use Oracle 9i.

    I tried to use v$ session_longops but there are so many tiny Jules Destrooper in the procedure, which lasts less than 6 seconds to run, v$ session_longops does not display any result.
    DBMS_APPLICATION_INFO.SET_MODULE(  module_name => 'Proc1', action_name => 'Start'); 
    DBMS_APPLICATION_INFO.set_action(action_name => 'Just Started');
    Thank you
    Sandy

    Published by: Sandy310 on July 27, 2011 14:42

    You can try to create a table to record the execution time of each procedure...
    For example:

    -table of log´s
    create table executation_log (obj_name varchar2 (120),)
    VARCHAR2 (120) of the event.
    time_execute timestamp);

    -log´s procedure
    create or replace procedure prc_log (p_obj_name in varchar2,
    p_event in varchar2)
    is

    pragma autonomous_transaction;

    Start

    insert into executation_log (obj_name, event, time_execute)
    values(p_obj_name,p_event,SYSTIMESTAMP);

    end prc_log

    declare

    Start

    -call the log´s procedure
    prc_log (p_obj_name-online 'frist_object',
    p_event-online 'start');

    -call your drifter
    frist_object;

    -After the procedure of log´s you call compare the process start and end
    prc_log (p_obj_name-online 'frist_object',
    p_event-online "finish");

    -new
    prc_log (p_obj_name-online 'second_object',
    p_event-online 'start');

    second_object;

    -call once again, once again, once again
    prc_log (p_obj_name-online 'second_object',
    p_event-online "finish");

    end;

    -Drifter, then select table log´s
    Select *.
    of e executation_log
    order of e.time_execute

    Thank you...

  • The execution of a function in the procedure, passed as parameter string

    Hello

    He must create a function, pass the name of the function to a procedure, and then run this function in the procedure.

    For example:

    Hello from the FUNCTION to CREATE or REPLACE

    RETURN NUMBER

    IS

    BEGIN

    RETURN 23;

    END;

    /

    CREATE OR REPLACE PROCEDURE pro_fun (v_fun VARCHAR2, v_cal OUT NUMBER)

    IS

    BEGIN

    v_cal: = exec v_fun; <-error on this line

    END;

    /

    Now my plsql block annonymous where I'm passing function as sting of procedure:

    DECLARE

    VARCHAR2 (30) v1.

    NUMBER of v2;

    BEGIN

    v1: = "Hello";

    pro_fun (v1, v2);

    DBMS_OUTPUT. Put_line ('VALUE IS' | v2);

    END;

    /

    pro_fun (v1, v2);

    *

    ERROR on line 6:

    ORA-06550: line 6, column 1:

    PLS-00905: object SCOTT.PRO_FUN is not valid

    ORA-06550: line 6, column 1:

    PL/SQL: Statement ignored

    How below line of procedure must be written to perform this function.

    v_cal: = exec v_fun;

    Try something like this:

    create or replace function forum_hello return number

    is

    Start

    Back to 123;

    end forum_hello;

    /

    create or replace procedure forum_call_function (function_name_in in varchar2)

    is

    number of l_returnvalue;

    Start

    run immediately "begin: l: = ' |" function_name_in |'; end;' using l_returnvalue;

    dbms_output.put_line (l_returnvalue);

    end;

    /

    exec forum_call_function ('forum_hello')

    Sincere greetings,

    Patrick Barel

  • limit multiple executions of a procedure

    Hi all

    I would limit the simultaneous executions of a procedure. In other words, you want to serialize. Pretty simple, I use locking mechanism for this, but this procedure has a parameter which is a ref cursor and the lock will be released as soon as the ref cursor is open and control reaches the end of the procedure, but I is to restrict users to not be able to perform this procedure again until the closure of this ref cursor Is it possible that this can be achieved with in Oracle DB?

    Example Code:

    CREATE OR REPLACE PROCEDURE SH.SALES_BY_PRODUCT(P OUT SYS_REFCURSOR) IS
    BEGIN
    ..... --Lock here
      OPEN P FOR
        SELECT PROD_ID, SUM(AMOUNT_SOLD) AS AMOUNT FROM SH.SALES GROUP BY PROD_ID;
    ..... --Release the lock here --This approach of locking is not helping as the lock is released even before the cursor P is closed by the calling application.
    END;
    
    

    Thank you!

    You could get an application lock using package of dbms_lock which can be taken on the border of a transaction (commit) until you release or the session ends.

    HTH

Maybe you are looking for