DBMS_SQL in another schema of table-error of request * ORA-00942
Oracle experts,I think that I have problems with the help of DBMS_SQL in which the function was created in a schema and the query table was created in a different schema.
We have 2 schemas: S1, S2
We have 2 tables:
T1 in the S1 schema
T2 in the schema S2
We have a function F1 created by DBA in the S1 schema that uses the dbms_sql as:
CREATE or REPLACE FUNCTION S1. F1 (v1 in VARCHAR2) return NUMBER IS
Cursor1 INTEGER;
BEGIN
Cursor1: = dbms_sql.open_cursor;
DBMS_SQL. Parse (cursor1, v1, dbms_sql. NATIVE);
DBMS_SQL.close_cursor (Cursor1);
Return (0);
EXCEPTION
while others then
DBMS_SQL.close_cursor (Cursor1);
return (1);
END;
/
I use jdeveloper 11G. We have a DB Oracle 11 g.
We have a java program that uses jdbc to talk to our Oracle database.
Basically, in my program java, I call F1 function to check if the query is valid.
If this is the case, it returns 0. Otherwise, returns the value 1:
oracle.jdbc.OracleCallableStatement cstmt = connection.prepareCall (oracle.jdbc.OracleCallableStatement) ("start?: = S1.") F1 (?); end; ») ;
cstmt.registerOutParameter (1, java.sql.Types.INTEGER);
cstmt.setString (2, "Select * from S2.") T2');
cstmt. Execute ();
Since the table that I run the query T2, created in different pattern of F1 has been created, I got the error:
* ORA-00942: table or view does not exist
So my questions are the following:
-J' use DB Oracle 11g, if I run the query on a table that was created in a different pattern than the function (which uses dbms_sql) appeared, I would get the error ORA-00942?
-If I run the query on the T1 table in the same schema as the function F1, if I have the same problem (the reason why I ask is that I can't create any table in the S1 schema because the DBA can do; I'm not a DBA)
-This isn't a problem, but a feature of security due to SQL injection?
-How to solve this problem, other than creating the table in the same schema as the function that uses DBMS_SQL?
Kind regards
Binh
Copyright (default) stored objects managed by virtue field of safety of the owner of the and ignore privileges based on roles. So whatever that the user logged as function of S1. F1 always runs as a user S1 and ignores the S1 user roles. That's why exeuting instruction in S1. F1:
Select * from S2. T2
requires that the S1 user have the right to SELECT on S2. T2 granted to S1 directly, without going through the role.
SY.
Tags: Database
Similar Questions
-
grant the select privilege on the table in another schema by role error
Hello
I have a problem with the granting of privileges to another schema
I have A user who has only 1 system priv: connect, which has a private: create session;
I created a role X, which I have the privilege: select on a table to a diagram B customer.
I then conceded this X role to A user.
I can't select * B.customers when im connected to A
identification of information like it that I'm missing?
Thank you
Rgds>
but whenever I put a default role, the other is automatically set to zero-defectsHow did you receive the two default roles?
>
By running the code I posted above as user SYS.Drop your user and start again and use the code I posted.
-
OBIEE 11 g: odd error in report ORA-00942: table or view does not exist
Hi gurus,
I get the following error if I pull one or more columns in a table of facts
Error codes: OPR4ONWY:U9IM8TAC:OI2DL65PState: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle error code: 942, message: ORA-00942: table or view does not exist to the call of the OCIStmtExecute OIC. [nQSError: 17010] Prepare the SQL statement failed. (HY000)SQL published: SELECT 0 s_0, 'XXXXXX '. "" "" Fact_FCT_REG_XXXXXXX_XXXXXX '. "" S_1 N_ACCT_BALANCE""XXXXXX"FETCH FIRST 4000001 LINES ONLYIs the weird part, when I take the physical sql and run it against the same user account. It is fetching result. He also works in a different environment, but throwing error in our test environment, both environments are well established for a long time to return, and many projects are developed by many different groups.
I really need expertise help to break this question. Given that I do not get no idea why his mistake to throw into the application layer?
Any help will be much appreciated.
Thanks in advance
Concerning
Nathalie
Save nqquery.log which connection pool is used to send the query to the DB. Then check the configuration of the Connection Pool to see what user credentials are used to connect to the database, to which database (DSN), and if the table owner prefix is added to the SQL.
ORA-00942 can often be due to the existing table, but the user trying to access him confer no rights. Rather than say 'no permission', Oracle will say 'does not exist.
-
copy paste a package to another user gives an error...
Hello
I created a package with procedures in a user. Now, when I copy and paste this package to another server user, who is in error. When I separatelly, run the code where the error is displayed and then executed successfully.
All the mistakes, said that "table or view does not exist", even the table exists, as they say on system tables.
The error code is ORA-00942
What is this problem?
Thank you.
Published by: user12222356 on June 14, 2010 10:04user12222356 wrote:
In the frontal part, DataReader is used. Through the datareader, the values are fteched. So, what is the use of the cursor here? The same thing was dappend without using a cursor. Does not appear there?I assume you are using .NET then.
It is always using cursors. Each request is a slider, but how he defined and executed will differ according to the code that made her and if she is purely in PL/SQL or you use a layer of application 3rd party such as .NET or Java etc.
I'm not familiar with .NET, but it will go something like this...
Your .NET application creates a datareader and will assign a query to it. That would probably be done one of two ways: either one) the query is provided to the DataReader directly or b) the datereader request a cursor of the database.
For one) the query is written in the datareader which issues the request to the database, thus doing the same type of action as an OPEN statement in PL/SQL; for example, the query is parsed and executed, but no data is recovered at this time here, just a mouse pointer is passed back to the DataReader from the database. Then the datareader will have some sort of record read or search the method that get each row of data from the database to fill its record set. Once it is detected there is no additional data it will issue usually some close sort of statement on the database to close the cursor.
For (b), the request is written to the database, and the DataReader asking him the slider by calling a procedure/function. These procedures/functions returns a ref cursor, which is only a pointer to a cursor. The context then extract the data and close the cursor, as it would have made one). The difference here is that the query is not set in the layer application, but on the database layer and the DataReader does need to know how the query is written (there may be different for different types of RDBMS queries), everything he needs to know is that a set of expected results will return the query.
((b) is clearly preferable to one) because it separates the database layer of the interface layer and allows for applications to be more portable between different RDBMS, by the simple provision of database layers different. Of course there may be an intermediate layer of business (in 3-tier architecture), which may have been written in the same code as the application layer, the same code as the layer of database or intermediate layer according to the case but who is straying from the point of the sliders.
-
dbms_mview. Refresh giving "ORA-00942: table or view does not exist.
Hi all
I am trying to update the MV using the dbms_mview package but its gives me the following error.
"ORA-00942: table or view does not exist.
I have a MV named TESTMV in my environment. I'm running the following command,
Start
dbms_mview. Refresh('TESTMV,'C');
end;
ORA-00942: table or view does not exist
ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2545
ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2751
ORA-06512: at "SYS." DBMS_SNAPSHOT", line 2720
ORA-06512: at line 3 level
Any suggestions would be much appreciated.
See you soon,.
ATOM
This could be because the underlying source objects are now started to change. Is there any night script that changes or modifies the table of the source? If Yes, this means you will have to recompile the mview before running the update. You can add this line in front of your refresh command.
You won't see this problem in your new instance if you do not change your source object. It could very well be someone changed your source object only once and you won't have the same problem in the future.
Please mark this thread as answered if you think that the problem is resolved.
-
READ the TABLE of another schema
Hello
pls help me.
I want to read the table of another schema that is declared in the application of the apex.
SELECT * FROM DBA_ROLE_PRIVS;
(SELECT * FROM sys.) DBA_ROLE_PRIVS: auch bad)
The owner of this table is SYS.
Error: The Table is unknown or cannot be found.
my real schema is GCs.
How is the select statement for this case for reading in the table (or tableview) of another schema?
many and many thanks for your help.
TLThe SYS schema is a special schema in Oracle. You must explicitly grant the user rights by selecting tables and views sys.
-
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
-
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
-
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
-
How to share data in the tables ' User_ * ' with another schema
I want to share the data in the table WHERE USER_SEGMENTS with another schema. If I create a view and grant select on the view, when the other schema queries the view data are identical to themselves querying the SYS.user_segments table directly.
My guess is that the SYS.user_segments table is a view based on the current user.create view sys_user_segments as select * from sys.user_segments; grant select on sys_user_segments to A;
Is there a way to share such data without creating a copy of the table?
Oracle: 10g
Thank youIf the ADMINISTRATOR is concerned about B access to DBA_SEGMENTS (or by creating DBA_SEGMENTS views that belongs to a user who has access on top and then grant access to this view of B), it seems pretty crazy allow that kind of database connection.
If you create a database link belonged to B that connects to A, B is, in substance, given any privilege that has exercises. But it is done in a very, very dark which will no doubt be neglected in the future when someone gets a check. He'll be sitting here to wait that someone (accidentally or intentionally) Decides to exploit the security hole and do something that is causing a problem (by removing all data from a table, grabbing all the sensitive data in a table, etc.). Risks of this almost certainly far, far* far * outweigh the risks of even leaving B to obtain direct access to DBA_SEGMENTS.
Justin
-
Access to the content of the tables of a schema into another schema
Hello
I have my doubts... Suppose I have a user called DEMO and it has tables. now I have another user called DEMO1
my doubt is. How can I get the DEMO user tables in DEMO1. If updating the table DEMO1 which should reflect
DEMO user. Help me...Dear friend,
You can consult the tables of a schema in another schema using the following steps.
(1) you must grant privileges on table demo Demo1, here's the statement to do so.
Grant Select, update on the table table_name to Demo1
(2) Create in Demo1 for the table_name demo, the suite is about education to do.
SYNONYM to CREATE or REPLACE table_name for Demo.table_name;
(3) do the Update statement on the table table_name in Demo1. Updated these results reflected in demo when you post the update statement in Demo1.
Hope that gives you an idea.
Kind regards
Ravi Kumar Ankarapu. -
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
VDIt 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 -
the display of tables in another schema in the database
I started using the SQl Developer 1.5.
We can connect to a database of oracle with success, expanding the tables, it displays the list of tables in a schema.
We have another schema in the database. In the query Panel, when type us the name of the other schema as the CHT. then a few table names appear in the intellisense.
How can show us the list of tables to another within the same database schema.Welcome.
Please also take some time for correct/good answers to award points.
-
Update/insert into table in another schema
Hello
I have a custom table that is located in another schema used by our dashboard for custom tables. I want to allow users to add/edit users and the security groups for dashboards.
I see two possible solutions to this issue, I was wondering if anyone has done so and has a better solution or pointers.
Possible solutions:
1. move the table to the APEX workspace. Not desirable, would lead to changes in the Production for the pools of connections in the repository.
2. create a temporary table where you would load the security table data when the user wishes to add/modify records in the security table and then use triggers to update the table by using the synonym to the table.
Any help would be appreciated.
Thank you
RobModify the procedure to look like to...
create or replace PROCEDURE UPDATE_TABLE(p_table IN VARCHAR2, p_column IN VARCHAR2, p_value IN VARCHAR2, p_condition IN VARCHAR2) AS v_sql_stmt VARCHAR2(4000); BEGIN v_sql_stmt := 'UPDATE ' || p_table || ' SET ' || p_column || ' = ' || p_value || ' WHERE ' || p_condition; EXECUTE IMMEDIATE v_sql_stmt; COMMIT; END UPDATE_TABLE; {code} Edited by: Tyson Jouglet on Sep 25, 2008 8:03 AM
-
Referencing Tables in another schema
APEX 4
http://i.imgur.com/WDwSC.jpg
Is it true that you cannot reference another schema objects (i.e. ONLY the scheme of the application's default analysis)?
I also noticed that this button "Requester" will lead you to QB page where only the analysis scheme appears.
Thank youRalphK,
Not true. Make sure that your analysis schema has grants appropriate to perform the action you want on an object in another schema. If this is not enough and you need access to another scheme of your workspace and then talk to your apex admins and it adds the schema to your workspace. Workspaces can be mapped to multiple schemas. It is not a one to one relationship.
Thank you
Janet Tyson
Maybe you are looking for
-
can I connect a mac mini to existing imac?
I have an iMac with a perfectly fine display 10.4, but I'm not able to upgrade more. I wonder if I can connect a mac mini and upgrade using my keyboard and screen of the iMac.
-
Hello! I just installed windows 7 in my laptop HP G42-475DX and it seems that I am not able to connect to wireless netwrok. When I check the devices and the prinrters, I noticed: Network controller showing a yellow own with! When I clicked on Netwrok
-
Compaq Presario C303NR is not completely put on after the new RAM upgrade
Hello Paul, It's Tammy. I finally took the time this morning to upgrade the ram in my laptop, model C303nr. And I am desperate need help because something has gone terribly wrong. The laptop starts up to my office, I get nothing but then move lines,
-
BlackBerry Smartphones how can I activate voice dialing to start from Bluetooth?
Is it possible to start the Voice Dialer when you press multifunction on a Bluetooth headset? If Yes, where is the setting for that? Thanks in advance
-
A license of two images by mistake
I have licensed two images by mistake then he was just trying to save previews of them. Can help you guys?File #: 86835107File #: 95532255Thank you.