Privileges to EXECUTE IMMEDIATE
Hi all,
In PL/SQL code, I am getting error msg : " ORA-01031 Insufficient privileges " for EXECUTE IMMEDIATE 'CREATE TABLE ...' .
which grants I have to provide for the same ?
FYI that I can create a same table from same schema name using SQL prompt.
Thanks & regards
sanjay
Did you get the create table privilage through a role? You need a direct grant of the create table privilage if you want to create tables in a PL/SQL procedure using execute immediate.
Consider:
SYS> create user tab identified by tab default tablespace users quota unlimited on users;
User created.
SYS> create role create_tab;
Role created.
SYS> grant create table to create_tab;
Grant succeeded.
SYS> grant create procedure to create_tab;
Grant succeeded.
SYS> grant create session to tab;
Grant succeeded.
SYS> grant create_tab to tab;
Grant succeeded.
SYS> @reconn tab;
Connected.
Session altered.
Session altered.
Session altered.
TAB> create table test1(id number);
Table created.
TAB> begin
2 execute immediate 'create table test2(id number)';
3 end;
4 /
PL/SQL procedure successfully completed.
TAB> create or replace procedure create_tab as
2 begin
3 execute immediate 'create table test3(id number)';
4 end;
5 /
Procedure created.
TAB> exec create_tab;
BEGIN create_tab; END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "TAB.CREATE_TAB", line 3
ORA-06512: at line 1
TAB> conn sys/oracle as sysdba
Connected.
Session altered.
Session altered.
Session altered.
SYS> grant create table to tab;
Grant succeeded.
SYS> @reconn tab;
Connected.
Session altered.
Session altered.
Session altered.
TAB> exec create_tab;
PL/SQL procedure successfully completed.as you can see you need a direct grant of create table to do this in PL/SQL stored procedures.
cheers
Similar Messages
-
Insufficient privileges using execute immediate in after logon trigger
I have an after logon trigger that executes a package/procedure in the schema it was created in.
One of the procedures runs the following:
EXECUTE IMMEDIATE 'AUDIT INSERT TABLE, UPDATE TABLE, DELETE TABLE, EXECUTE PROCEDURE BY ' || USER;
The procedure is throwing an insufficient privileges error when executing this.
However - the schema owner has audit any and audit system privileges and - the statement works fine independently.
When I login as another user this issue arises. The package/procedure are created with definers rights... So - i'm not sure why this is happenening.
Any help is appreciated.privileges acquired via ROLE do NOT apply within named PL/SQL procedures.
SQL> SET ROLE NONE
SQL> --issue AUDIT again now -
I want to mirror a schema to a existing schema by creating DDL and recreate on the other schema with same name.
I wrote the code below:
create or replace
PROCEDURE SCHEMA_A."MAI__DWHMIRROR"
AS
v_sqlstatement CLOB:='bos';
str varchar2(3999);
BEGIN
select
replace(
replace(replace(
replace(DBMS_METADATA.GET_DDL('TABLE','XXXX','SCHEMA_A'),'(CLOB)',''),';','')
,'SCHEMA_A'
,'SCHEMA_B'
into v_sqlstatement
from dual;
select CAST(v_sqlstatement AS VARCHAR2(3999)) into str from dual;
execute immediate ''||str;
END;
And Executing this block with below code:
set serveroutput on
begin
SCHEMA_A.MAI__DWHMIRROR;
end;
But still getting the following error code:
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "SCHEMA_A.MAI__DWHMIRROR", line 47
ORA-06512: at line 2
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.user5199319 wrote:
USER has DBA Role
when all else fails Read The Fine Manual
DBMS_METADATA -
Hi,
I have wrote one SP in which i have used execute immediate to execute DML statements. On UAT Database its working fine..but on production its not working..
Kindly tell me what privileges need to execute this(execute immediate) statement.
Edited by: Neha RK on Apr 25, 2013 1:54 AMYou don't need any special privileges to use execute immedate. Proof:
C:\>sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 25 12:05:50 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user foo identified by foo;
User created.
SQL> grant create session to foo;
Grant succeeded.
SQL> connect foo/foo
Connected.
SQL> begin
2 execute immediate 'begin null; end;';
3 end;
4 /
PL/SQL procedure successfully completed.
SQL>
However, you (you meaning the owner of the procedure or the user executing the procedure, depending upon whether procedure is AUTHID definer or current user) need whatever permissions are required for the actual statement being executed. Proof:
SQL> begin
2 execute immediate 'delete from hr.employees';
3 end;
4 /
begin
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at line 2 -
Execute immediate : insuficient privileges
Hello,
I've got this procedure in schema SYSTEM :
create procedure test_create_table
is
begin
execute immediate 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';
end;
And when I execute it :
SQL> execute test_create_table;
BEGIN test_create_table; END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYSTEM.TEST_CREATE_TABLE", line 4
ORA-06512: at line 1
What is the problem ?
System have got DBA privileges and can create a table.
FabienneI think the problem is that DBA privilege is a ROLE and stored procedures do not recognize privileges given to roles. Try granting create table direct to SYSTEM.
-
Problem wile EXECUTE IMMEDIATE DDL statement in procedure
Hi ,
This is my procedure and it's getting compiled but while executing procedure getting this error,
can anyone please tell me how to fix this?
create or replace procedure construct_Table (name_table IN VARCHAR2)
IS
v_tab_name varchar2(40):=NULL;
v_sql_Stmt varchar2(32767) := NULL;
finalquery varchar2(32767) :=NULL;
cursor tp is
select COLUMN_NAME,DATA_TYPE,DATA_PRECISION,CHAR_LENGTH from all_tab_cols where table_name=name_table;
BEGIN
begin
select TABLE_NAME into v_tab_name from user_tables where table_name=name_table;
EXCEPTION
WHEN no_Data_found
THEN
DBMS_OUTPUT.PUT_LINE('No such table exist');
end;
if(v_tab_name IS NOT NULL)then
finalquery := 'CREATE TABLE '||v_tab_name||'_DUMMY (';
FOR I IN tp LOOP
if(I.data_type='VARCHAR2') then
v_sql_stmt := finalquery ||I.column_name||' '||I.data_type||'('||I.char_length||') ';
elsif(I.data_type='NUMBER') then
v_sql_stmt := finalquery ||I.column_name||' '||I.data_type||'('||I.DATA_PRECISION ||') ';
else
v_sql_stmt := finalquery ||I.column_name||' '||I.data_type ;
end if;
finalquery := v_sql_stmt || ',';
END LOOP;
finalquery := SUBSTR(finalquery,1,LENGTH(finalquery) - 1)||')';
dbms_output.put_line(finalquery);
EXECUTE IMMEDIATE'grant create any table to cmsuser';
EXECUTE IMMEDIATE finalquery;
end if;
END;
/This is the error I am getting
Error starting at line 1 in command:
begin
construct_Table ('EMP');
end;
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "CMSUSER.CONSTRUCT_TABLE", line 30
ORA-06512: at line 2
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.Thanks ,
Deekay.Deekay,
If you grant create table privilege and create table in the same procedure, then how you will differentiate that which user you granted the privilege and in which schema, you are creating the table. Here, you are granting to "cmuser", but in the same schema, you are creating the table also. How can a user grant privilege to himself?
Login as DBA, grant create any table privilege to "cmuser" from dba. Then, you can execute you procedure in "cmuser" schema. -
EXECUTE IMMEDIATE dynamic statement and return procedure value
Hello guys,
How can i return values from procedure using EXECUTE IMMEDIATE statment?
I made easy example:
CREATE OR REPLACE PACKAGE pac_test
IS
PROCEDURE pro_calc_average( p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER,
v_out OUT NUMBER);
PROCEDURE pro_calc(p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER);
END;
CREATE OR REPLACE PACKAGE BODY pac_test
IS
PROCEDURE pro_calc_average( p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER,
v_out OUT NUMBER)
IS
BEGIN
v_out:=(p_age_1+p_age_2+p_age_3)/3;
END pro_calc_average;
PROCEDURE pro_calc(p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER)
IS
x number;
v_sql varchar2(4000);
BEGIN
v_sql:='pac_test.pro_calc_average('||p_age_1||','||p_age_2||','||p_age_3||',x)';
dbms_output.put_line(v_sql);
EXECUTE IMMEDIATE v_sql;
dbms_output.put_line(' ====> '||x);
END pro_calc;
END;
-- Run procedures [Faild]
EXEC pac_test.pro_calc(2,9,19);
When i run:
DECLARE
x number;
BEGIN
pac_test.pro_calc_average(2,9,9,x);
dbms_output.put_line(' ====> '||x);
END;
It's works, but this is not what i am looking for.
Thank you guys,
Sam.Hi Sam,
Like this?
CREATE OR REPLACE PACKAGE pac_test
IS
pac_var number; /* added new*/
PROCEDURE pro_calc_average( p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER,
v_out OUT NUMBER);
PROCEDURE pro_calc(p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER);
END;
CREATE OR REPLACE PACKAGE BODY pac_test
IS
PROCEDURE pro_calc_average( p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER,
v_out OUT NUMBER)
IS
BEGIN
v_out:=(p_age_1+p_age_2+p_age_3)/3;
END pro_calc_average;
PROCEDURE pro_calc(p_age_1 IN NUMBER,
p_age_2 IN NUMBER,
p_age_3 IN NUMBER)
IS
pack_local_var number;
v_sql varchar2(4000);
BEGIN
--v_sql:='pac_test.pro_calc_average('||p_age_1||','||p_age_2||','||p_age_3||',x)';
v_sql:=' declare x number; begin pac_test.pro_calc_average('||p_age_1||','||p_age_2||','||p_age_3||',x);
dbms_output.put_line(x);
pac_test.pac_var:=x; /* added new*/
end;';
dbms_output.put_line(v_sql);
EXECUTE IMMEDIATE v_sql;
pack_local_var:=pac_var; /* added new*/
dbms_output.put_line(pack_local_var); /* added new*/
END pro_calc;
END;Declared a package variable.
But be aware this variable is accessible to everyone and they can read or change its value if they have the right privileges.
REgards,
Bhushan -
**URGENT** Problem using execute immediate in a procedure ...
Hi all,
I am writing this procedure
create or replace procedure pr_test is
begin
EXECUTE IMMEDIATE 'CREATE or replace view test1 as select * from table_name';
end ;
when I execute this procedure even in the same schema who owns this table it gives me this message.
BEGIN pr_test; END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "COLIS.PR_TEST", line 3
ORA-06512: at line 1
can any body lets me know the solution????
Thanks in advance
Take Care !
GhulamThank you very much fellows.
But I have reached at this point that one has to have create view privellege explicitly to create view using a dynamic sql statemetn. Actually I could create the view using SQL*Plus and every thing was working fine through SQL*Plus. But I granted the rights of create user from a user having DBA role.
Anyways! Thank you very much for contributing this discussion. I really appreciate it.
Ghulam Mustafa Butt -
Using EXECUTE IMMEDIATE with Create Table SQL Statement not working
Hi ,
I am all the privileges given from the SYSTEM user , but still i am not able to create a table under procedure . Please see these and advice.
create or replace procedure sp_dummy as
begin
Execute Immediate 'Create table Dummy99_99 (Dummy_Field number)';
end;
even i tried this way also
create or replace PROCEDURE clearing_Practise(p_file_id in varchar2, p_country in VARCHAR2,p_mapId in VARCHAR2)
AUTHID CURRENT_USER AS
strStatusCode VARCHAR2(6);
BEGIN
EXECUTE IMMEDIATE 'create table bonus(name varchar2(50))';
commit;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR Creating Table');
END ;William Robertson wrote:
Since the syntax is correct, my guess is you do not have CREATE TABLE system privilege granted directly to your account. A common scenario is that you have this privilege granted indirectly via a role, allowing you to create tables on the command line, but stored PL/SQL is stricter and requires a direct grant and therefore the procedure fails with 'insufficient privileges'.A bit like he's already been told on his first thread...
Using of Execute Immediate in Oracle PLSQL
Generally you would not create tables from stored PL/SQL. Also as you have found out, it's best not to hide exceptions with 'WHEN OTHERS THEN [some message which gives less detail than the one generated by Oracle]'.Again like he was told on the other thread.
There's just no telling some people eh! :) -
Unable to execute EXECUTE IMMEDIATE statement in a stored procedure...
Hi People,
I use oracle 10g.In which i tried a procedure with follwing code and am thrown with the error that says,
SQL> create or replace procedure ptable(ptab varchar2) is
2 lstmt varchar(200);
3 begin
4 lstmt:='CREATE TABLE '||ptab||'(a int,b varchar2(30)) ';
5 execute immediate lstmt;
6 end;
7 /
Procedure created.
SQL> exec ptable('hos');
BEGIN ptable('hos'); END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "VIDYA.PTABLE", line 5
ORA-06512: at line 1Procedure has been created but error occurs while executing it.why do i get this error even though i possess DBA privilege?.which permission is lagging for me?.help me with ur suggestions.thanks in advance.
With Regards
VIDSYep Yep.Perfect.It was the CREATE ANY TABLE privilege which i was lagging.I granted it to my schema and now got created with the table.Thanku so much for such a quick reply :).
With Regards
VIDS -
Can't create a sequence within a pl/sql block with execute immediate.
Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
Thanks,
MarkIn a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
Justin -
Urgent query related to execute immediate in a procedure.
hi,
I want to create a table in the production database,within a procedure so I write query like:
CREATE OR REPLACE PROCEDURE TEST
IS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE PE.BUD_VS_REV AS SELECT * FROM WH.WH_BUD_VS_REVNM1';
END;
but this is not working within the procedure it gives the
ORA-01031: insufficient privileges.
I already have asked to DBA he said that this user has all previlidges.
one more thing if I write this query in an annonymous block like:
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE PE.BUD_VS_REV AS SELECT * FROM WH.WH_BUD_VS_REVNM1';
END;
its working well.
can any buddy tellme what can be the reason,actually.
Thanx
Ritesh!Look this example:
DBA >> CREATE USER LEO IDENTIFIED BY LEO
2 /
User created.
DBA >> GRANT CREATE SESSION TO LEO
2 /
Grant succeeded.
LEO >> CREATE OR REPLACE PROCEDURE TEST
2 IS
3 BEGIN
4 EXECUTE IMMEDIATE 'CREATE TABLE PE.BUD_VS_REV AS SELECT * FROM WH.WH_BUD_VS
_REVNM1';
5 END;
6 /
CREATE OR REPLACE PROCEDURE TEST
ERROR at line 1:
ORA-01031: insufficient privileges
DBA >> GRANT CREATE ANY PROCEDURE TO LEO
2 /
Grant succeeded.
LEO >> CREATE OR REPLACE PROCEDURE TEST
2 IS
3 BEGIN
4 EXECUTE IMMEDIATE 'CREATE TABLE PE.BUD_VS_REV AS SELECT * FROM WH.WH_BUD_VS
_REVNM1';
5 END;
6 /
Procedure created. -
Variable contents inside "EXECUTE IMMEDIATE" not working properly.
Hello,
I have the following package:
CREATE OR REPLACE PACKAGE "BACKUP"."PKG_BACKUP"
IS
PROCEDURE BACKUP_TABLE (TABLE_NAME IN VARCHAR);
END PKG_BACKUP;
CREATE OR REPLACE PACKAGE BODY "BACKUP"."PKG_BACKUP"
IS
PROCEDURE BACKUP_TABLE (TABLE_NAME IN VARCHAR) IS
MYDATE VARCHAR(10);
BEGIN
MYDATE := to_char(sysdate,'YYYYMMDD');
DBMS_OUTPUT.PUT_LINE(' Backing up '||TABLE_NAME||' table...');
EXECUTE IMMEDIATE 'CREATE TABLE "BACKUP"."'||TABLE_NAME||'_'||MYDATE||'" AS SELECT * FROM "MYSCHEMA"."'||TABLE_NAME||'" COMPRESSED';
END backup_table;
END "PKG_BACKUP";
/However, every time I execute it I get the following error:
SQL> exec BACKUP.PKG_BACKUP.BACKUP_TABLE('POOL');
** Backing up POOL table...*
BEGIN BACKUP.PKG_BACKUP.BACKUP_TABLE('POOL'); END;
ERROR at line 1:
ORA-00942: table or view does not exist
*ORA-06512: at "BACKUP.PKG_BACKUP
", line 9*
*ORA-06512: at line 1*
Table does exist and user executing the statement has the proper privileges (i've even executed the contents of "execute immediate" by hand and it works fine)
What am I missing?
Thanks in advance.SQL> CREATE OR REPLACE PACKAGE pkg_backup AUTHID CURRENT_USER
2 IS
3 PROCEDURE backup_table (table_name IN VARCHAR);
4 END pkg_backup;
5 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY PKG_BACKUP
2 IS
3 PROCEDURE backup_table (table_name IN VARCHAR)
4 IS
5 mydate VARCHAR (10);
6 BEGIN
7 mydate := TO_CHAR (SYSDATE, 'YYYYMMDD');
8 DBMS_OUTPUT.put_line (' Backing up ' || table_name || ' table...');
9
10 EXECUTE IMMEDIATE 'CREATE TABLE BACKUP'||table_name||'_'||mydate||' AS SELECT * FROM '|| table_name || ' COMPRESSED';
11 END backup_table;
12 END PKG_BACKUP;
13 /
Package body created.
SQL> EXEC PKG_BACKUP.backup_table('EMP');
Backing up EMP table...
PL/SQL procedure successfully completed.
SQL> SELECT * FROM BACKUPEMP_20090130;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.Edited by: user10594152 on Jan 30, 2009 5:18 PM
Edited by: user10594152 on Jan 30, 2009 5:19 PM -
Using execute immediate creating a table from another
hi friend i wanted to create a table from a select statement in a pl sql procedure. i am using execute immediate but getting problems with it pls can anyone help me.
here is the query i am using
EXECUTE IMMEDIATE 'CREATE TABLE table_name AS (SELECT * FROM a_view WHERE column_name LIKE '%some_string%');
i need to know if this can be done and if yes how. pls help me its bit urgent too. the schema name is same and the privileges are available to create tables too.Your syntax is wrong.
If you would use a syntax higlighted editor, it would show.
Yout try to execute a string where another string is embedded. Please use two times single quote or use the 'q' function:
This one is correct:
EXECUTE IMMEDIATE 'CREATE TABLE table_name AS (SELECT * FROM a_view WHERE column_name LIKE ''%some_string%'')';
or this one:
EXECUTE IMMEDIATE q'|CREATE TABLE table_name AS (SELECT * FROM a_view WHERE column_name LIKE '%some_string%')|';
good luck -
Failure of EXECUTE IMMEDIATE when in a stored procedure
Hello,
this concerns behaviour observed in Oracle 10g on Windows.
As user "system", I execute from the command line the following:
SQL> select COUNT(1) from sys.dba_sequences;
COUNT(1)
645
Again I try the same thing from the command line:
SQL> declare
2 CNT INTEGER:=0;
3 STMT VARCHAR2(300);
4 BEGIN
5 STMT:='select COUNT(1) from SYS.DBA_SEQUENCES';
6 EXECUTE IMMEDIATE STMT INTO CNT;
7 dbms_output.put_line('CNT='||CNT);
8 end;
9 /
CNT=645
So far so good, clearly this table exists and I have sufficient privileges to access SYS.DBA_SEQUENCES as user system.
However, if I put this in a stored procedure in a script TEST_SEQ.sql and then execute, I get ORA-00942:
1. Create or replace Procedure TEST_A1
2. IS
3. CNT INTEGER:=0;
4. STMT VARCHAR2(300);
5.
6. BEGIN
7. STMT:='select COUNT(1) from SYS.DBA_SEQUENCES';
8. EXECUTE IMMEDIATE STMT INTO CNT;
9. dbms_output.put_line('CNT='||CNT);
10. END;
SQL> @ TEST_SEQ.sql
SQL> exec TEST_A1;
ORA-00942: Table or view does not exist
ORA-06512: At "SYSTEM.TEST_A1", line 8
ORA-06512: At line 1
Why now does this table not seem to exist when accessed from a stored procedure?http://www.google.com/search?btnG=1&q=ora-0942+procedure
Sybrand Bakker
Senior Oracle DBA
Experts: those who do read documentation.
Maybe you are looking for
-
I have an external hard disk of 319.73 GB that I use as back up memory and where I put all the movies and other files that I can't leave on the computer as they occupy too much memory space . One day I was deleting all the previous dated back up to h
-
Itunes missing msvcr80.dll
I have tried to repair my iTunes install on a Windows 8 machine and gotten this message. Help?
-
When I try to set default font on my JMenuBar like this: javax.swing.UIManager.put("JMenuBar.font",new Font("Verdana",Font.PLAIN, 14)); nothing happens? Can someone help me with this.
-
Any time I plug my X-Fi into my PC I lose my wireless connection to my Belkin router which is a pain 'cos I can't leave it plugged in and download my podcasts. I'm using a 3D Reach Wireless key. Anyone any suggestions? Wardie
-
Exported Flash JPEG sequence out of sync in Premiere Pro
What I have: CS6 version of Flash Pro and Premiere Pro. Uncompressed audio in .wav format at 44100hz What I am doing: Importing the .wav file to stage in flash pro. Creating animations based on the audio at 24fps Exporting the animation as JPEG seque