Solved

SQL Plus SET command

Posted on 2002-03-26
2
3,721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

740 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