0

I'm trying to get user input in SQLDeveloper in a procedure. But however , I'm getting some error like "missing defines". Please help me to solve this. Thanks in advance.

DECLARE
a NUMBER(5);    
BEGIN
a := :a;
DBMS_OUTPUT.PUT_LINE('We took the number as ' || a);
END;

The error looks like this.

Error starting at line : 1 in command -
DECLARE
a NUMBER(5);    
BEGIN
a := :a;
DBMS_OUTPUT.PUT_LINE('We took the number as ' || a);
END;
Error report -
Missing defines
We took the number as 15

Although I'm getting the correct answer at bottom, still why this errors?

lu5er
  • 3,229
  • 2
  • 29
  • 50

2 Answers2

0

Please execute the below statement:

  DECLARE
    a NUMBER(5):=15;    
    BEGIN
    a := a;
    DBMS_OUTPUT.PUT_LINE('We took the number as ' || a);
    END;
Piyush
  • 19
  • 4
0

In order to get user input in PLSQL Block, we use &, &givenumber will get the user input at run time.

DECLARE
a NUMBER(5);    
BEGIN
a := &givenumber;
DBMS_OUTPUT.PUT_LINE('We took the number as ' || a);
END;
Piyush
  • 19
  • 4