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

Home -> Community -> Usenet -> c.d.o.tools -> Script question: SQL & PL/SQL variables

Script question: SQL & PL/SQL variables

From: Peter Amundson <peter.amundson_at_cotlnospam.com>
Date: Tue, 3 Oct 2000 12:41:16 -0700
Message-ID: <8rdcth$c24$1@brokaw.wa.com>

Hey all:

I'm trying to write a simple SQL script (to be run from SQL*Plus) which will accept input from the user, truncate the input to 10 characters, then pass this result as a parameter to another script. This seems simple enough, but I'm stuck!

I believe that I must use PL/SQL to truncate the user's input (actually using substr), but I can't figure out how to pass this value outside of the PL/SQL block so that I can call another script. What I want is something like:



accept longinput prompt 'Enter long string: ' variable g_short varchar2(10)
begin

    :g_short=substr('&longinput',1,10);
end;
/
@nextscript :g_short


The syntax of this last line doesn't work. I can use "print g_short" to see the value of that variable outside of the PL/SQL block, but can I do anything else with the value other than print it? If there's a way to manipulate the substitution variable without using PL/SQL, that would be even better (but I don't think this is possible).

Any help would be appreciated!

-Peter Received on Tue Oct 03 2000 - 14:41:16 CDT

Original text of this message

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