Solved

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

Posted on 2000-05-07
7
826 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
ID: 2787290
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
ID: 2787946
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
ID: 2787972
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
ID: 2791062
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
ID: 2791777
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
ID: 2791996
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
ID: 2792151
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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
This video shows how to recover a database from a user managed backup

860 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