File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes PL/SQL substitution variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "PL/SQL substitution variable" Watch "PL/SQL substitution variable" New topic

PL/SQL substitution variable

Sen Aff
Ranch Hand

Joined: Mar 08, 2007
Posts: 63

i am new to oracle 9i PL/SQL and i am having trouble running the following

set verify off

ACCEPT n PROMPT 'Please enter your name: '


name VARCHAR2(100) := &n;

DBMS_OUTPUT.PUT_LINE('Welcome ' || name);


all i want to do is to be able to input a string from the promt
and assign that string to a variable.

thank you.

Sen Aff.

this is the error:
ERROR at line 4:
ORA-06550: line 4, column 30:
PLS-00201: identifier 'E' must be declared
ORA-06550: line 4, column 13:
PL/SQL: Item ignored
ORA-06550: line 9, column 50:
PLS-00320: the declaration of the type of this expression is incomplete or
ORA-06550: line 9, column 15:
PL/SQL: Statement ignored
Agador Paloi
Ranch Hand

Joined: Jan 24, 2006
Posts: 118
The accepted value &n is the string you entered at the prompt, so must be enclosed with ' ' . name VARCHAR2(100) := '&n' ; should work
I agree. Here's the link:
subject: PL/SQL substitution variable
It's not a secret anymore!