Layla
Layla

Reputation: 5446

error when entering values by Oracle PL/SQL

I want to enter a value by console in Oracle 10g with PL SQL. I am using the web based interface and not the SQL*. The program is like this:

DECLARE
      v_desc VARCHAR2(50);
BEGIN
    v_desc:=show_desc(&sv_cnumber);
    DBMS_OUTPUT.PUT_LINE(v_desc);
END;

and the function is:

CREATE OR REPLACE FUNCTION show_desc
    (i_course_id course.course_id%TYPE)
RETURN varchar2
AS
        v_desc varchar2(50);
BEGIN
SELECT description
    INTO v_desc
    FROM courses
WHERE course_id=i_course_id;
RETURN v_desc;
EXCEPTION
    WHEN NO_DATA_FOUND
   THEN
    RETURN('no description found');
END;    

when I run this code, I got an error that says:

ORA-06550: line 4, column 37: PLS-00103: Encountered the symbol "&" when expecting one of the following:

what is the mistake? Thanks

Upvotes: 0

Views: 288

Answers (1)

codingbiz
codingbiz

Reputation: 26386

If you want a prompt to be displayed so you can enter a value for the variable, try replacing & with colon

v_desc:=show_desc(:sv_cnumber);

& is a special symbol in PL/SQL

Upvotes: 1

Related Questions