Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't get DECLARE/BEGIN to compile

1053298Nov 8 2013 — edited Nov 18 2013

I'm working on a project for my systems analysis class, which involves creating a few tables and printing out information from them. Our teacher has taught us nothing of use for this project so I have been winging it thus far. Any way, I have tried to get one of his sample snippets to compile under the worksheet view in Oracle SQL Developer:

DECLARE

n number;

BEGIN

n:=50;

dbms_output.Put_Line('The value of n is ' || n);

END;

However, when I try to run it I get the following error: Incorrect syntax near the keyword 'DECLARE'. I tried writing the most simple thing I could think of:

BEGIN

dbms_output.Put_Line('the value of n is 20');

END;

But I receive a similar error: Incorrect syntax near the keyword 'BEGIN'. I've been able to get normal SQL table queries to work just fine, so my question is what am I doing wrong here?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2013
Added on Nov 8 2013
15 comments
1,983 views