Solved

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

Posted on 2000-05-07
7
828 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Title # Comments Views Activity
SQL query for highest sequence 4 75
subtr returning incorrect value 8 96
SQL Syntax Question 9 56
ORA-01843: not a valid month - use NVL 14 19
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

739 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