My Oracle Support Banner

How to Make SQLPLUS Script in UNIX Shell Produce Output on Same Line (Doc ID 778846.1)

Last updated on MARCH 30, 2020

Applies to:

SQL*Plus - Version 8.1.7.0 to 11.2.0.2 [Release 8.1.7 to 11.2]
Generic UNIX

Goal

A Simple Select statement is executed from within a shell environment.
The value returned by the select query is transferred back to the shell.
However the result produced will have an empty line in it.
For example:

will produce the result as:

RESULT=

Result expected is:

RESULT=X

This is expected behavior and hence the value will be returned on a new line.

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.