Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Plus SET command

Posted on 2002-03-26
2
Medium Priority
?
3,738 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 20 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

927 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