Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

PL/SQL substitution variable

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

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


SET SERVEROUTPUT ON
set verify off

ACCEPT n PROMPT 'Please enter your name: '

DECLARE

name VARCHAR2(100) := &n;

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

END;
/


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
malformed
ORA-06550: line 9, column 15:
PL/SQL: Statement ignored
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The accepted value &n is the string you entered at the prompt, so must be enclosed with ' ' . name VARCHAR2(100) := '&n' ; should work
 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic