Solved

SQL Plus SET command

Posted on 2002-03-26
2
3,704 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 34

Expert Comment

by:Mark Geerlings
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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 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

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now