Reputation: 1
I am new to PLSQL. Please help find the solution of the below mentioned error. Error is
Error report -
ORA-06550: line 8, column 1:
PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
:= ( ; not null range default character
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
**The code I executed is **
DECLARE
c_id customers.ID%type :=1 ;
c_name customers.NAME%type ;
c_age customers.AGE%type ;
c_addr customers.ADDRESS%type ;
c_sal customers.SALARY%type
BEGIN
SELECT NAME, AGE, ADDRESS, SALARY INTO c_name, c_age, c_addr, c_sal FROM CUSTOMERS
WHERE ID = c_id ;
dbms_output.put_line('Customer' || c_name || ' from ' || c_addr || 'earns' || c_sal ) ;
END ;
/
OUTPUT SHOULD BE
Customer Ramesh from Ahmedabad earns 2000
Upvotes: 0
Views: 586
Reputation: 18695
Error says it all: "Encountered the symbol "BEGIN" when expecting ". That implies there is a syntax error before the BEGIN
keyword. So look at the lines above and observe the line above does not have a terminating semi colon.
Try to do some basic debugging. Takes less time than posting the question here ;)
DECLARE
c_id customers.ID%type :=1 ;
c_name customers.NAME%type ;
c_age customers.AGE%type ;
c_addr customers.ADDRESS%type ;
c_sal customers.SALARY%type ; <<< missing semi colon
BEGIN
SELECT NAME, AGE, ADDRESS, SALARY INTO c_name, c_age, c_addr, c_sal FROM CUSTOMERS
WHERE ID = c_id ;
dbms_output.put_line('Customer' || c_name || ' from ' || c_addr || 'earns' || c_sal ) ;
END ;
/
Upvotes: 2