Create package in another schema (10gR2)

Hi there,
I'm trying to create a package in another schema, but I am getting an error when I do this.
My script is as follow:
i log in as user rwn.
create or replace package mkw.test
as
procedure t;
end mkw.test;
create or replace package body mkw.test
as
procedure t as
begin
..... code
end;
end mkw.test;
I get the error: PLS-00103: Symbool "." aangetroffen terwijl een van de volgende
werd verwacht:
What am I doing wrong?
Thanks in advance.

user10674103 wrote:
Hi there,
I'm trying to create a package in another schema, but I am getting an error when I do this.
My script is as follow:
i log in as user rwn.
create or replace package mkw.test
as
procedure t;
end mkw.test;
create or replace package body mkw.test
as
procedure t as
begin
..... code
end;
end mkw.test;
I get the error: PLS-00103: Symbool "." aangetroffen terwijl een van de volgende
werd verwacht:
What am I doing wrong?
Thanks in advance.Assuming you have permission to create packages in the other schema?
Are you running this through SQL*Plus? If so, you really need to have "/" terminators after each object you are creating...
e.g.
create or replace package mkw.test
as
  procedure t;
end mkw.test;
create or replace package body mkw.test
as
  procedure t as
  begin
   ..... code
  end;
end mkw.test;
/

Similar Messages

  • Grant permission to all packages in another schema

    Is there a way I can grant access to all the packages in another user's schema?
    Please guide me.
    Thanks!

    The one way is to use cursor :
    BEGIN
      FOR Rec IN (SELECT object_name, object_type FROM all_objects WHERE owner='SOURCEUSER' AND object_type IN ('PACKAGE')) LOOP
          EXECUTE IMMEDIATE 'GRANT EXECUTE ON SOURCEUSER.'||Rec.object_name||' TO TARGETUSER';
        END IF;
      END LOOP;
    END;Edited by: Radrigez on 13.07.2011 21:38

  • Create Index on another schema table stored in my table

    Hi,
    I want to create index on a table column which is in another schema from my schema and the index to be stored in my schema.
    ex: current user 'hr'
    sql>create index idx1 on scott.emp(eno);
    Does the above query works??
    thanks,
    Sri

    Why cant you give a try?
    Are you getting any error message?
    See below..
    SQL> show user
    USER is "SCOTT"
    SQL> grant select on emp to hr;
    Grant succeeded.
    SQL> conn
    Enter user-name: hr@***
    Enter password:
    Connected.
    SQL> show user
    USER is "HR"
    SQL> create index ndx on scott.emp(sal);
    create index ndx on scott.emp(sal)
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL> conn
    Enter user-name: system@*******
    Enter password:
    Connected.
    SQL> create index ndx on scott.emp(sal);
    Index created.
    SQL> drop index ndx;
    Index dropped.
    SQL> grant create any index to hr;
    Grant succeeded.
    SQL> conn
    Enter user-name: hr@*******
    Enter password:
    Connected.
    SQL> create index ndx on scott.emp(sal);
    Index created.Edited by: jeneesh on Oct 8, 2012 3:53 PM

  • Call a Package in another schema  from a Trigger?

    Is there a method to call a package procedure from a trigger when the package exists within a different schema than the trigger (table)?
    Do you need a dblink to execute a procedure in a different schema within the same database?

    Hello,
    you need execute prvilege given to target schema on source package and you can create synonym in target schema as well. And you don't need dblink if the procedure resides in same schema or different schema in same database
    CREATE OR REPLACE TRIGGER myschema.test_trg
       BEFORE INSERT OR DELETE OR UPDATE
       ON test_table
       REFERENCING NEW AS new OLD AS old
       FOR EACH ROW
    DECLARE
    BEGIN
       -- How to pass parameters
       otherschema.mypkg.myproc (:new.id, :new.code);
    END;
    /Regards

  • Snapshots refresh from package from another scheme

    *Also posted to Database:General!
    Hi all,
    i have a trouble while refreshing snapshots.
    First, i have a scheme where a package (for snapshots
    update) and snapshots themselves reside:
    package snp_update
    procedure update_snapshots
    is
    begin
    for s_name in ( SELECT owner, name
    FROM user_snapshots )
    loop
    dbms_snapshot.refresh (s_name.owner || '.' ||
    s_name.name, 'CA');
    end loop;
    end;
    end;
    Second, i have a scheme where reside only synonym to
    snp_update package (synonym name is syn_snp_update) and
    this scheme have granted 'execute' privilege on snp_update.
    But when i try to use it as
    begin
    syn_snp_update.update_snapshot;
    end;
    i have error: ORA-01031: insufficient privileges.
    But when i execute this pl/sql block from package
    owner's scheme - everything ok.
    Oracle: 8.0.5 on Sun Solaris 2.5
    Plz, help me.
    Maksym.

    How has your schema been granted the rights on SYN_SNP_UPDATE? A common cause of this problem is that the rights have been granted to a role. Oracle does not allow you to build procedures, etc using objects that you have been granted through a role. If this is the case you'll have to grant EXECUTE on SYN_SNP_UPDATE to your schema explicitly.
    Cheers, APCThrough
    grant execute on snp_update <synonym's owner schema>;
    BTW: Package's procedure is executing. Cursor (select ... from user_snapshots) retrieves first snapshot info in package's scheme and call to dbms_snapshot.refresh generates error.

  • How to create table in another schema of same database

    Hi..
    I've a database DB1
    and has 2 schemas / USers in that..
    Usr1 and Usr2...
    And i created a TEMP table in Usr1 schema... and created
    Then tried the following statement in Usr2 schema...
    CREATE TABLE TEMP AS SELECT * FROM Usr1.TEMP;
    Then it's giving error that ...
    :00942 TABLE OR VIEW DOESN'T EXIST..
    What is the reason for that...
    Thank you

    josh1612 wrote:
    What other grants do i need to give so as to replicate the Primary Keys also...????That's not a matter of grants. It's the way the CREATE TABLE AS SELECT statement works. It does not copy over indexes, primary key constraints, unique constraints, foreign key constraints, etc.
    If you want to copy all that over, you would probably want to get the DDL from the original table (using the DBMS_METADATA package if you're in a recent version), modify the DDL with the new schema name, create the table, indexes, and constraints, and then do an INSERT ... SELECT to populate the data. Or do an export & import of the table from one schema to another.
    Justin

  • Sql Developer - View source code of procedures, functions & packages in another schema

    Our developers need the ability to view procedures, function, packages etc. in the production database (using SQL DEVELOPER).  They don't have access to sign on as the owner of these
    objects in Production.  They must use their own limited access UserID for this purpose.
    This limited access UserID has been granted select privilege on DBA_SOURCE & DBA_OBJECTS.  The developers need the ability to view the source of these object via
    the tree view in SQL DEV.  They should be able to click on "other users" in the SQL DEV tree view and see a listing of the owner schema objects.  Then they should
    be able to select the desired object and view the source code.  These developers are used to using GUI interfaces.  Selecting from DBA_SOURCE would not be an
    option for them.
    I understand that if the limited user is granted SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE then this functionality will work.  The problem is those
    privileges/roles  provide much more access than should be granted to these limited access users. Granting DBA to these users is also not an option.
    In TOAD and other end-user tools this functionality works when only select privilege on DBA_SOURCE & DBA_OBJECTS has been granted.  We need this same functionality
    in SQL DEV.
    While searching this forum and the internet, I see that other installations have this same issue.
    Please enhance SQL Developer with this functionality. 
    Thank you, ellen

    Just to double check that I'm interpreting the problem correctly, is the following true:
    select * from all_objects where object_name = 'DBA_SOURCE'
    returns nothing
    select * from dba_source where name = your PL/SQL module
    returns all the code

  • How do I view package bodies in another schema ?

    For purposes of SOX and security/audit control, we log in under our network id's in our production environment. We have sourcecode compiled into Oracle seeded schemas ( APPS ) so that scheduled jobs are able to run with submitted from the Oracle Applications environment. We don't compile code into our personal network account areas.
    I know how to GRANT EXECUTE privs so that we can execute a package in another schema, but what I want to do is to be able to view the sourcecode in another schema. Compile into APPS but be able to see the package body from my network id schema account.
    I can't seem to find what the correct permission is anywhere. Granted I can look at DBA_SOURCE to get to it, but I want to use a tool like SQL Developer or TOAD to look at the code in a more presentable and easier to debug manner.
    Any help ?

    I did some more searching on the forum... seems its already a request... TOAD gives access to DBA_Views to resolve the issue... SQL Developer has not integrated that functionality yet, but forum entries seem to indicate that it is on the horizon.
    Thanks for responding though.
    ~Barry

  • I load a package into SYS schema but cant resolve references made from a different sc

    I loaded javamail-1.2 (and associated dependencies) into the SYS schema, just because it has classes under the same package root "javax".
    If I try to load a second class having an import like "javax.mail.*" into a schema other than SYS, I get a message "can't find xxx".
    How can I make the SYS new classes visible to a different schema?
    Thanks for any help.

    1) A WHEN OTHERS exception handler that does not re-raise an exception is almost certainly an error. In your case, you are writing the error message out via DBMS_OUTPUT, but unless your front end happens to try to read and display the DBMS_OUTPUT buffer, the error will be ignored. You realistically want to remove that exception handler.
    2) Creating an index will not raise a NO_DATA_FOUND if there is no data in the table, so that exception handler is superfluous.Thank you very much, now that I removed that Exception it is telling me insufficient rights.
    3) If you want User A to be able to create an index in User B's schema, User A would need to be granted the CREATE ANY INDEX privilege (directly, not via a role). If you are getting a permissions error creating the index after removing the incorrect exception handlers, that is likely the problem. If you are getting a permissions error dropping the index after removing the incorrect exception handlers, you would need to ensure that User A has been granted the DROP ANY INDEX privilege.I thought that since I had specifically granted the INDEX privledge to SchemaA on a specific table in SchemaB that Schema A would be able to drop and create indexes on that specific table. However.. having just looked again at the documentation it would seem that I would need to be able to do exactly as you say and have the ANY to be able to create it in another schema.
    4) Since the various ANY privileges (CREATE ANY INDEX, DROP ANY INDEX, etc) are rather powerful and not restricted to a particular schema, is there a logical reason not to put this code in Schema B to begin with?Nothing in particular other than attempting to keep it all with the "parent" schema so that the select into's are run from the parent and populate the child (schemab). I guess I can have Schema A call the package in schema B and execute it however will that execute as Schema A or B?
    Thanks for such a fast and detailed response

  • VIew of Package body in another schema in EA 3.0

    I would like the ability in SQL Developer to view the package body of another schema with the CREATE ANY PRIVILGE.
    For instance, in TOAD you can grant access to DBA_SOURCE or SELECT_CATALOG_ROLE and then be able to view another schema's package body.
    This is long overdue without having to log into that schema or granting CREATE ANY PRIVILEDGE to user.
    This one is really needed

    "CREATE ANY PRIVILEGE" is irrelevant to the ability of viewing the source owned by other users.
    Please provide exact script for creating a user, which is able to see the code, say in HR schema, via the query
    select * from all_source
    where owner = 'HR'
    and yet missing the nodes in the OtherUsers->Packages->PKG_A->PKG_A Body in the navigator.

  • Create user who can update another schema table

    Hi,
    We have a prod system under which we need to update  the application schema by running different update statement and  create/execute function,procedure,package body. This is very easy if you use the owner schema. But i need to run those activities from another user due to some restriction. How can i do that??
    May u suggested to give update any table privilege..but this would give all the dictionary table access also.
    Is there any privilege that would allow any other user to update another schema table without using the schema name infront of the table name??
    Plss suggest

    John,
    Can we use public synonym for it ?  I don't know the security risk for it though :
    SQL> connect hr/hr
    Connected.
    SQL> select * from scott.emp;
    select * from scott.emp
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> connect scott/tiger
    Connected.
    SQL> create public synonym scotemp for scott.emp;
    Synonym created.
    SQL> connect hr/hr;
    Connected.
    SQL> select * from scotemp;
    select * from scotemp
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> connect scott/tiger
    Connected.
    SQL> grant select on emp to hr;
    Grant succeeded.
    SQL> connect hr/hr
    Connected.
    SQL> select * from scotemp;
    14 rows selected.
    SQL> show user;
    USER is "hr"
    SQL> update scotemp set ename='SMITHX' where empno=7369;
    update scotemp set ename='SMITHX' where empno=7369
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL> connect scott/tiger
    Connected.
    SQL> grant update on emp to hr;
    Grant succeeded.
    SQL> connect hr/hr
    Connected.
    SQL> update scotemp set ename='SMITHX' where empno=7369;
    1 row updated.
    SQL> rollback;
    Rollback complete.
    SQL>
    Regards
    Girish Sharma

  • Creating a database link to another schema in the same database

    Hello,
    I'm trying to create a database link to another schema in the same database. It was created without errors, but when I try to use it I receive "ORA-12154: TNS:could not resolve the connect identifier specified" message...
    I'm trying to do it because on my production enviroment the databases are separated, so there I can use database links without problem, but in my development environment it's all in one database separated by schemas...
    So I'm trying to simulate the same system to not need to rewrite the query every time I move from development to production environment.
    Any ideas?
    Thanks

    Hi,
    Yes, you can create a database link to your own database. I've done it before for exactly the same reason you want to.
    (By the way, I think it's a good reason. What are the alternatives?
    Having different versions of code for Development and Production? Absolutely not! Terrible idea!
    Using synonyms or substitution variables that are set differently in the different databases? That might be more efficient than a database link, but efficiency probably isn't such a big issue in Development.
    [Conditional compilation|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/fundamentals.htm#sthref250]? This might be good; it has all the efficienty of the above options, with more clarity.)
    Assuming you do want to stick with a database link, not all errors are caught when you create the link.
    Is the Development database in the tnsnames.ora file of the Development server? Do you have other database links, either in the Development server or pointing to it, that work? What is different about the ones that work, and the one that doesn't?
    Edited by: Frank Kulash on Oct 14, 2009 1:58 PM
    The more I think about this, the more I agree with the earlier respondent: synonymns are a good solution for this.
    To that suggestion you replied:
    On this way I might use "select * from SCHEMA.table" instead of "select * from table@SCHEMA"... I looking for an option to use the second way...Actually, the suggestion was that you say:
    select  *
    from    SCHEMA_table_ptr;where schema_table_ptr is a synonym.
    In Development, that synonym is defined as schema.table.
    In Production, that synonym is defined as table@SCHEMA
    Why are you "looking for an option to use the second way"?
    If you think that people reading the code should realize that the query is being done via a database link (at least in Production), then add a comment.

  • 8127: Cannot create ACTIVE STANDBY PAIR scheme because another replication

    Hi All,
    I am trying to define ACTIVE STANDBY PAIR replication scheme on the Datastore which have already bidirectional replication is defined on few tables ,
    Datastore1 ,Datastore2 are with Bidirectional replication defined on few tables , i want to have Active/stand by replication scheme between datastore1 and Datastore3, while trying to define ACTIVE STANDBY PAIR replication scheme on Datastore1 , i am facing below error
    8127: Cannot create ACTIVE STANDBY PAIR scheme because another replication
    Could you please is this how to achieve this Configuration

    This configuration is not possible. You cannot mix classic replication (CREATE REPLICATION) with active/standby pair replication (CREATE ACTIVE STANDBY PAIR). They are mutually exclusive.
    Chris

  • Grant access to all the views created in user schema to another schema

    How to grant access for all the views created in own HAGGIS schema to comqdhb schema on the HAGGIS database.
    Oracle Grant Privileges
    ===============
    Object privileges assign the right to perform a particular operation on a specific object
    I read that we can use select 'grant select on' ||view_name||'HAGGIS' user_views where owner='COMQDHB'
    Is this right
    Oracle System Privileges
    ===============
    System privileges should be used in only cases where security isnt important,because a single grant statement could remove all security from the table
    Role based security
    ============
    Role security allows you to gather related grants into a collection-since the role is a predefined collection of privileges that are grouped together.privileges are easier to assign to users.
    [http://www.dba-oracle.com/art_builder_grant_sec.htm]
    can we grant select update to all the views at a time to the other schema.
    Are there any other ways to secure the data other than creating users and assigning roles.
    Thank you
    Edited by: Trooper on Dec 23, 2008 9:24 AM

    I think what was suggested was that you use SQL to generate the grants on each and every view, that is, you use SQL to generate SQL where the SQL being generated is "grant select on view_name to role'"
    If you users to connect to Oracle you have to create usernames for them though if the users only connect via an application the application might run just as one user and access to the application is controled via application security. The control on the application can be via Directory Services such as OID or MS Active Directory. User access to Oracle can also be controlled via OID.
    To connect to Oracle you can use OS authenication (not recommended), usernames with passwords, or via Advanced Security Option which supports single sign-on products like Kebros or Oracle Internet Directory etc....
    Example using SQL to generate SQL
    How do I find out which users have the rights, or privileges, to access a given object ?
    http://www.jlcomp.demon.co.uk/faq/privileges.html
    HTH -- Mark D Powell --

  • How to create table from one to another schema?

    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,

    user2017273 wrote:
    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,When you give CREATE ANY TABLE TO A then user A will create table on any schema.But you can create stored PROCEDURE on schema B for creating table and give GRANT EXECUTE <PROC NAME> to A.

Maybe you are looking for

  • Pdf files in FILE Adapter

    Hi All, I just wanted to know whether we can process pdf files through FILE adapter in XI. If yes, Kindly let me know the procedure. Thanks in advance, Sudhasree.

  • Reg:multi mapping

    Hi, I'm working on multi mapping using BPM and the i'm using xslt mapping. So can u guys post some useful links regarding multimapping using xslt mapping in BPM. regards jithesh

  • UCCX 9.0 real-time reporting

    Hi, I need information about UCCX 9.0 real-time reporting. What are the real time reports available on UCCX 9.0. How to run this real time reports. Regards, Dinesh Joshi                  

  • Keynote: Some images are missing

    Ever since I upgraded to Keynote 6.2 and Mac OS 10.9.3 my images are deleted somewhere between me saving the file, and retrieving the file again later. Last night I was working on a brand new presenation I created (not upgraded or imported). Everythi

  • Reader 10.1.2 won't print

    Operating System XP SP3.  Installed Reader 10.1.2 and now cannot print pdf's opened in IE8, nor pdf's opened directly in the reader.  Printer (HP Laserjet 1020) "prints" a blank sheet, then displays error signal and has to be switched off and on agai