Solved

SQL Plus SET command

Posted on 2002-03-26
2
3,708 Views
Last Modified: 2012-05-04
set cmdsep on
set cmdsep ^;
desc dept ^ desc emp WORKING. But,
select count(rowid) from dept ^ select count(rowid) from emp;
COUNT(ROWID)
------------
14

Only the second statement gives a result. Why so and what all statements are covered in
the possibility of multiple statements on the same line.
--- sesh2002
0
Comment
Question by:sesh2002
2 Comments
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 6897472
I've never attempted multiple, separate SQL commands on one line in SQL*Plus.  I'm not sure this is supported.  Is there an advantage you can think of to this coding approach?
0
 
LVL 5

Accepted Solution

by:
kelfink earned 5 total points
ID: 6897943
I don't know if it's supported either, but the difference in what you're showing us is, SQL*Plus, the program, parses processes the DESC command.  Thus, it might realize that there's a separator, and multiple sql*plus commands can be entered on the one line.

SELECT, on the other hand, is an oracle command.  All SQL*Plus can do with it is hand the text off to the database for processing (after checking for the presence of & variables, etc...

The cmdseparator ahs anothe rpurpose, as well.

If you type:
select * from dual;

then the query gets immediately run.  But if you type:
select * from dual

then it keeps you in the buffer, until you hit enter on an empty line.  This terminated the buffer.
To run (repeatedly) the statement you've got in the buffer, you enter '/' on a line by itself.

I think that having two SQL statements on one line would make it ambiguous about when to terminate the buffer, and just exactly which statement to re-run when the '/' is given.
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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error executing command from server 6 52
oracle 11g 23 80
Need help with fine tuning the windows batch script to change password 9 30
migration MS SQL database to Oracle 30 61
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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 video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

770 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