Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple FORMAT Commands on One Line in SQLPlus

Status
Not open for further replies.

jtanner

Technical User
Feb 18, 2007
39
US
Hello,

Though I have read the the docs over and over, I cannot determine how to place more than one COL\FORMAT command on one line in a standard .sql script to be run from SQLPlus.

COL emp FORMAT a20
COL location FORMAT a10
[/color blue]

Using a semi-colon between entries does not work.
COL emp FORMAT a20;COL location FORMAT a10[/color red]

What can you recommend?


Thanks,

JT
 
It looks as if you're expecting SQLPlus to behave like a shell command line?

I want to be good, is that not enough?
 
Dagon, Ken,

Yep, I am firing SQL (and SQLPlus) from a shell script.

In most language you can place multiple commands on one line. As a rule of thumb, of course, this is something you do not want to abuse.

Can it be done?

If not I guess I can put my FORMAT commands in a .login or .glogin (yuck).


JT
 
Hi,
Why not put them in the Sql script on separate lines?
That should not prevent you from calling the script from the shell..





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I don't understand why you would need to put your format commands in a login script. Are you trying to pass the entire SQL*Plus set of commands through a single UNIX variable or something like that ?

If you want to pass multiple lines to sql*plus and don't want to have a separate sql script file, you can use a technique like the following:

sqlplus un/pw@db << EOF
COL emp FORMAT a20
COL location FORMAT a10
select emp, location from table;

EOF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top