Solved

SQL Plus SET command

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

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

828 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