Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Prompt and accept a value inside a procedure

Re: Prompt and accept a value inside a procedure

From: Chuck Hamilton <chuck_hamilton_at_hotmail.com>
Date: Wed, 18 Apr 2001 08:30:50 -0700
Message-ID: <F001.002EBDA7.20010418073133@fatcity.com>

In short, no. Perhaps with Java (i'm not sure), but definitely not with PL.SQL. There are a couple of things you can do depending on what you're trying to accomplish.

Prompt for input in sqlplus before executing your pl/sql. If you're running a stored procedure, pass the input as an argument. If you're running anonymous pl/sql, embed the substitution variable in the pl/sql where you need it.

If you need to prompt after executing some logic, don't use pl/sql. Use a shell script to do what you want and issue sql commands against the database via sqlplus. You can read results from a sql command into shell variables like this.

#!/bin/ksh
print -n "Enter table name:"
read tn
sqlplus -s<<! | read cnt
user/password
set feedback off pages 0 trimspool on
select count(*) from $tn;
!
print "Count is $cnt"

> Hi All,
>
> Is there a way to prompt a user and accept input from the user inside a
> procedure. I cannot get the prompt/accept to work
> inside a procedure. It works it sql*plus.
>
> Thanks
> Rick
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Cale, Rick T (Richard)
> INET: RICHARD.T.CALE_at_saic.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Chuck Hamilton
  INET: chuck_hamilton_at_hotmail.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Apr 18 2001 - 10:30:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US