Privileges differ between SQL * more and stored procedure
A user with the dba role can access dba_role_privs. But this is not possible in a stored procedure created by the same user.Normally, the example should work fine
But with Oracle XE 11.02 - cost free database with some limitations - I get error 942
I show a simple example in SQL * more:
SQL > r
1 * select distinct dba_role_privs recipient where the recipient as "SY %.
DEALER
------------------------------
SYSTEM
SYS
SQL > create or replace procedure x as
2 start
3 for rec in (select distinct dba_role_privs dealer where the beneficiary as 'SY %')
4 loop
5 zero;
6 end of loop;
7 end;
8.
Warnung: Prozedur wurde mit Kompilierungsfehlern standing.
English translation: procedure created with compilation errors
SQL > show error
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/14 PL/SQL: statement ignored
3/43 PL/SQL: ORA-00942: table or view does not exist
SQL >
How can I fix?
Why do you think the example should work properly?
Normally, regardless of the version, the privileges granted through roles (such as DBA) not available for stored procedures. Stored procedure of a DEFINER rights can only take advantage of the privileges granted directly to the owner of the procedure. Stored procedure of the invoker rights can enjoy privileges granted by a role, but that requires that the appellant has independent privileges to query the table in question (and, in this case, would require dynamic SQL usage).
Generally, the simplest approach would be to grant the privilege to CHOOSE ANY DICTIONARY to the owner of the procedure.
Justin
Tags: Database
Similar Questions
-
difference between the view and the procedure
Hi Master,
Today I received a request from my senior technical leader... !!
Q > what is the difference between the view and the procedure?
I got response like this...
A view represents the logic of one or more tables/views. It won't take no place in db... It is a virtual table, query will only store in db... useful
for safety... If the main table has obtained changes... automatically discovers also change... etc.
Proecudure is a db object will be performs a perticular action... It may or may not return values. ?
But somehow, he isn't happy... He expects more... .very close view of diff. b & w and procedure.
Please explain it to me...!
Concerning
AR
874273 wrote:
Hi Blu,
Thanks for your replies...! But we think if notice and procedure will be the same no matter what point of view? Both are the same? If Design view... We can create a stored procedure?
How a view and procedure may do the same thing? They are two different things with different objectives. You use the correct one depending on what you want to achieve; they are not interchangeable.
And another question...!
(Q) how you will store Japan, characters of China in a database table? will there be a new feature in Oracle 11 g?
(A) I use dbms_lob package? Japan/China characters are multi byte characters... so we can use the nclob data type?
is this correct... ?
No, it not there no novelty in Oracle 11 g for the storage of Japanese or Chinese characters, because there is already a feature for their storage in previous versions as well. It is determined by the parameters characterset and nationality that you use when you create the database.
Why would you choose to store them in a LOB using DBMS_LOB? Yes, they have multibyte characters, but if you have configured your database for the correct character sets, for example using UTF - 8, then you can store the characters in VARCHAR2, like any other language. The only difference is that the storage of 4000 bytes limit still applies, so you maybe isn't able to store 4000 multibyte characters in a varchar2 column 4000 single-byte, it can be as little as 1000 characters if they are all characters in 4 bytes. (Note: 12 c limit in SQL can be increased up to 32,767 characters, to harmonize it with variable varchar2 PL)
-
How to convert MS SQL Server 2008 Stored Procedures of Oracle 11 g SPs?
We have an application from MS SQL Server 2008. We want to migrate to Oracle 11 g.
What is the recommended Oracle method for
(1) migration of data (Tables, triggers, sequences, views etc..)
(2) the stored Procedure migration.
What is the recommended tool or method pls?
We have 100s of MS Sql Server stored procedures. Then, needing a tool or method. We can rewrite all of them from scratch.Hello
Let me clarify some of the issues that you mention. But I advise you to get some professional help with migration because:
1. you must understand the architectural differences between SQL Server and Oracle. They are of different databases.
2. understand data type mappings.
3. understand the complete migration process. Just using the OTN article as a migration guide won't help because it just shows how use SQL Developer to this task.
4. understand that 100% of successful Oracle conversion is not possible with all the tools. There will always be gaps, gaps in functionality, bugs etc. So there will be some amount of manual work involved.
5. There are many other tasks involved in the migration that cannot be accomplished with SQL Developer.Get now your questions:
1. in 3.1, there is migration option for the "capture of database in offline mode". It is under the Tools option. So in 3.1 we do not have a separate tab, called "Migration."
2. use 3.1 because it is much better than 2.1 in terms of capabilities.
3 migration Wizard is the easiest way to migrate. Where are you getting confused?
4 "column data" seems to be a stored procedure in SQL Server. If it is not there in the underlying table, why he uses in the SQL statement in the procedure then? I think that we have a problem of "reserved word" with the name of column "Data". Will have to check that.
5 VARCHAR (@max) must be mapped to VARCHAR2 (4000) in Oracle. It may be a bug in SQL Developer. So during the mapping of data type in the migration wizard, you can change the default mappings.Concerning
Prakash
-
What is the diff between a 32 and 64 bit, Windows version.
Original title: is win 7 has also a 32 and 64 bit...
1. What is the diff between a 32 and 64 bit, Windows version.
2.i have a computer laptop 64 bit. so I install win 7 32 bit...
3 - is the application and games from 32-bit to 64-bit media...
1. What is the diff between a 32 and 64 bit, Windows version.
32-bit Windows uses 32-bit programs. 64-bit Windows uses 32 and 64-bit programs.2.i have a computer laptop 64 bit. so I install win 7 32 bit...
Only if you opt for a multiboot configuration.3 - is the application and games from 32-bit to 64-bit media...
Yes. -
Hi, forms 6i,
y at - it a Diff between: system.trigger_record and: system.cursor_record?
Unlike the SYSTEM. CURSOR_ITEM and SYSTEM. TRIGGER_ITEM, who do not always have the same value
(Form help: "within a given trigger, the value of the SYSTEM.) CURSOR_ITEM changes when the navigation takes place. This differs from the SYSTEM. TRIGGER_ITEM, which remains the same from beginning to end of the trigger. »),
seems to this SYSTEM. TRIGGER_RECORD and SYSTEM. CURSOR_RECORD always have the same value.
Look at this example:
-for example ONCE - NEW - ITEM - INSTANCE
MESSAGE (: SYSTEM.) CURSOR_ITEM); TAKE A BREAK; -shows for example ITEM2
MESSAGE (: SYSTEM.) TRIGGER_ITEM); TAKE A BREAK; -shows for example ITEM2
MESSAGE (: SYSTEM.) TRIGGER_RECORD); TAKE A BREAK; -indicates for example 1
MESSAGE (: SYSTEM.) CURSOR_RECORD); TAKE A BREAK; -indicates for example 1
NEXT_RECORD;
MESSAGE (: SYSTEM.) CURSOR_ITEM); TAKE A BREAK; -Watch ITEM1
MESSAGE (: SYSTEM.) TRIGGER_ITEM); TAKE A BREAK; -Watch ITEM2
MESSAGE (: SYSTEM.) TRIGGER_RECORD); TAKE A BREAK; -Watch 2
MESSAGE (: SYSTEM.) CURSOR_RECORD); TAKE A BREAK; -Watch 2
Kind regards
Zlatko
-
Replication of data between SQL Server and using Oracle11g materialized view.
I have Sqlserver 2005 as my source and oracle11g as my target. I need fill out the target daily with change of the source data.
to do this, we created a dblink between SQL Server and oracle and reproduced this table as a point of view, materialized in Oracle.
problem that we get here is fast refresh option is not available.each day it will pick up all of the data source.
is it possible to use Fast refresh in this scenario?
Thanks in advance.
Kind regards
Balaram.You can try MS SQL replication.
Configure transactional Standard of MS SQL and Oracle Publication subscriber http://msdn.microsoft.com/en-us/library/ms151738%28v=sql.90%29.aspx -
diff between Certified Expert and implementation
Hello
I'm new as a result of Oracle E-business, and I intend to take one of the certification of the E-Business Suite R12 to change my technology. Basically, I'm a Java developer.
Can you please tell me the diff between Certified Expert and implementation? If I go into Oracle Application development, which of them will be useful for me to start my carrier plan?
Thank you
OMIt is recommended but not essential (you need in advance before taking this exam, but even if you do not you will get the certificate it).
Thank you
Hussein -
Difference between function and stored procedure
Hi guys, I don't understand the exact difference between a function and a stored procedure. I have a lot of google but still. Can someone explain in simple terms. Thank you.Hello
Here is an example of a user-defined function:
CREATE OR REPLACE FUNCTION factorial ( in_num IN PLS_INTEGER ) RETURN PLS_INTEGER DETERMINISTIC IS BEGIN IF in_num IS NULL THEN RETURN NULL; ELSIF in_num <= 1 THEN RETURN 1; ELSE RETURN in_num * factorial (in_num - 1); END IF; END factorial; / SHOW ERRORS
This function returns an integer. You can use the function (or, more exactly, the integer returned) everywhere where a whole expression is allowed.
For exampleSELECT ROWNUM , factorial (ROWNUM) AS f , loc , SUBSTR ( loc , 1 , factorial (ROWNUM) ) AS s FROM scott.dept;
Output:
` ROWNUM F LOC S ---------- ---------- ------------- ------------- 1 1 NEW YORK N 2 2 DALLAS DA 3 6 CHICAGO CHICAG 4 24 BOSTON BOSTON
-
Dashboard of the guests and stored procedures
Hello
I have 7 guests - 2 which are necessary and others are optional. I created guests from Dashboard and grouped 2 those required in a dashboard command prompt and more optional 5 in an another guest of dashboard. All the guests are assigned to the variables and used in calling a stored procedure in SQL Server. Because I have 2 groups there are 2 go buttons on the page. I found that the order in which I enter data and click on the questions of buttons and will disrupt the call to the proc (i.e. sometimes it brings back data but sometimes she will be not based on recorded fast values).
I have 2 questions:
1. is it possible to separate the optional and mandatory guests so I can put them in separate the dashboard sections, but to have only 1 'Go' button to send the data?
2. among the guests, I would like to be a multiple selection. Is it possible to send the options of multiple selections in a stored procedure? I use the variables to other values, but I've read using a variable for multiple selection is not possible.
Any help would be appreciated
Thank you
UNAIssues related to the:
1. not in the standard, but with a bit of javascript, it is possible
http://sranka.WordPress.com/2008/11/09/how-to-replace-multi-go-button-prompt-by-one/
2. it is not possible in 10 g but possible normally as promised to 11 g. You must create camps prompt or a command prompt with the different possibilities to pass a string instead of an array or a list.Success
Nico -
ADF view object and stored procedure
Hi all
I am facing a problem with the view object, the case is, I created a stored procedure with an input and an output parameter
view object I need to call this procedure inside the request object view and define the attribute transient output parameter
could you please help me in this case, please give an example
Thanks in advance
Mohamed,
Can you explain your use case to help you.
Is it possible to convert the stored procedure in function (and change the output parameter to return the parameters) and create a display object using the function.
Ex: Create a display object "read access only via the SQL query" for the query: SELECT HR. PLSQLTEST2 staff (first_name) OF
K
-
DbDataAdapter and stored procedures with Oracle cursors,
Because of the problems I've mentioned here ([PL/SQL stored procedure causes OracleException.. .but only sometimes | https://forums.oracle.com/forums/thread.jspa?threadID=2267290]), I am trying to replace a specific layer of data ODP.NET with the code that uses the related classes, independent provider and DbProviderFactory. Things seemed to go right up to the point where I'm trying to use a DbDataAdapter object to fill a DataSet. The stored procedure, I call looks like this...
/* - - - - - - - - - - - - - - - - - - - - */
PROCEDURE GET_SOME_DATA)
IN_PARAM1 IN VARCHAR2,
O_RESULTS TO SYS_REFCURSOR);
/* - - - - - - - - - - - - - - - - - - - - */
Normally, I could do something like this...
/* - - - - - - - - - - - - - - - - - - - - */
var adapter = new OracleDataAdapter (cmd);
adapter. Fill (ds, cmd (OracleRefCursor). Parameters [1]. (Value);
/* - - - - - - - - - - - - - - - - - - - - */
.. .but that is not possible when you use DbProviderFactories since there is no equivalent of the Ref Cursor. I can use a DbDataAdapter instead of an OracleDataAdapter object, but I can't understand how to fill it with the cursor. All the examples I've seen (even the specific Oracle ones) seem to assume one is writing queries like "SELECT FOO FROM BAR" or something like that.
Am I going about this all wrong? Or is it simply not possible to use a DbDataAdapter to fill a DataSet like this? I was really hoping to be able to use the provider-independent code I could use the System.Data.OracleClient provider with my 9i database and then switch to the Oracle. DataAccess.Client once we have upgrade to 11g. Looks like I'll have to completely replace the data layer code and references. I knew that the former was necessary, but I hope this could be managed by interfaces of independent provider with concrete implementation changed via the config and/or my IoC container.
NOTE: I found this thread in the forums, but the posters to stop before the point at which they return the sliders and make use of them: [ODP.Net Ref Cursor and DbProviderFactory | https://forums.oracle.com/forums/thread.jspa?messageID=1278007]
Thank you!I did yesterday a similar thing.
The code was specific ODP.NET (that always, it is and should be), but I didn't rely on a reference to Oracle.DataAccess directly in my particular case:
The code I ended up with is not very pretty, but it works.
var refCursorType = Enum.Parse (((dynamic) plant.)) CreateParameter()). OracleDbType.GetType (), "RefCursor");
dynamic oracleParameter4 = factory. CreateParameter();
oracleParameter4.Direction = ParameterDirection.Output;
var piInstance = oracleParameter4.GetType (). GetProperty ("OracleDbType");
piInstance.SetValue (oracleParameter4, refCursorType, null); -
Insert multiple records in a database using the DB adapter and stored procedure
Hi all
I want to insert multiple records in a database using a stored procedure. I wanted to insert these records using a data adapter and data adapter must be called by a mediator.
Can anyone suggest me some ideas if it's possible with capabtilities OOB in SOA suite or not?
Thank you for your help in advance.
Thank you
ShivThe trick is in the stored procedure. You must use a data type that will handle multiple records I use varray. An example can be found in this post.
Re: Mutiple calls to AppsAdapter (pl/sql) when the payload has multiple records
When you read the procedure stored in the db adapter wizard looks and xsd / xml if you have maps accordingly.
see you soon
James -
diff between the view and the materialized view
Hi all
Whats different between the view and the materialized view?
could someone help me pls this topic
thnks in advanceSee nothing else that a set is a set of sql statements that join the single or multiple tables and shows the data... However views do not have the data themselves but point to the data.
Whereas the materialized view is a concept used primarily in the Datawarehousing... these views contain the data itself. Reason being, it is more easy/quick access to the data. The main objective of Materialized view is to perform calculations and display data from multiple tables by using joins.
check out the link for more information below.
http://www.geekinterview.com/question_details/29332rajeysh
http://oracleinstance.blogspot.com -
apex_application.g_fxx and stored procedures
Hi all
In a block anonymous page process type pl/sql, I try to call a stored procedure that perform a few sentences SQL (update, insert, etc.). What I want is to pass as a parameter to the table that contains the data in a query of sql update report (apex_application.g_fxx ()).
I created a new type in the database,
create or replace type artbl in the varray (50) of VARCHAR2 (100);
and I tried the plsql code:
declare
my_arr artbl;
whole NUM;
Start
my_arr: = apex_application.g_f01;
my_storedproc (my_arr, num);
end;
which give the error when you try to save
1 error has occurred
* ORA-06550: line 6, column 28: PLS 00382: expression is of the wrong type ORA-06550: line 6, column 4: PL/SQL: statement ignored
and
declare
my_arr artbl;
whole NUM;
Start
my_arr: = apex_application.g_f01 ();
my_storedproc (my_arr, num);
end;
which give the error when you try to save:
1 error has occurred
* ORA-06550: line 6, column 11: PLS-00355: table using pl/sql not allowed in this context ORA-06550: line 6, column 4: PL/SQL: statement ignored
The stored procedure is
create or replace PROCEDURE my_storedproc
(IN artbl, num ENTIRE tbl)
AS
BEGIN
BECAUSE me IN 1.num
LOOP
-carry out a few sentences making reference to elements - tbl
END LOOP;
END MTO_PRUEBA;
Can someone help me?
Thank you
jalbaJalba,
The error is the result of incompatible types. It seems that you have created your types in SQL (in the database) rather than in PL/SQL. You should simply reuse the existing type used in the APEX (see wwv_flow_global spec).
PROCEDURE my_storedproc
(IN artbl, num ENTIRE tbl)should be
PROCEDURE my_storedproc
(IN wwv_flow_global.vc_arr2, num ENTIRE tbl)Now you can call it as
declare
whole NUM;
Start
my_storedproc (apex_application.g_f01 (), num);
end;I hope this helps.
Greg
-
InstantClient SQL * more and glogin.sql
SQL * more the default behavior is to
(a) loading login.sql in the current directory
(b) if there is no, put glogin.sql in the + $ORACLE_HOME/sqlplus/admin / + directory
Note of support described the same behavior InstantClient (10g) in + Glogin.sql is not used with Instant Client [946528.1 ID] + too.
The solution to InstantClient 10g is simple. Define + $ORACLE_HOME + variable, it points to your instantclient directory and create the path and the file "+... / sqlplus/admin/glogin.» SQL +'.
However, this now seems to have changed with InstantClient 11 g. This is what the client:
He seeks login.sql in the current directory - as expected. But now, it seems also to glogin.sql in the current directory - and not in a common/shared as directory + $ORACLE_HOME/sqlplus/admin / +.stat64("login.sql", 0xbf9f2c14) = -1 ENOENT (No such file or directory) brk(0x856e000) = 0x856e000 stat64("glogin.sql", 0xbf9f2c14) = -1 ENOENT (No such file or directory)
Which is just silly IMO - like why do glogin.sql now behave like login.sql ? Wait until it is in the current working directory? What is 'global' subject and forced to have a glogin.sql in every single directory you have on your client, where you run SQL * more?
The correct behavior should be to determine the directory of the module (i.e. instantclient dir where sqlplus was executed) and then look for the glogin.sql in there.
Am I missing something here? The old behavior can be executed somehow? Or is there a workaround that can be used?Hi, for me
[http://docs.oracle.com/cd/B19306_01/server.102/b14357/ape.htm]
especialy:
The directory containing glogin.sql SQLPATH value. For example:
+SQLPath=/usr/lib/Oracle/10.2.0.1/client/lib:${SQLPath}+
Export SQLPATHworks great!
Maybe you are looking for
-
Printer will not work wireless
My printer has worked on my wireless network until a few days ago. Now it won't print or scan wireless. I tried to uninstall and reinstall. She appears as the default printer on the network, but the information said it needs in the event of a prob
-
HP Photo smart 5510: printers and all UNITS
After scanning, the background of the page came in gray and not in pure white. So I was running the printing software HP and doctor Scan. The gray background problem solved but new problem started. After scanning left and upper paper edge is done wit
-
Pavilion a1410n: HP A1410N cannot run win10
Wanted to update to WIN10, but he says the NVIDIA FeForce 6150 video THE is not compatible. Leave I better try to buy a new motherboard? If so who? or better just buying a new computer (uugh)? Thank you
-
changes to my laptop... Unhappy
My hp dv7 recently crashed on me. I had a friend of mine; who is a geek, help out me. Well now, my computer is just not the same. My fingerprint does not at all now, my beats audio isn't there anymore, and I'm sure there are other things that is n
-
Where in Windows 7, find the recent items menu?
Where can I find recent items menu which was on the main menu from Vista to Windows 7. * original title - how to enable recent items? *