PL/SQL procedure in another scheme gives unexpected result call

I have a SQL Script that does this:
Conn pnr / < password of user pnr >;
Set serveroutput on;
exec vms.disable_all_fk_constraints;
SELECT the owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R ';

and the disable_all_fk_constraints procedure, which is owned by the user 'vms' is defined as:
create or replace
procedure disable_all_fk_constraints is
v_sql VARCHAR2 (4000);
Start
dbms_output.put_line ('disable 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 THE CONSTRAINT ' | Rec.constraint_name;
execute immediate (v_sql);
end loop;
end;

When I run the script SQL, the call to vms.disable_all_fk_constraints disables the FK forced in the schema "vms", while I wanted to disable the FK constraints in schema "pnr" (the applicant of the procedure). I know I could do this job by copying disable_all_fk_constraints to the 'pnr' schema procedure and calling it as "+ exec disable_all_fk_constraints; +"inside, 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

Hello

Create the procedure with AUTHID CURRENT_USER, like this:

create or replace
procedure disable_all_fk_constraints
AUTHID  CURRENT_USER               -- Added
is
    v_sql VARCHAR2(4000);
begin
    ...

With AUTHID DEFINE (which is the default), everything that happens inside the stored procedure goes as if the Owers of procedure was done, except that the USER function returns always the name of the actual user.

Published by: Frank Kulash, January 11, 2011 11:07
I just see response to Sven. It is true, that it is a very dangerous thing to do.

Tags: Database

Similar Questions

  • Re: "insufficient privileges" error when you run the Java stored procedure in another schema

    I get an "insufficient privileges" error when you run the Java stored procedure in another schema, see details below.  I don't know what are missing privileges (I already granted the EXECUTE privilege), suggestions?  -Thank you.

    Define a simple java class and deploy it as a Java stored procedure to test:


    Schema: User1

    test of the package;

    public class HelloWorld {}

    public HelloWorld() {

    Super();

    }

    public static String Hello () {}

    Return "HELLO";

    }

    }

    CREATE or REPLACE FUNCTION HELLO RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME ' test. HelloWorld.hello () return java.lang.String';

    Grant execute on USER2 HELLO

    Test the Java stored procedure through the PL/SQL function call (in the same schema):


    Schema: User1

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    anonymous block filled

    v_Return = HELLO

    Test the Java stored procedure through the PL/SQL function call in a different pattern:


    Schema: USER2

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    Error report-

    ORA-01031: insufficient privileges

    ORA-06512: at "User1." HELLO', line 1

    ORA-06512: at line 4 level

    01031 00000 - "insufficient privileges".

    * Cause: An attempt was made to change the user name or password

    without the privilege appropriate. This error also occurs if

    trying to install a database without the need for employment

    access privileges.

    When Trusted Oracle is configure in DBMS MAC, this error may occur

    If the user has been granted the privilege necessary for a higher label

    that the connection is active.

    * Action: Ask the database to perform the operation or grant administrator

    the required privileges.

    For users Trusted Oracle get this error, well that granted the

    the privilege that is suitable for the top label, ask the database

    administrator to grant the privilege to the appropriate label.

    You have created the function with AUTHID CURRENT_USER, which means that the function is executed with the rights of the applicant (but not with the rights of the author). This means that the applicant must have grants (directly or through roles) on all used/accessible objects in the service. In your case the user USER2 has not granted with EXECUTE on the class/source Java test. Class HelloWorld, causing the ORA-01031 exception. You create service without AUTHID CURRENT_USER (i.e. with AUTHID DEFINE, which is by default, if you do not have a specific reason to use AUTHID CURRENT_USER) or grant EXECUTE on JAVA test SOURCE. Class HelloWorld to User2.

    Dimitar

  • grant the privilege on the SQL types to another schema

    I created two SQL types under the APP_OWNER scheme as follows:

    CREATE or REPLACE TYPE t_instr_info as an OBJECT
    (NUMBER IMNT_KY)

    CREATE or REPLACE TYPE t_tab_instr_info
    AS THE t_instr_info TABLE

    The privilege on these two types as follows:

    Grant execute on t_tab_instr_info to vprods_app2

    Grant execute on t_instr_info to vprods_app2

    The stored procedures must be developed in the scheme of the APP. In the scheme of the APP, I need to call this type to declare the array as follows:

    v_tab_output app_owner.t_tab_instr_info: = app_owner.t_tab_instr_info ();

    I get a PLS-00905: object owner.t_tab_instr_info is not valid

    I tried giving EVERYTHING instead of run, but the problem persists.

    Help, please. As a policy of all objects including tables, types etc. must be app_owner and the app schema privileges

    Thank you in advance.

    One thing I forgot to mention (since you do not explicitly specify how you are granting things) is that you need to issue DIRECT subsidies (as in my example above), you cannot compile the code if you have subsidies via a role (but you can execute anonymous blocks).

    This is an example

    create user APP_OWNER identified by APP_OWNER default tablespace users temporary tablespace temp;
    grant connect, resource, create role to APP_OWNER;
    
    create user APP_SCHEMA identified by APP_SCHEMA default tablespace users temporary tablespace temp;
    grant connect, resource to APP_SCHEMA;
    
    connect APP_OWNER/APP_OWNER@xe
    
    create role for_apps;
    
    CREATE OR REPLACE TYPE t_instr_info as OBJECT
    (IMNT_KY NUMBER);
    / 
    
    CREATE OR REPLACE TYPE t_tab_instr_info
    AS TABLE OF t_instr_info;
    / 
    
    grant execute on t_instr_info to for_apps;
    grant execute on t_tab_instr_info to for_apps;
    
    grant for_apps to app_schema;
    
    connect APP_SCHEMA/APP_SCHEMA@xe
    APP_SCHEMA_XE?create or replace procedure test
      2  as
      3     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
      4  begin
      5     null;
      6  end;
      7  /
    
    Warning: Procedure created with compilation errors.
    
    Elapsed: 00:00:01.17
    APP_SCHEMA_XE?show err
    Errors for PROCEDURE TEST:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/17     PL/SQL: Item ignored
    3/17     PLS-00201: identifier 'APP_OWNER.T_TAB_INSTR_INFO' must be
             declared
    
    APP_SCHEMA_XE?declare
      2     v_tab_output app_owner.t_tab_instr_info := app_owner.t_tab_instr_info();
      3  begin
      4     null;
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:01.17
    
  • DAQmxReadAnalogF64 gives unexpected results with 9239 of Ni - DAQmx

    Hi all

    I use a NI 9239 with a laser sensor, and I would like to acquire some pressure readings of the probe which measures the height. It works very well with Ni Max, but not in C + c++ / MFC app I am developing. I get something that looks like amplidied noise:
    1 reading scale doesn't seem fair (pressure readings I get from range - 2E9 to 2E9)
    2 changes in what the sensor is supposed to measure does not appear in my measurements at all, there is nothing other than the noise (as if I were acquires bad chain - this I double checked)
    I would like to get the same result as in Ni Max, but may not know what wrong with my code (below).

    Thanks for your help,

    Ben

    DAQmx Configure Code
    DAQmxErrChk (DAQmxCreateTask ("LaserReading", & taskHandle));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"cDAQ1Mod1/ai0","",DAQmx_Val_Diff,-10,10,DAQmx_Val_Volts,));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,,10000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,5000));

    Starting code DAQmx
    DAQmxErrChk (DAQmxStartTask (taskHandle));

    Reading DAQmx code
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,NUM,-1,DAQmx_Val_GroupByChannel,data,5000,&read,));

    TRACE sends the readings to the debug output

    TRACE ('%d points\n acquis', read);
    for (i = 0; i<5000;>
    {
    TRACE("%d\n",data[i]);
    }

    DAQmxStopTask (taskHandle);
    DAQmxClearTask (taskHandle);

    Found the answer to this problem, the problem was in the function TRACE which data acquired to the debugger output. %D %f for the float to TRACE("%f\n",data[i values changed]) - things are great now.

    Thank you

    Ben

  • access a type of user to another schema (collection)

    Hello

    In my scheme of production, I created a user type:
    CREATE TYPE T_my_row  OID '4711'
    IS OBJECT(field1 varchar2(10), field2 number(10));
    /
    
    CREATE TYPE TT_my_table  OID '0815'
    IS TABLE OF T_my_row;
    /
    I use the TT_my_table collection as a parameter of a procedure type.

    Intended to test, I would like to call this procedure from another schema (SQL-developers UT repository). This is why I need 'access' to the collection type of this test pattern.

    What are the rights I give to achieve?

    Good bye
    DPT

    Edited by: T.PD the 29.06.2010 10:40

    Dear T.PD,

    I think that under query will work for you;

    SQL > GRANT EXECUTE, DEBUG ON TYPE_NAME TO SCHEMA_NAME.

    It will be useful,

    Ogan

  • reading of the objects in another schema schema

    My requirement is to create a schema and grant privileges to read all objects in another main schema, including the functions and procedures. creating a role and assigning it to the schema will read or select the tables, but she will not allow the user to see the description of a function, or a procedure. can you please tell me what are my options. Thank you.

    Hello

    Yes you can GRANT SELECT privilege to allow access to Tables / views, and GRANT EXECUTE privilege on the procedures in another schema.

    You can also CREATE SYNONYM of these Tables in order to hide their location. There is a way to ensure the transparency of the location, otherwise use views or procedures.

    These links can give you a few tracks on the transparency of the situation and manage privileges:

    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28310/ds_admin006.htm

    http://download.Oracle.com/docs/CD/B28359_01/network.111/B28531/authorization.htm#DBSEG004

    Hope this helps.
    Best regards
    Jean Valentine

  • Error in the call to a procedure that is packed on another schema with the alias name

    Hi all

    I call a packaged procedure that has the type as a parameter collection that resides in the remote database by using synonyms.for which I am creating a synonym in my current schema.

    Below the package in the remote database:
    CREATE or REPLACE PACKAGE test_hlr BODY
    AS
    PROCEDURE raj_test)
    pi_username IN VARCHAR2,
    pi_serial_no IN arr_numb, - type of user-defined collection
    po_error_code OUT NUMBER
    )
    AS
    BEGIN
    BECAUSE me IN pi_serial_no. FIRST... pi_serial_no. LAST
    LOOP
    INSERT INTO hlr_raj
    (user_name, serial_no
    )
    VALUES (pi_username, pi_serial_no (i)
    );
    END LOOP;
    END;
    END;



    I'm create synonym of package in my current database and call this package synonymous as shown below

    create synonym ram_test for ram_test@dblink

    CREATE or REPLACE PACKAGE test_bnr BODY
    AS

    PROCEDURE ram_test)
    pi_username1 IN VARCHAR2,
    pi_serial_no1 IN arr_numb, - type of user-defined collection
    po_error_code OUT NUMBER
    )
    AS

    BEGIN
    test_hlr.raj_test (pi_username = > pi_username1,)
    pi_serial_no = > pi_serial_no1,
    po_error_code = > po_error_code
    );
    END;
    END;

    When compiling above package am getting error below
    PLS-00306: wrong number or types of arguments in the call to ' RAJ_TEST


    If I remove the collection type and use types of primitive data and then do not get error.

    Please give suggestions, about the same.

    Kind regards
    Sri Ram.

    There is no need to declare the type arr_numb locally. In fact, two types with exact same statement and namesake are not the same type. Each type has a unique OID. You can specify own OID. Then you can create the types the and remote with same OID. But if the type is the type of PL/SQL it didn't need to. For example. ON remote DB:

    create or replace
      package pkg1
        as
          type arr_numb is table of number;
          procedure p1(
                       p_numb_arr IN arr_numb,
                       p_sum OUT number
                      );
    end;
    /
    create or replace
      package body pkg1
        as
          procedure p1(
                       p_numb_arr IN arr_numb,
                       p_sum OUT number
                      )
            is
            begin
                for i in 1..p_numb_arr.count loop
                  p_sum := nvl(p_sum,0) + p_numb_arr(i);
                end loop;
          end;
    end;
    /
    

    Now locally:

    set serveroutput on
    declare
        v_numb_arr pkg1.arr_numb@sol10;
        v_sum number;
    begin
        v_numb_arr := pkg1.arr_numb@sol10(1,2,3,4,5,6,7,8,9);
        pkg1.p1@sol10(v_numb_arr,v_sum);
        dbms_output.put_line(v_sum);
    end;
    /
    45
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • Insufficient privileges in the creation of MV that he select another schema table

    Hello

    Before asking this question, I checked with similar questions in the forum, but I don't see my situation, or I'd say I'm not clear on the solution.

    I got the privileges CREATE MATERIALIZED VIEW and CREATE ANY MATERIALIZED VIEW and I want to create a MV in my schema, but the MV selects data in another schema, and I had the privilege to choose this table. Here is my code

    Create VIEW MATERIALISEE CPY_GL_HANDS_OFF_DTL

    UPDATE THE BEGINNING WITH THE LARGEST (SYSDATE, TO_DATE ('2013.10.30.23.30.00 ',' YYYY.)) MM DD. HH24.MI. THE NEXT SS SYSDATE')) + (50519 /(24*60*60)) FULL

    ENABLES QUERY REWRITE

    SELECT

    *

    Of

    User_a.GL_HANDS_OFF_DTL@dblink;

    I run it, and I get ORA-01031: insufficient privileges. According to my research so far, the schema of the latter requires the CREATE TABLE privilege, even though she already had RESOURCES (which already includes the CREATE TABLE). Is this true? That's my problem. I only have read access to the table of the dblink, I can't control the privileges of this scheme. Advise please if this is the real problem?

    Thanks and greetings

    acquired through ROLE privileges do NOT apply in the PL/SQL name procedures

  • ORA-900 sql not valid reporting error while calling the optimize_index pl/sql procedure


    Hi Experts,

    I'm on Oracle 11.2.0.3 on Linux and I have installed in my database Oracle text. I want to configure annex dbms_job to optimize my oracle text index. So first, I created a pl/sql procedure to optimize indexes. It gives me error ORA-900, but the sql even if I run in sqlplus works very well! Can you please help me the question is to find:

    Here is the procedure:

    (Either incidentally CTXAPP role has been granted in the schema where these Oracle text indexes are created and where the below procedure to optimize the index is running.)

    CREATE OR REPLACE PROCEDURE optimize_ora_txt_indexes_debug
    IS
       CURSOR cur_context_indexes
       IS
            SELECT index_name
              FROM user_indexes
             WHERE index_type = 'DOMAIN'
        AND ROWNUM<2  
        ORDER BY INDEX_NAME;
       v_user         VARCHAR2 (30);
       v_pod          VARCHAR2 (30);
       v_start_time   TIMESTAMP;
       v_end_time     TIMESTAMP;
       v_elapsed      VARCHAR2 (40);
       v_msg   VARCHAR2 (1000);
       v_error_code      NUMBER;
       v_error_msg   VARCHAR2 (1000);
       v_sql VARCHAR2 (1000);
    BEGIN
    
       FOR c IN cur_context_indexes
       LOOP
          BEGIN
            v_sql:= 'ctx_ddl.optimize_index (idx_name =>'||chr(39)|| c.index_name||chr(39)||', optlevel => '||chr(39)||'FULL'||chr(39)||')';
            dbms_output.put_line(v_sql);
            execute immediate v_sql;
          EXCEPTION
             WHEN OTHERS
             THEN
                v_error_code := SQLCODE;
                v_error_msg := SQLERRM;
                v_msg :=
                      'Error while optimizing the index '
                   || c.index_name
                   || ' '
                   || TO_CHAR (v_error_code)
                   || ' '
                   || v_error_msg;
                DBMS_OUTPUT.put_line (v_msg);
    
          END;
       END LOOP;
    
    EXCEPTION
       WHEN OTHERS
       THEN
          v_error_code := SQLCODE;
          v_error_msg := SQLERRM;
          v_msg :=
                'Error while in the optimize index procedure'
             || ' '
             || TO_CHAR (v_error_code)
             || ' '
             || v_error_msg;
          DBMS_OUTPUT.put_line (v_msg);
    
    END optimize_ora_txt_indexes_debug;
    /
    
     --the procedure compiles successfully. 
     Now when I run it , I get the error:
    SQL>exec optimize_ora_txt_indexes_debug;
    ctx_ddl.optimize_index (idx_name =>'ACCESS_CLNT_IDX04', optlevel => 'FULL')
    Error while optimizing the index ACCESS_CLNT_IDX04 -900 ORA-00900: invalid SQL
    statement
    
    
     --When I run the same command from sqlplus as execute statement , it works fine:
    SQL>exec ctx_ddl.optimize_index (idx_name =>'ACCESS_CLNT_IDX04', optlevel => 'FULL');
    PL/SQL procedure successfully completed.
     
     
    
    
    

    If everything runs from sqlplus, but fails in plsql... I'll be very grateful for pointers solve the problem.

    Thanks,

    OrauserN

    Hello

    It is a problem of pl/sql syntax. A call with EXEC is the same using BEGIN... Code of... END of block;

    SO, you need to include a beginning and an end to your call:

     v_sql:= 'BEGIN ctx_ddl.optimize_index (idx_name =>'||chr(39)|| c.index_name||chr(39)||', optlevel => '||chr(39)||'FULL'||chr(39)||'); END;';
    

    That's all.

    Herald tiomela

    http://htendam.WordPress.com

  • Drop database link in another scheme that DBA is not working

    How to remove an object for example, database 'MYDB. MYDBLINK"that is present in the SCOTT schema.

    When I try the following options of logged in as DBA , it is in error.

    "DROP DATABASE LINK"SCOTT" MYDB. MYDBLINK1 ';
    ORA-2024: connection to database not found.

    DROP DATABASE LINK SCOTT. MYDB. MYDBLINK1;
    ORA-2024: connection to database not found.

    DROP DATABASE LINK 'SCOTT'.' MYDB. MYDBLINK1';
    ORA-2024: connection to database not found.

    DROP DATABASE LINK SCOTT. MYDB. MYDBLINK1;
    ORA-2024: connection to database not found.

    I always connect like SCOTT to drop the MYDB database link. MYDBLINK1 that is present in the SCOTT schema.

    Please provide the way to drop the database link in another schema, without logging as the schema owner, so that I can connect a DBA (SYSTEM or SYS).

    You cannot remove a database link in the schema of another user. One solution is:

    SQL > CREATE PROCEDURE scott.drop_db_link AS
    BEGIN
    EXECUTE IMMEDIATE 'drop database link LINK1. "
    END drop_db_link; 2 3 4
    7 m

    Created procedure.

    SQL > exec scott.drop_db_link

    PL/SQL procedure successfully completed.

    Source: http://dbaoracletips.blogspot.com/2011/11/how-to-dropcreate-database-link-from.html
    http://laurentschneider.com/wordpress/2012/10/drop-database-link-in-another-schema.html

  • Grant execute on a package in another schema of users

    I need the ability to grant enforcement on a package in another schema of users...

    i.e. User_1 a Package pkg_package1

    User_2 should be able to grant execute on user_1.pkg_package1 to other users.

    I know you can give any procedure (I think) to user_2 and - it must be able to do.

    The problem is - I don't want user_2 can grant execute on any procedure in the database - just a diagram of user_1.

    Is there a way to do this?

    Hello

    FOT individual packages, you can tell

    GRANT   EXECUTE  ON pkg_package1
    TO      user2
    WITH GRANT OPTION;
    

    Alternatively, you can write a procedure in the schema of user_1 which grants privileges and give privileges to EXECUTE user_2 on the procedure.

  • create existing table in another schema

    Hi master,

    We are using oracle 10g R2 on linux.

    I have a scheme say user1 with many tables, starting with

    BC_ (50 PICTURES)

    PC_ (20 TABLES)

    LC_ (30 TABLES) etc.,.

    now, I want to create these tables in another schema with their constraints and their privileges in another schema.

    as I want to generate a create table script, which will create a table that begins with "BC_" only. another script will create table starting with "PC_" only. and like that.

    is it possible with the command

    create the table AS
    Select * from (old scheme). (table_name);

    can we use query sub in it to be more precise?

    and it will transfer all its privileges and grants the new schema?


    Thanks and greetings
    VD

    It is possible to CREATE TABLE as SELECT from a different scheme but CREATE TABLE as SELECT will transfer only the data and the structure of the base (column names and data types) table, no constraints.
    I think, you have two options to do this easily:
    (1) use SQLDeveloper (GUI) or a procedure from PL/SQL DBMS_METADATA. GET_DDL to generate the SQL script to create table with constraints, you can use INSERT INTO new table (columns) column SELECT FROM oldschema.oldtable
    DBMS_METADATA Description: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414

    (2) export a schema data, import it into the other using Data Pump or exp/IMP.
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14215/dp_export.htm#i1007466

  • With the help of the TYPE operator % on objects in another schema

    Suppose I have the following architecture:
    * A schema called APP_SCHEMA (for example), which contains all applications level PL/SQL packages that contain a business application logic
    * A data schema, called DATA_SCHEMA (for example), that contains the schema objects that are referenced by the PL/SQL in APP_SCHEMA
    Suppose I create a simple procedure like this in the APP_SCHEMA:
    CREATE OR REPLACE PROCEDURE test_proc(pVar IN DATA_SCHEMA.TABLENAME.TABLECOLUMN%TYPE)
    AS
    BEGIN
         DBMS_OUTPUT.PUT_LINE(pVar);
    END;
    /{code}
    For this simplified procedure I get the following error:
    {code:java}1/25     PLS-00201: identifier 'DATA_SCHEMA.TABLENAME' must be declared{code}So, my basic question is how do I use the %TYPE operator to reference objects in another schema?
    
    Other Pertinent info:
    * Windows Server 2003
    * Oracle Database 10gR2 (10.2.0.3)
    Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Its almost certainly a problem of privileges.

    I can create a test procedure based on the same script that compiles successfully.

    Verify that your user can access the table. Might need to have to grant access directly, rather than in a role.

    Published by: Keith Jamieson on August 25, 2008 17:51
    typo fixed

  • Import a table from a fullexport to an another schema with a different name

    Hello

    I habe a full export created with expdp. I want to import a table (tkz.verlauf) of this fullexport to another schema (Tom) with another (zzz) name of this table.

    I tried this:

    content = all

    Full = N

    Directory = ORADUMP

    dumpfile = fullexp.dmp

    sqlFile = IMP. SQL

    logfile = IMP.log

    schemas = tkz

    tables = verlauf

    remap_schema = tkz:blubb

    REMAP_TABLESPACE = verlauf:zzz

    But it does not work:

    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

    Connected to: Oracle 12 c database Release 12.1.0.1.0 - 64 bit Production

    UDI-00010: several work modes, patterns and paintings.

    When I use it without the 'paintings' all tables will be imported.

    Can someone help me?

    Best wishes Jessica

    Hi Jessica,.

    You must just have something like this

    Directory = ORADUMP

    dumpfile = fullexp.dmp

    logfile = IMP.log

    tables is TKZ. Verlauf

    remap_schema = tkz:blubb

    remap_table = verlauf:zzz

    Not sure if you want to rename the table or put a different tablespace (I did rename the table) - replace the last line with rather than table tablespace if you just want it in a different tablespace.

    See you soon,.

    Rich

  • Call another schema in a cursor

    Hello world

    I am trying to export data using UTL_FILE and using a function that receives the SQL as a parameter. Thus, the opening of the cursor within the function like this:
    OPEN C_Cursor FOR P_Query;
    P_Query contains SQL code, and it works with tables on the same schema

    for example.
     P_Query = ‘select col1, col2 from table1’)
    But when I set P_Query to select another schema, it fails.
    for example
    P_Query = ‘select col1 from schema2.table1’;
    I know that if I try this, will work:
    OPEN C_Cursor FOR 'SELECT col1 FROM '||schema2||'.table1';
    But I need to set the schema of the function parameters.
    My question: is there a way to select another schema with a slider, just change the sql script?

    Rafhael Dantas says:

    But when I set P_Query to select another schema, it fails.

    Well, when I open my wallet, I can see what is inside, but when I try to open the wallets of my colleague... :). In order to select from one table to the other schema, you must have the appropriate privileges. In addition, if the option is within the rights define object stored, privilege must be granted directly, without going through the role.

    SY.

Maybe you are looking for