SQL *Plus input buffer
I have a large script that works fine on my oracle server. When I bring it to my clients, it gets truncated after around 60 lines. I know how to increase the output buffer (EXEC DBS_Output.Enable(10000) for 10000 lines) but I can't seem to find the equivalent for the input buffer. Please help.
Are you using SQL Plus client, then you need to change the buffer size on the menu of the SQL Plus window.
Similar Messages
-
Use file as sql*plus input
Can I use a file as sql*plus input?
I have a query like below:
select * from employees
where deptno = &1
and job = &2
It will prompt me for the values of course.
I can execute it at the command line like below:
sql>@script.sql 10 salesrep
Is is possible to put the values in a file and call the script like below:
sql>@script.sql <filename>
Then this file could be in a directory in the OS and I can add any values to it.
thanks.Hi,
The following script reads a 1-line file and puts its contents into the substitution variable &file_contents:
COLUMN file_contents_col NEW_VALUE file_contents
SELECT TRANSLATE ( '
@&1
, 'A' || CHR (10) || CHR (13)
, 'A'
) AS file_contents_col
FROM dual;So, if my_params.txt contains
10 salesrepthen you can say:
@read_file my_params.txt
@script.sql &file_contentsYou can generalize this by putting the two lines above into a file called caswf.sql:
@read_file &2
@&1 &file_contentsand call it like this
@caswf script.sql my_params.txt"Caswf" is a Welsh word that means "call any script with file". -
SQL/Plus screen buffer width
How do I set the screen buffer width in SQL/Plus other than going to Options->Environment->Screen Buffer->Buffer Width? I want to be able to change this programatically within a script but I can't figure it out.
I don't think you can. It's part of the Windows user interface not part of the SQL*Plus parameter set. If it doesn't appear in a SHOW ALL listing then I doubt you change change it in a script.
Richard -
Semicolon and / in SQL Plus scripts?
Anyone,
Seem to have some confusion over the use of / and ; inside PL SQL Scripts run in SQL Plus.
I seem to get two commits thereby two rows on INSERT clase that has a ; and a /.
i.e.
/* Insert record into table for recording statistics on the runtime of this script */
INSERT INTO MYTABLE ( col1, col2) VALUES ( value1, value2);
COMMIT;
/The above will get two of the same rows in the table. Is this an issue with SQL Plus settings? What do people typically use? I have a combination of SQL and DDL in my scripts and I need / for the DDL typically as I understand. How do othere intermix these and what standard is used.Dave, here are the very basics.
The SQL language does not have command separators as only a single command at a time can be issued. Thus the following is invalid SQL:
SELECT * FROM emp;
The semicolon as command separator (or terminator) is not valid SQL. This is valid SQL:
SELECT * FROM emp
PL/SQL is a programming language similar to Pascal, C and Java. Multiple commands are used in a program. These need to be separated so that the parser/compiler can know where a command starts and where it ends. In PL/SQL the semicolon is used.
The following is invalid PL/SQL as it is missing command separators:
declare
i integer
begin
i := 1234
endThe following is valid PL/SQL :
declare
i integer;
begin
i := 1234;
end;SQL*Plus is an Oracle CLI (command line interface) client. It can submit both SQL and PL/SQL to the database. It needs to know when you have stopped entering commands into its input buffer and to submit what you've entered to the database.
SQL*Plus uses two characters for this. The semicolon and the forward slash. If you want to submit the above SELECT to Oracle using SQL*Plus, SQL*Plus needs to know when to submit its input buffer's content - thus:
SQL> SELECT * FROM emp;
Or:
SQL> SELECT * FROM emp
SQL> /
When using PL/SQL in SQL*Plus, SQL*Plus "understands" that the semicolons you use are for the PL/SQL language - not an instruction from you to it to submit its buffer to Oracle for execution.
The forward slash can also be at anytime used to resubmit the current SQL*Plus input buffer again. E.g.
SQL> SELECT * FROM emp;
.. now do the last SQL (or PL/SQL) in the buffer again
SQL> /[i] -
Overflow SQL*Plus buffer.
Hi,
I try to insert default data into a LONG field in a 8i DB by using SQL*Plus; however, I get the following error til I reduce the amount of data to certain size. What I understand is that a LONG field can hold up to 2GB of data, so I believe my problem is overflowing the SQL*Plus's buffer. Is there a way to increase SQL*Plus buffer size?
The error is:
INSERT INTO thetable VALUES (1,'<?xml
version="1.0" encoding="ISO-8859-1"?>
ERROR at line 1:
ORA-01704: string literal too long
Thanks in advance for any help!
klii got the sulotion!
it was really simple by setting the environment before running that code.
Dbms_Output.Enable (1000000);
although it is not permanent sulotion for the problem but at least one can get the much more output by increasing the limit of buffer size.
best regards, -
Input with sql*plus and Output it with PL/SQL
Hi everyone,
I try to understand how can I get input and input by using sqlplus and plsql together. I get output like this:
Get User Input
Given Name: Iron
Family Name: Man
old 6: Given_Name := '&GivenName';
new 6: Given_Name := 'Iron';
old 7: Family_Name := '&FamilyName';
new 7: Family_Name := 'Man';
Given Name: Iron
Family Name: Man
PL/SQL procedure successfully completed.My Codes:
PROMPT Get User Input
ACCEPT GivenName PROMPT "Given Name: "
ACCEPT FamilyName PROMPT "Family Name: "
DECLARE
Family_Name Varchar(15);
Given_Name Varchar(15);
BEGIN
Given_Name := '&GivenName';
Family_Name := '&FamilyName';
DBMS_OUTPUT.PUT_LINE('Given Name: ' || Given_Name);
DBMS_OUTPUT.PUT_LINE('Family Name: ' || Family_Name);
END;
/My question is why I get
old 6: Given_Name := '&GivenName';
new 6: Given_Name := 'Iron';
old 7: Family_Name := '&FamilyName';
new 7: Family_Name := 'Man';this bit?Is there something wrong in my code? Thanks.Hi,
From SQL*Plus reference:
After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
So. you can remove current output with
SET VERIFY OFF
and enable your PL/SQL output by
SET SERVEROUTPUT ON
Regards
Peter -
Buffer overflow in sql plus...
Hi,
i am getting an error 'ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes' while using DBMS_OUTPUT function in a loop in pl/sql block in sql plus environment. please help me in this regard that how can i over come this error.
thanks,i got the sulotion!
it was really simple by setting the environment before running that code.
Dbms_Output.Enable (1000000);
although it is not permanent sulotion for the problem but at least one can get the much more output by increasing the limit of buffer size.
best regards, -
Hi All,
I need help to display the database buffer in sql plus..........
and how can we access the buffer to get the detail in the buffer
thanksYou can't see the content of the blocks currently cached.
You can read from V$BH the statistics on the blocks stored in the cache.
doc
Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com] -
Accepting User input in SQL*Plus
I am writing a SQL script in SQL*Plus that accepts a value from the user and plugs that value into a variable that exist in several locations outside of the PL/SQL block.
I am able to do this, yet everytime this variable is encountered, the user is prompted for input. I would like to have the user prompted only once at the beginning and then use that value throughout. This seems like a simple task, yet I cannot get it to work.
Any help would be greatly appreciated.You can use &&<variable_name> and it will define the variable and use it throughout the SQL code.
-
SQL PLUS log input and output to file
What is the way to log every activity in sqlplus, input and output to a file (interactively).
I managed to do it using rlwrap and tee but the only problem is, it is displaying the password and logging it into file as well :D. I can remove it from the logfile but am unable to prevent from showing the password.
I hope many might have wanted to do this, and some might have been succeeded. Please share your ideas!N:\tools>sqlplus siva
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 19 03:12:04 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password: password
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining optionsThe password is displayed on screen and it is in the log file as well.
Here is the some environmental setup;
I've installed cygwin with rlwrap package
I've renamed the original sqlplus.exe to _sqlplus.exe
I've placed mysqlplus.bat and sqlplus.bat in N:\tools and this location includes in the pathwhere sqlplus.bat contains
@echo off
rlwrap -a"Enter" mysqlplus.bat %*perhaps this is more related to linux commands but I want to log input and output of sqlplus!
:) -
Input truncated to 3 characters in Sql*Plus
Hi All,
I ran .sql script in SQL*PLUS but i got one error.
error is Input truncated to 3 characters.
pls help me..Hi,
Read > this one.
Twinkle -
Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?
Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?
No, but PL/SQL can. Look at utl_file.
John Alexander www.summitsoftwaredesign.com -
Accept input from Shell script in sql*plus
Hey! Guys..
i need the following info.
I am running a shell script from sql*plus. I need to accept a value from shell script into my .sql file.
thanks..
Harsh.prompt for input, pass to another shell
# contract_status_prompt.sh
read udate?"Enter week-ending date in format dd-mmm-yyyy: "
contract_status_update.sh $udate >$FDWLOG/current/contractstatusupdate`date +%d%h%y`.log
echo `date`
# End contract_status_prompt.sh
Read the variable passed and use in SQLPlus:
# contract_status_update.sh
echo "Running contract_status.sh"
echo "create records for contract_status"
echo `date`
echo " "
echo " date used is "; print $1
echo " "
sqlplus <<exit
@$FDWSQL/sqlparms
set time on
prompt *** Set contract_status_period ***
update contract_status_period
set period_date = '$1';
commit;
exit
etc. -
Execute (or re-execute) commands in the SQL*Plus buffer
I feel confused about sql plus / command. by defination, it Execute (or re-execute) commands in the SQL*Plus buffer. how do I know whether it execete or re-execute a command?
for example, I run a select statement, seems I have to type / to get result. when I run a create table statement, it seems run twice with / and I got table exists error.
Could someone clearify when should / be used and when not to use it.jz2 wrote:
I feel confused about sql plus / command. by defination, it Execute (or re-execute) commands in the SQL*Plus buffer. how do I know whether it execete or re-execute a command?
for example, I run a select statement, seems I have to type / to get result. when I run a create table statement, it seems run twice with / and I got table exists error.
Could someone clearify when should / be used and when not to use it.I guess you are looking at things in the other way round. The / does what it says, it executes the command in the buffer. Don't think it "reexecutes". It simply executes the command. Be it already run or for the first time. For example,
Running the code for 1st time.
SQL> begin
2 dbms_output.put_line('hi');
3 end;
4 .
SQL> set serveroutput on
SQL> /
hi
PL/SQL procedure successfully completed.
Running again....
SQL> l
1 begin
2 dbms_output.put_line('hi');
3* end;
SQL> /
hi
PL/SQL procedure successfully completed.
SQL>So / simply executes. Now when you should use it and when not, that depends upon the kind of command you are trying to execute. Like you mentioned, for a select, it works by again giving the output. But for a DDL, its not the / which gives error but its the very nature of DDL that once issued, its committed so surely enough , next execution would throw an error only.
HTH
Aman.... -
Accept user input in sql *plus 9.2.0.1.0
Any body budy can get any idea about my sourcr code?
I wrote below code in sql *plus
accept p_hire_date1 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date from:'
accept p_hire_date2 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date to:'
DECLARE
v_hd1 employees.hire_date%TYPE := TO_DATE(&p_hire_date1);
v_hd2 employees.hire_date%TYPE := TO_DATE(&p_hire_date2);
CURSOR emp_cursor IS
SELECT e.last_name, e.first_name, e.hire_date, e.salary, d.department_name
FROM employees e, departments d
WHERE ((e.hire_date>=v_hd1) AND (e.hire_date<=v_hd2)) AND
(e.department_id=d.department_id)
ORDER BY e.first_name;
emp_record emp_cursor%ROWTYPE;
BEGIN
DBMS_OUTPUT.ENABLE
DBMS_OUTPUT.PUT_LINE(RPAD('Name',20) || RPAD('Hire Date',15) || RPAD('Salary',15) || RPAD('Dept. name',15));
DBMS_OUTPUT.PUT_LINE(RPAD('-',4*15,'-'));
FOR emp_record IN emp_cursor
LOOP
DBMS_OUTPUT.PUT_LINE(RPAD(emp_record.first_name || ' ' || emp_record.last_name,20) || RPAD(TO_CHAR(emp_record.hire_date),15) || RPAD(TO_CHAR(emp_record.salary),15) || RPAD(emp_record.department_name,15) );
END LOOP;
END;
when I execute it I got this error
SQL> /
Enter value for p_hire_date2: 23
accept p_hire_date1 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date from:'
ERROR at line 2:
ORA-00900: invalid SQL statement
any Idea?Your "accept" statement seems to be correct.
Please change the declaration of v_hd1 and v_hd2 as below.
v_hd1 employees.hire_date%TYPE := TO_DATE('&p_hire_date1','DD-MON-YYYY');
v_hd2 employees.hire_date%TYPE := TO_DATE('&p_hire_date2','DD-MON-YYYY');
Since p_hire_date1 and p_hire_date2 are date variables enter a valid date of format DD-MON-YYYY. You have entered 23 which is not a valid date.
Maybe you are looking for
-
I have a virus on my iPad that sends out bogus emails (no subj and an URL that goes nowhere) to everyone in my contact list. I don't know how it got on my machine (email, non-iTunes apps, etc.) Does any one know of a scanning app that can find this v
-
Photoshop cc 2014 missing shape layers and plugins
i have the trail version off Photoshop cc 2014 and its doesn't have most of the features like history brush n and also missing the star shape how can i fix this thanks its also missing the mixer brush
-
Linksys and DW7000 sattelite receiver
I cant seem to hook my Linksys WRT54G and DW700 Satellite Receiver together to enable port forwarding to occur. I have the pro plan which has a static IP. Any help would be greatly appreciated. Richard
-
FORMCALC (or JS) Default date today with user override questions
I have a date field where if null, I want today to be inserted. If the user overrides the today date and saves the form, I want the user entered date to stay. What I have in FORMCALC is: if ($.isNull) then $.rawValue = num2date(date(), DateFmt(2)) en
-
How do I see the pictures that have been saved to my iCloud
How do I see the pictures that I've saved to my iCloud account