dbTalk Databases Forums  

Problem with a procedure

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Problem with a procedure in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mowinom@hotmail.com
 
Posts: n/a

Default Problem with a procedure - 04-08-2008 , 11:26 AM






Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark


CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
CURSOR kk
IS
SELECT object_name FROM USER_POLICIES;
ka kk%ROWTYPE;
BEGIN
OPEN kk;
LOOP
FETCH kk
INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
IF x.table_name NOT IN (ka.object_name)
THEN
DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
END IF;
End loop;
EXIT WHEN kk%NOTFOUND;
END LOOP;
CLOSE kk;
END;


SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

....
....

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1

Reply With Quote
  #2  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 12:06 PM






On Apr 8, 11:26*am, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
* *CURSOR kk
* *IS
* * *SELECT object_name FROM *USER_POLICIES;
* *ka * * * * * * *kk%ROWTYPE;
BEGIN
* *OPEN kk;
* *LOOP
* * * FETCH kk
* * * *INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
* * * * *IF x.table_name NOT IN (ka.object_name)
* * * * *THEN
* * * * * * DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
* * * * *END IF;
* * * * End loop;
* * * * *EXIT WHEN kk%NOTFOUND;
* * *END LOOP;
* * *CLOSE kk;
END;

SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

...
...

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1
By default the output buffer for dbms_output is 2000 bytes; it can be
set as high as 1000000 bytes:

set serveroutput on size 1000000

Execute the above command then run your procedure; unless you have
1000000 bytes of data loaded before your procedure completes its
processing you won't see the error you've posted.


David Fitzjarrell


Reply With Quote
  #3  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 12:06 PM



On Apr 8, 11:26*am, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
* *CURSOR kk
* *IS
* * *SELECT object_name FROM *USER_POLICIES;
* *ka * * * * * * *kk%ROWTYPE;
BEGIN
* *OPEN kk;
* *LOOP
* * * FETCH kk
* * * *INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
* * * * *IF x.table_name NOT IN (ka.object_name)
* * * * *THEN
* * * * * * DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
* * * * *END IF;
* * * * End loop;
* * * * *EXIT WHEN kk%NOTFOUND;
* * *END LOOP;
* * *CLOSE kk;
END;

SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

...
...

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1
By default the output buffer for dbms_output is 2000 bytes; it can be
set as high as 1000000 bytes:

set serveroutput on size 1000000

Execute the above command then run your procedure; unless you have
1000000 bytes of data loaded before your procedure completes its
processing you won't see the error you've posted.


David Fitzjarrell


Reply With Quote
  #4  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 12:06 PM



On Apr 8, 11:26*am, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
* *CURSOR kk
* *IS
* * *SELECT object_name FROM *USER_POLICIES;
* *ka * * * * * * *kk%ROWTYPE;
BEGIN
* *OPEN kk;
* *LOOP
* * * FETCH kk
* * * *INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
* * * * *IF x.table_name NOT IN (ka.object_name)
* * * * *THEN
* * * * * * DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
* * * * *END IF;
* * * * End loop;
* * * * *EXIT WHEN kk%NOTFOUND;
* * *END LOOP;
* * *CLOSE kk;
END;

SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

...
...

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1
By default the output buffer for dbms_output is 2000 bytes; it can be
set as high as 1000000 bytes:

set serveroutput on size 1000000

Execute the above command then run your procedure; unless you have
1000000 bytes of data loaded before your procedure completes its
processing you won't see the error you've posted.


David Fitzjarrell


Reply With Quote
  #5  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 12:06 PM



On Apr 8, 11:26*am, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
* *CURSOR kk
* *IS
* * *SELECT object_name FROM *USER_POLICIES;
* *ka * * * * * * *kk%ROWTYPE;
BEGIN
* *OPEN kk;
* *LOOP
* * * FETCH kk
* * * *INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
* * * * *IF x.table_name NOT IN (ka.object_name)
* * * * *THEN
* * * * * * DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
* * * * *END IF;
* * * * End loop;
* * * * *EXIT WHEN kk%NOTFOUND;
* * *END LOOP;
* * *CLOSE kk;
END;

SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

...
...

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1
By default the output buffer for dbms_output is 2000 bytes; it can be
set as high as 1000000 bytes:

set serveroutput on size 1000000

Execute the above command then run your procedure; unless you have
1000000 bytes of data loaded before your procedure completes its
processing you won't see the error you've posted.


David Fitzjarrell


Reply With Quote
  #6  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 01:53 PM



On Apr 8, 12:26 pm, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
CURSOR kk
IS
SELECT object_name FROM USER_POLICIES;
ka kk%ROWTYPE;
BEGIN
OPEN kk;
LOOP
FETCH kk
INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
IF x.table_name NOT IN (ka.object_name)
THEN
DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
END IF;
End loop;
EXIT WHEN kk%NOTFOUND;
END LOOP;
CLOSE kk;
END;
Why are you doing in PL/SQL what can be done in straight SQL?
this is a simple not in query, like this:

SELECT v.table_name
FROM vpd_tabell_v v
WHERE v.table_name NOT IN
( SELECT u.table_name from user_policies u );

It can be written as a MINUS operation and as an outer join also.
Here's the outer join:

SELECT v.table_name
FROM vpd_tabell_v v, user_policies u
WHERE v.table_name=u.table_name(+)
AND u.table_name is null ;

Then you don't have to worry about the server buffer for PL/SQL
output. Just an example of picking the right tool for the job.

--
Magic Interface, Ltd.
www.magicinterface.com
440-498-3700
Hardware/Software Alchemy


Reply With Quote
  #7  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 01:53 PM



On Apr 8, 12:26 pm, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
CURSOR kk
IS
SELECT object_name FROM USER_POLICIES;
ka kk%ROWTYPE;
BEGIN
OPEN kk;
LOOP
FETCH kk
INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
IF x.table_name NOT IN (ka.object_name)
THEN
DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
END IF;
End loop;
EXIT WHEN kk%NOTFOUND;
END LOOP;
CLOSE kk;
END;
Why are you doing in PL/SQL what can be done in straight SQL?
this is a simple not in query, like this:

SELECT v.table_name
FROM vpd_tabell_v v
WHERE v.table_name NOT IN
( SELECT u.table_name from user_policies u );

It can be written as a MINUS operation and as an outer join also.
Here's the outer join:

SELECT v.table_name
FROM vpd_tabell_v v, user_policies u
WHERE v.table_name=u.table_name(+)
AND u.table_name is null ;

Then you don't have to worry about the server buffer for PL/SQL
output. Just an example of picking the right tool for the job.

--
Magic Interface, Ltd.
www.magicinterface.com
440-498-3700
Hardware/Software Alchemy


Reply With Quote
  #8  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 01:53 PM



On Apr 8, 12:26 pm, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
CURSOR kk
IS
SELECT object_name FROM USER_POLICIES;
ka kk%ROWTYPE;
BEGIN
OPEN kk;
LOOP
FETCH kk
INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
IF x.table_name NOT IN (ka.object_name)
THEN
DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
END IF;
End loop;
EXIT WHEN kk%NOTFOUND;
END LOOP;
CLOSE kk;
END;
Why are you doing in PL/SQL what can be done in straight SQL?
this is a simple not in query, like this:

SELECT v.table_name
FROM vpd_tabell_v v
WHERE v.table_name NOT IN
( SELECT u.table_name from user_policies u );

It can be written as a MINUS operation and as an outer join also.
Here's the outer join:

SELECT v.table_name
FROM vpd_tabell_v v, user_policies u
WHERE v.table_name=u.table_name(+)
AND u.table_name is null ;

Then you don't have to worry about the server buffer for PL/SQL
output. Just an example of picking the right tool for the job.

--
Magic Interface, Ltd.
www.magicinterface.com
440-498-3700
Hardware/Software Alchemy


Reply With Quote
  #9  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Problem with a procedure - 04-08-2008 , 01:53 PM



On Apr 8, 12:26 pm, mowi... (AT) hotmail (DOT) com wrote:
Quote:
Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
CURSOR kk
IS
SELECT object_name FROM USER_POLICIES;
ka kk%ROWTYPE;
BEGIN
OPEN kk;
LOOP
FETCH kk
INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
IF x.table_name NOT IN (ka.object_name)
THEN
DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
END IF;
End loop;
EXIT WHEN kk%NOTFOUND;
END LOOP;
CLOSE kk;
END;
Why are you doing in PL/SQL what can be done in straight SQL?
this is a simple not in query, like this:

SELECT v.table_name
FROM vpd_tabell_v v
WHERE v.table_name NOT IN
( SELECT u.table_name from user_policies u );

It can be written as a MINUS operation and as an outer join also.
Here's the outer join:

SELECT v.table_name
FROM vpd_tabell_v v, user_policies u
WHERE v.table_name=u.table_name(+)
AND u.table_name is null ;

Then you don't have to worry about the server buffer for PL/SQL
output. Just an example of picking the right tool for the job.

--
Magic Interface, Ltd.
www.magicinterface.com
440-498-3700
Hardware/Software Alchemy


Reply With Quote
  #10  
Old   
mowinom@hotmail.com
 
Posts: n/a

Default Re: Problem with a procedure - 04-09-2008 , 02:41 AM



On Apr 8, 7:06*pm, "fitzjarr... (AT) cox (DOT) net" <orat... (AT) msn (DOT) com> wrote:
Quote:
On Apr 8, 11:26*am, mowi... (AT) hotmail (DOT) com wrote:





Hi all,

I have two tables; vpd_tabell_v and USER_POLICIES.

vpd_tabell_v contains all the table names that we plan to secure with
VPD while the table USER_POLICIES has all the tables that have already
been secured with VPD. What I am trying to do is find out in
vpd_tabell_v which tables have not been secured yet then print them
out.

I've written the procedure below to assist in achieving this. It
compiles fine but when I run it, it does not supply the desired
result. Any help is greatly appreciated.

--
Mark

CREATE OR REPLACE PROCEDURE p_add_vpd_34
IS
* *CURSOR kk
* *IS
* * *SELECT object_name FROM *USER_POLICIES;
* *ka * * * * * * *kk%ROWTYPE;
BEGIN
* *OPEN kk;
* *LOOP
* * * FETCH kk
* * * *INTO ka;
for x in ( SELECT table_name FROM vpd_tabell_v ) loop
* * * * *IF x.table_name NOT IN (ka.object_name)
* * * * *THEN
* * * * * * DBMS_OUTPUT.put_line ('Table name: '||x.table_name);
* * * * *END IF;
* * * * End loop;
* * * * *EXIT WHEN kk%NOTFOUND;
* * *END LOOP;
* * *CLOSE kk;
END;

SQL> exec p_add_vpd_34
Table name: Person
Table name: Dept
Table name: Section
Table name: Location
Table name: Hr
Table name: Deployment

...
...

Table name: Salaries

BEGIN p_add_vpd_34; END;

*
Error on line 1 1:
ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
ORA-06512: at "SYS.DBMS_OUTPUT", line 32
ORA-06512: at "SYS.DBMS_OUTPUT", line 97
ORA-06512: at "SYS.DBMS_OUTPUT", line 112
ORA-06512: at "P_ADD_VPD_34", line 16
ORA-06512: at line 1

By default the output buffer for dbms_output is 2000 bytes; it can be
set as high as 1000000 bytes:

set serveroutput on size 1000000

Execute the above command then run *your procedure; unless you have
1000000 bytes of data loaded before your procedure completes its
processing you won't see the error you've posted.

David Fitzjarrell- Hide quoted text -

- Show quoted text -
Thanks David for the tip on extending the size of the output buffer.
However, I this example that was not the main problem (a derived
problem may be) because the bigger table has only 51 records in it.

--
Mark


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.