Solved

Setting of Environment Variable inside a block..(Oracle)

Posted on 2000-05-07
7
821 Views
Last Modified: 2008-03-04
hi..
How do we set an environment variable inside a block(PL/SQL)?
I wish to include this small piece of statement (below)in my PL/SQL block..can i do it? I do not want to set it explicitly.?How to set it ?

SET SERVEROUT ON SIZE 100000
0
Comment
Question by:chincholikar
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:srikant033100
Comment Utility
hi

u can put this statement inside ur pl/sql block

create table a (a number);

spool abc.sql
set serveroutput on size 100000
begin
insert into a values(1);
end;
spool off

This file will run and put an record in the table.
0
 

Author Comment

by:chincholikar
Comment Utility
hi..

I think u have not understood my question.I just want to use this
(SET SERVEROUT ON SIZE 100000) statement inside my PL/SQL block.
Why do i need to un-necessary create a table and  insert rows in to it..
IF i use with in my PL/SQL block i get the below error...

 PLS-00103: Encountered the symbol "SERVEROUT" when expecting one
 of the following:
 transaction
0
 
LVL 4

Expert Comment

by:srikant033100
Comment Utility
hi

i know u dont want to create a table but first tell me that why u want to change the environmental variable in the pl/sql block. The example above will also serve ur purpose ok it is not inside the block but still it is tightly with it and should solve ur problem and lastly why to u need it.

Srikant Sarda
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Accepted Solution

by:
kravicp earned 5 total points
Comment Utility
SERVEROUTPUT is SQL+ variable it is not the standard SQL. it is provided by oracle as a variable to set the output of any progarm to the standard output device.
this cnnot be used inside a pl/sql block b'cas in pl/sql block u can use only standard SQL. to get the out of ur program to the standard output device use DBMS_OUTPUT.PUT_LINE function.
0
 

Author Comment

by:chincholikar
Comment Utility
hi..

My question was if i cannot use this functionality with in PL/SQL block..Then how will i solve my problem.
The only thing i wish to say is I do not wish to write explicitly
SET SERVEROUT ON SIZE 100000 on sql prompt...
0
 

Expert Comment

by:kravicp
Comment Utility
hi,
i think this answer will solve ur problem.
change the Glogin.sql file in ur ORACLE_HOME/sqlplus/admin directory.
add set SERVEROUTPUT on
0
 

Author Comment

by:chincholikar
Comment Utility
hi..kravicp

Thanks for the solution.Anyway I wanted to set thru PL/SQL block..but u said its not possible as it is not Standard SQL.It worked when i added SET SERVEROUT ON SIZE 100000 in glogin.sql file.Anyway thanks for the answer.

ALLOT 05 POINTS TO MR.KRAVICP.

Regards,
Girish Chincholikar.
India.

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now