0

I open a connection to my schema and I want to view a table.

Why does this work by itself:

select * from mytable;

But this does not:

   -- other statements above          

   begin 
      insert into mytable(id, name) values (2, "George");
   exception ... 
   end;

   select * from mytable;

This returns nothing. No query output is given. Instead all I see is "Task completed in 0.016 seconds".

If I restart sqldeveloper and run ONLY the begin/end and the select statements, I get this error thrown at me:

Error report:
ORA-06550: line 7, column 1:
PLS-00103: Encountered the symbol "SELECT" 
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

1 Answer 1

0

I suppose you are trying to run those commands as a script(pressing F5) in a SqlDeveloper. Then there are a couple of things:

1) Replace double quotes by single quotes in the insert statement.

insert into mytable(id, name) values (2, 'George');

2) Put slash / at the end of the PL/SQL block.

 begin 
   insert into mytable2(id, name) values (2, 'George');
   commit;
 end;
/

do not forget commit.

Sign up to request clarification or add additional context in comments.

1 Comment

It depends on what you are trying to achieve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.