EXECUTE IMMEDIATE Procedure from another schema

When running this procedure... I get an error ORA-00900.
Does someone kwow the problem? Can we launch procdeure in EXECUTE IMMEDIATE?
DECLARE
jobname VARCHAR2(10) := 'test';
datedebut DATE := SYSDATE;
statut VARCHAR2(10) := 'En cours';
BEGIN
EXECUTE IMMEDIATE 'WEXPSTAGN_DEVL.bicstg_standard.ins_log_job('''||jobname||''',
'''||statut ||''',
'||datedebut ||')';
END;
Edited by: 995370 on 2013-03-21 07:58

995370 wrote:
When running this procedure... I get an error ORA-00900.
Does someone kwow the problem? Can we launch procdeure in EXECUTE IMMEDIATE?
DECLARE
jobname VARCHAR2(10) := 'test';
datedebut DATE := SYSDATE;
statut VARCHAR2(10) := 'En cours';
BEGIN
EXECUTE IMMEDIATE 'WEXPSTAGN_DEVL.bicstg_standard.ins_log_job('''||jobname||''',
'''||statut ||''',
'||datedebut ||')';
END;
Edited by: 995370 on 2013-03-21 07:58You just want to do...
DECLARE
  jobname VARCHAR2(10) := 'test';
  datedebut DATE := SYSDATE;
  statut VARCHAR2(10) := 'En cours';
BEGIN
  WEXPSTAGN_DEVL.bicstg_standard.ins_log_job(jobname,statut,datedebut);
END;No need for execute immediate (and you were using it wrongly anyway)

Similar Messages

  • Problem in compiling procedure from another schema

    Hi all
    I have got 2 schemas, say A and B.
    Schema A owns a procedure P which selects data from table T1 ( external table ) and updates table T2.
    i have granted Schema B
    1) read, write privilege on the directory that table T1 refrences.
    2) all on table T1
    3) all on table T2
    4) execute on P
    I have created public synonyms for T1, T2 and P ( same name ).
    Now when i try to compile procedure P from schema B I get error
    ORA-01031: insufficient privileges
    Where am i wrong?
    Please Help

    You'll need CREATE ANY PROCEDURE privilege for that.
    Is there any reason why you don't post the one thing on which you are asking about : the alter procedure statement?
    (apart from also not posting the version, which you always should include)
    Sybrand Bakker
    Senior Oracle DBA

  • Function: I get ORA-04063 if I try to execute from another schema

    Hi All,
    I have a schema named "SCHEMA_A" and in this schema I have a function named TEST" that gets a numeric parameter "ID" and returns a string.
    Then I have a schema named "SCHEMA_B" with a grant on functions SCHEMA_A.TEST. I want to use function "TEST" from SCHEMA_B.
    If I try to execute SELECT SCHEMA_A.TEST(1) FROM DUAL inside schema SCHEMA_B I get ORA-04063.
    But if I try to execute TEST(1) from owner schema (SCHEMA_A) and then again from SCHEMA_B it works. But it works only for parameter with value = 1.
    If I try SELECT SCHEMA_A.TEST(2) FROM DUAL I get again ORA-04063. It seems that to use a specific value for function parameter, I need to execute first in the owner schema and only after that I can execute from the other schema.
    Function code is very simple:
    +CREATE OR REPLACE FUNCTION TEST(ID IN NUMBER)+
    +RETURN VARCHAR2+
    +IS+
    +l_return VARCHAR2(256);+
    +BEGIN+
    +l_return := 'hello world';+
    +RETURN (l_return);+
    +END TEST;+
    I use Oracle 11g R2.
    Any idea why it happens?...

    I can compile and grant as you did.
    But if I try to execute from a schema different by owner (in your case SCOTT) something like
    SELECT <your schema>.TEST(1) FROM DUAL
    I get an error.
    To fix, I have to execute this function in the owner schema with exactly the same parameter.
    If I execute with a parameter in the owner schema (suc as 1,2 and 3), I can execute also in schema different by owner (in your case SCOTT). But if I try with a new parameter (es: 4) from SCOTT it give me an error.
    Strange...

  • How to defer constraint of one schema from another schema

    Hi All,
    I am having a requirement of migrating data from one schema(SCHEMA_A) to another schema(SCHEMA_B). So I tried to implement the same using PL/SQL.
    Because of foreign key contraint while migrating child table, Oracle throws an error message like parent key not available.
    So I tried to set the all contraints to deferred and after completion of migration i planned to set all the contraints to immediate.
    But Here I am executing the procedure from schema(SCHEMA_C) which has rights to access SCHEMA_A and SCHEMA_B.
    How could I able to defer all the constraint in SCHEMA_B from SCHEMA_C?
    Thanks in Advance,
    Antany.

    Yes,
    You could run something like this, for foreign keys:
    BEGIN
      FOR cur_rec IN (SELECT table_name, constraint_name FROM DBA_CONSTRAINTS WHERE OWNER = <owner> AND CONSTRAINT_TYPE = 'R' )
        LOOP
          EXECUTE IMMEDIATE 'ALTER TABLE <owner>.' || cur_rec.table_name || ' DISABLE CONSTRAINT ' || cur_rec.constraint_name;
        END LOOP;
    END;
    /

  • Calling PL/SQL Procedure In Another Schema Gives Unexpected Result

    I have a SQL Script that does this:
    conn pnr/<password for user pnr>;
    set serveroutput on;
    exec vms.disable_all_fk_constraints;
    SELECT owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R';
    and the disable_all_fk_constraints procedure that is owned by user 'vms' is defined as:
    create or replace
    procedure disable_all_fk_constraints is
    v_sql   VARCHAR2(4000);
    begin
    dbms_output.put_line('Disabling all referential integrity constraints.');
    for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type='R') loop
    dbms_output.put_line('Disabling constraint ' || rec.constraint_name || ' from ' || rec.table_name || '.');
    v_sql := 'ALTER TABLE ' || rec.table_name || ' DISABLE CONSTRAINT ' || rec.constraint_name;
    execute immediate(v_sql);
    end loop;
    end;
    When I run the SQL script, the call to vms.disable_all_fk_constraints disables the FK constrains in the 'vms' schema, whereas I wanted it to disable the FK constraints in the 'pnr' schema (the invoker of the procedure). I know that I could make this work by copying the disable_all_fk_constraints procedure to the 'pnr' schema and calling it as "+exec disable_all_fk_constraints;+" from within the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.
    What can I do?
    Thank you

    You have two issues to solve.
    First you need to write a packaged procedure that works with INVOKER rights. The default is DEFINER rights.
    The difference is excatly what you need. Usually the package has the rights from the schema where it is defined (=Definer rights). In your case schema VMS. Whereas you need the privileges from the user that calls the package (PNR).
    => Check out the documentation for INVOKER rights
    The second problem is that the view "user_constraints" will not give the results you expect when called from inside a procedure in another schema. An alternative could be to use the view DBA_CONSTRAINTS with a filter on the owner (where owner = 'PNR'). Not sure if there are other working possibilities. Well you could create a list of constraint names that you want to disable, instead of creating the list dynamically.
    And you could have another potential disaster creeping up upon you. If you run this thing, then at this moment you don't have any referential integrity anymore. You can't be sure that you can create the FKs again after this action. This is EXTREMLY DANGEROUS. I would never ever do this in any kind of production or test database. I would be very careful when I do it on a development database.

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • Exec stored procedure from another stored procedure - not working

    Hey, we've got a bunch of .sql files that we run, and some of them are stored procedures. Our programs call the stored procedures from within the .sql files and that works, but we've tried calling a stored procedure from another stored procedure and it won't compile. The syntax looks the same, and we can run that second stored procedure from the SQL*Plus command prompt just fine, so we know it's in there. It doesn't matter whether we type exec or execute in the first stored procedure--it still gives us a compilation error. Here's the relevant bit of the code:
            delete CMHISTORYINDEX;
            commit;
            exec SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;
    /Here's where we go into SQL*Plus and try to compile it:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    SQL> @sp_daily_closing.sql
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE SP_DAILY_CLOSING:
    LINE/COL ERROR
    34/7     PLS-00103: Encountered the symbol "SP_DAILY_TOTAL" when expecting
             one of the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "SP_DAILY_TOTAL" to continue.
    SQL>We've also tried changing SP_DAILY_CLOSING to lowercase, but it doesn't seem to help. As I mentioned before, we can type that same sort of thing in .sql files that are not stored procedures and the exec is compiled fine and runs correctly. What are we doing wrong?

    In the stored procedure remove "exec" :
            delete CMHISTORYINDEX;
            commit;
            SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;

  • Call procedure from another procedure

    Hi All,
    I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .
    thanks

    user13424229 wrote:
    I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .A very strange requirement.. that perhaps you should expand on in order to get proper technical input and advice from forum members.
    Assuming a valid requirement, it should be implemented in the following way:
    SQL> create or replace procedure ProcB is
      2  begin
      3          DBMS_OUTPUT.put_line( 'ProcB(): executing...' );
      4  end;
      5  /
    Procedure created.
    SQL>
    SQL>
    SQL>
    SQL> create or replace procedure ProcA is
      2          E_CEASE_PROCESSING      exception;
      3          pragma exception_init(E_CEASE_PROCESSING, -20000 );
      4  begin
      5          DBMS_OUTPUT.put_line( 'ProcA(): executing...' );
      6          DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 1...' );
      7          raise E_CEASE_PROCESSING; --// typically a conditional instruction
      8          DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 2...' );
      9 
    10  exception when E_CEASE_PROCESSING then
    11          ProcB;
    12  end;
    13  /
    Procedure created.
    SQL>
    SQL>
    SQL> exec ProcA
    ProcA(): executing...
    ProcA(): doing stuff 1...
    ProcB(): executing...
    PL/SQL procedure successfully completed.
    SQL>

  • Selection from Another schema by default without schema name qualifier.

    Hi
    Oracle10g release 2, LinuxOS
    i want my schema (User_1) to always select,insert, update, delete the objects from another schema (User_2) without passing full schema qualifier every time whenever i don't pass any schema name explicitly.
    i.e. if i pass the following guerry
    select * from table_a;
    the table of user User_2.table_a (User_2.table_a) will be queried by default instead of table (User_1.table_a)
    and the same implementation is also required in Functions , procedures, sequences etc.
    Wishes

    Three relatively easy options
    1) Create private synonyms in User_1's schema for each object in User_2's schema, i.e.
    CREATE SYNONYM table_a
       FOR user_2.table_a2) Create public synonyms for each object in User_2's schema. This will make it possible for all users to query user_2's objects without specifying the schema name
    CREATE PUBLIC SYNONYM table_a
       FOR user_2.table_a3) Change the current schema for the session (potentially in a login trigger)
    ALTER SESSION SET current_schema = USER_2There are other options that are a bit more complicated like using enterprise users with shared schemas. But most people are perfectly happy with one of these three.
    Justin

  • SQL Report From Another  Schema

    Is there anyway to select a table from another schema?I have a default schema for my application but i want each user to use their own schema.
    I'm looking for something like #OWNER#.table_name but replacing #OWNER# with the name of another schema in the workspace.
    Kind Regards,
    BgUrsea
    APEX 4.0 10g XE

    Hello BgUrsea,
    you could achieve this by granting the needed privileges (e.g. select, insert, update, delete) on each table in the #OWNER#-schema to your applications parsing schema.
    If you can't use a direct mapping (e.g., you can't assign the schema name of a user as usernames for his application user), you probably need a mapping table in your parsing schema. Define an application item (e.g. "F_OWNER") and create a application computation that executes "On New Instance" and does something like
    SELECT schema
      FROM mapping_table
    WHERE owner=v('APP_USER');If you aren't sure you always have a mapping, you might think about an application process that not only computes the value but also handles the action to be performed in case there is no mapping for a user.
    But I suppose it could be easier to have a copy of you application for each user and assign the appropriate schema to each copy. That way, you don't need the mapping, you don't need to care about always using the #OWNER# when developing your application, and of course, no user can (not even accidently) access another users (or your default) schema.
    -Udo

  • Executing Stored procedure from host file

    Hi all,
    I am trying to execute a procedure from a host file.I don't know where I am doing wrong but the procedure is not executing.
    #!/bin/bash
    echo "*********************** Initializing Global Variables ***********************"
    export CONNECT_STRING=$1
    export START_TIME=`date +%m/%d/%Y:%H%M`
    #export DATE_FROM=`date +%m/%d/%Y:%H%M`
    #export DATE_TO=`date +%m/%d/%Y:%H%M`
    DATE_FROM=$5
    DATE_TO=$6
    sqlplus -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S -S ${CONNECT_STRING} <<EOF
        WHENEVER SQLERROR EXIT FAILURE
        set echo off
        execute xxjy_extract_ar_transactions.main_preinterface('$DATE_FROM','$DATE_TO');
    EOF
    echo "From Date is $DATE_FROM"
    echo "To Date is $DATE_TO" In my log i can see the From Date is 1-Jan-2013 and To date is 28-Feb-2013 which are my input parameters to concurrent program.But I don't understand why my procedure is not getting called.
    Please advice.
    Thanks,
    Sandeep

    Please post the details of the application release, database version and OS.
    Is the issue with this specific host concurrent program?
    Did you follow the steps in these docs?
    How to Register a Host Concurrent Program in Applications [ID 156636.1]
    How To Create A Custom Concurrent Program With Host Method and Pass Parameters To The Shell Script [ID 266268.1]
    How Do You Run A Unix Host Script From Concurrent Managers On MS Windows Platform? [ID 412392.1]
    How To Setup A Custom Concurrent Host Program [ID 147455.1]What is the reason of using more than one "-S" in the sqlplus command?
    Please enable trace and generate the TKPROF file to find out what is happening when you kick off this concurrent program?
    FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]
    How To Trace a Concurrent Request And Generate TKPROF File [ID 453527.1]
    Thanks,
    Hussein

  • Issue in executing an application from another remote server

    Hi Experts,
    I have an application on one of the remote server which is running on Windows Server 2003.
    I would like to execute this application from another remote server (also running on Windows Server 2003). I am able to browse the application path using "\\", but when double clicking on the application
    gives "you may not have appropriate permission to access the item"
    How do I set the permission & what permission is required?
    Please anybody can explain?
    Thanks in advance.
    Regards,
    Naveen J V

    Is this a single exe file, or is it part of an installed application with exe, dlls, registery settings, etc?
    If this is an installed application, you cannot run it like this. That would be like trying to start microsoft office which is installed on a different computer.

  • Cant view objects from another schemas

    Hi everybody!
    I have a 10.1.2 Jdeveloper and a 9.2.4 Oracle database.
    I successfully created a database connection.
    With provided login I can access to tables from another schemas in SQL Worksheet, but I cant see any objects from those schemas in the connection tree.
    What's wrong?

    The Schemas are being filtered so that you only automatically see the schema for the connection that you logged on with. To change the schemas that are visible you need to :
    1) Select the connection name in the Navigator (you should see that it has a filter icon overlaid showing that it is being filtered)
    2) Invoke the context menu and select 'Apply filters'
    3) Shuttle over the other Schemas you wish to see and press OK
    Regards,
    Lisa Sherriff
    JDev QA

  • Execute oracle procedure from SSIS

    is it possible to execute Oracle procedure from within SSIS?
    thanks

    Hi,
    I used
    begin
    test1;
    end;
    and it is giving - SSIS package "Package.dtsx" finished: Success, but it is not doing anything.
    "test1" procedure has couple of insert statements and a commit statements but the package is not inserting anything.
    Also when I use "exec test1;" it is failing with the error mentinoed here in the forum.
    Any idea what is wrong here?

  • Selecting from another schema

    If I want to select table from another schema, I have to type
    select * from [username].table_name.
    What can I do inorder not to write shema name all the time.
    for instance:
    instead of writing
    select * from [username].table_name.
    select * from table_name.

    create synonym for the object in other schema:
    create synonym <syn-name> for schema.tablename;
    then use syn-name in place of schema.tablename in ur query
    like
    select * from syn-name;

Maybe you are looking for

  • Data transfer from G4 cube to MacBook Pro w/ Snow Leopard

    Hi, I just purchased a MacBook Pro Friday and was able to successfully transfer my data from my Cube (OS 10.4.11) via Migration Assistant after the second attempt. Unfortunately, this MacBook encountered constant Prohibitive Screen errors even after

  • Using RUID in OpenDocument

    Is there anything special to know about using RUID in an OpenDocument statement? I'm writing a program to generate hyperlinks, and have found that RUID seems to be kept constant through server migration. I've found that this works: ="<a href='http://

  • Various consistency checking reports available for New GL?

    Hello dear colleagues, May I ask you for your expertise, please. Situation: We have a lot of report for checking data consistency. FI - MM with RM07MMFI FI - FA with RAABST02 Quesition: Do you know if we have these reports available for sitution in N

  • Confused where to store movies.  In iPhoto or iMovie

    When I hookup my camera, all the photos and video clips download right into iPhoto. I just learned tonight that I can import these directly into iMovie, which seems nice. However, iPhoto has the ability to assign keywords and such to video clips. So

  • Rename a domain?

    Anyone know if it's possible to rename a logical domain without destroying/recreating it? Even with that method, it seems it's impossible to rename the "primary" domain to any other name. We'd really like to name the domains with the same name as the