Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Script question: SQL & PL/SQL variables
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:
: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
![]() |
![]() |