Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:37:21+00:00 2026-06-18T09:37:21+00:00

I have been asked to change a part of the existing SQLPLUS script to

  • 0

I have been asked to change a part of the existing SQLPLUS script to a shell script to allow for more options.

Here is what the original SQLPLUS script was prompting for:

SPOOL results.txt;
WHENEVER OSERROR EXIT 9;
WHENEVER SQLERROR EXIT SQL.SQLCODE;
PROMPT
PROMPT This script upgrades the database to the most recent version of eV8.0.
SET VERIFY OFF;
SET SERVEROUTPUT ON;

ACCEPT continue_flag CHAR PROMPT 'Are You ready to continue Y/N? '
PROMPT

My shell script now looks like :

 #!/bin/sh

echo "Please enter database username"
read eval_user
echo "Please enter database password"
read eval_pass
echo "Please enter the database name"
read db_name

$ORACLE_HOME/bin/sqlplus -s /nolog <<-EOF >> ${LOGFILE}
connect $eval_user/$eval_pass@$db_name

set serveroutput on format wrapped
set pages 0 lines 300 trimout on trimspool on
set echo off feedback off sqlprompt ''

SPOOL results.txt;
WHENEVER OSERROR EXIT 9;
WHENEVER SQLERROR EXIT SQL.SQLCODE;
PROMPT
SET VERIFY OFF;
SET SERVEROUTPUT ON;

ACCEPT continue_flag CHAR PROMPT 'Are You ready to continue Y/N? '
PROMPT

I get this error when the SQLPLUS prompt line is reached:

Are You ready to continue Y/N? You have entered an invalid response. Exiting.
BEGIN
*
ERROR at line 1:
ORA-06501: PL/SQL: program error
ORA-06512: at line 13

I am new to sqlplus, so I know it is something to do with the settings I set in the beginning, if I set echo off feedback off sqlprompt ‘ ‘. But, on removing the line, the script just hangs.

Should I take the prompts completely out of SQLPLUS and use it only in the shell part?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:37:22+00:00Added an answer on June 18, 2026 at 9:37 am

    Easiest is to keep the interactions from the sql script. It does want to read something that you currently do not give it.
    The here document is a fine way to pass variables. Don’t forget the effect that it has on shell special characters …
    As always, there are more ways to do the same.

    But yes, the answer on your question: YES, take the interactions out and prepare the decisions in the calling shell.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been asked to write a script that pulls the latest code from
I have been asked to write a GUI that will allow objects to be
This may have been asked already, but I can't find it, so here goes.
I have been asked to make a one-off change to the link on the
Background I have been asked to write a script that will create a vertical
I have been asked to change the font throughout a website into Gil Sans
I have been asked to make a change to our website (it uses asp
I have been asked to come up with a solution which would allow our
So I have been asked to change the engine of a few tables in
This seems to have been asked several times on here with no real answer:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.