Home » RDBMS Server » Server Administration » Can someone help me with the prompts command?
Can someone help me with the prompts command? [message #371519] Wed, 01 November 2000 19:11 Go to next message
Chris
Messages: 128
Registered: November 1998
Senior Member
The block below will not run on Oracle 8. It completely ignores the accept/prompt and then just promps on the & parts in declare for about 2 variables and then just fails. Very frustrating. Can anyone help me out on this?

create sequence Emp_no_Seq
increment by 1
start with 7000
maxvalue 8000
nocache
nocycle;

10. Create and populate 'mytable". with dept_no,dept_name,dept_location,dept_manager. Write the PL?SQL block that will populate your table. Insert at least five entries. Show your table on completion. Use you sequence (#9) for dept_no.

SET SERVEROUTPUT OFF
SET VERIFY OFF

ACCEPT p_deptno PROMPT 'Please enter the department number:';
ACCEPT p_deptname PROMPT 'Please enter the department name:';
ACCEPT p_deptloc PROMPT 'Please enter the department location:';
ACCEPT p_deptmgr PROMPT 'Please enter the department manager:';

DECLARE

V_deptno mytable.dept_no%TYPE := '&p_deptno';
V_deptname mytable.dept_name%TYPE:= '&p_deptname' ;
v_deptloc mytable.dept_loc%TYPE := '&p_deptloc' ;
v_deptmgr mytable.dept_mgr%TYPE := '&p_deptmgr' ;

BEGIN

CREATE TABLE MYTABLE(
dept_no VARCHAR2(20),
emp_no VARCHAR2(20)
dept_name VARCHAR2(20),
dept_loc VARCHAR2(20),
dept_mgr VARCHAR2(20),
;

insert into mytable (dept_no, emp_no, dept_name, dept_loc,dept_mgr)
values (v_deptno, emp_no_Seq.nextval, v_deptname,v_deptloc,v_deptmgr);

END;
Re: Can someone help me with the prompts command? [message #371542 is a reply to message #371519] Fri, 03 November 2000 13:18 Go to previous message
Amit Chauhan
Messages: 74
Registered: July 1999
Member
Hi,
Use two ampersands insetead of one i.e. &&p_deptno instead of &p_deptno. it will work then.

Also put these lines on the top before ACCEPT.
undef p_deptno
undef p_deptname
undef p_deptloc
undef p_deptmgr

Thanks
Amit
Previous Topic: Oracle Error not documented
Next Topic: Text Manipulation
Goto Forum:
  


Current Time: Thu May 02 06:25:18 CDT 2024