Suppress Orcale script message dynamically [message #541275] |
Mon, 30 January 2012 04:35 |
|
arup_kc
Messages: 9 Registered: January 2012 Location: India
|
Junior Member |
|
|
Hi,
I wiuld like to suppress oracle messages conditionally. I am running oracle view creation scripts from command line, After successful view creation, it is showing me "view created" message. To suppress this, I have created following code:
set serveroutput on format wrapped;
SET TERMOUT OFF
@@test1.sql
SET TERMOUT ON
DECLARE I INTEGER:= 0;
BEGIN
SELECT COUNT(1) INTO I FROM ALL_VIEWS WHERE VIEW_NAME =UPPER('test831') AND OWNER ='MDBADMIN';
IF (I = 1) THEN
DBMS_OUTPUT.put_line('View test831 created successfully');
ELSE
DBMS_OUTPUT.put_line('View test831 NOT created');
END IF;
END;
but still it is giving me "PL/SQL procedure successfully created" message along with "'View test831 created successfully".
I need to suppress "PL/SQL procedure successfully created".
Any help is much appreciated.
|
|
|
|
|
Re: Suppress Orcale script message dynamically [message #541301 is a reply to message #541298] |
Mon, 30 January 2012 05:52 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
arup_kc wrote on Mon, 30 January 2012 11:44
However, probably you have not got the sense of that PL/SQL block
Pretty sure he has got the sense of it.
arup_kc wrote on Mon, 30 January 2012 11:44
That part is included to check whether that view has been created successfully(might be there are better ways to do so)
See if you got any errors. If not it created sucessfully. Querying the data dictionary is a waste of time.
arup_kc wrote on Mon, 30 January 2012 11:44
as per our coding standard.
Your coding standards state that you need to write code like that for every object created? Really?
|
|
|
|
Re: Suppress Orcale script message dynamically [message #541316 is a reply to message #541311] |
Mon, 30 January 2012 06:40 |
|
Michel Cadot
Messages: 68732 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:If there is any error in the view creation code, then I am getting error.Otherwise how could I know that there is an error at view creation level?
By not suppressiong the output SQL*Plus gives you.
If you "set termout off" then you can't see the error (on screen).
If you "set feedback on" then you don't see the result when it succeeds as well as it fails.
If you "set feedback off" then you see the result only if it fails:
SQL> set feedback on
SQL> create or replace view v as select * from t;
View created.
SQL> create or replace view v as select * from x;
create or replace view v as select * from x
*
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here
SQL> set feedback off
SQL> create or replace view v as select * from t;
SQL> create or replace view v as select * from x;
create or replace view v as select * from x
*
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here
Regards
Michel
|
|
|
|
|