Maciaz
Maciaz

Reputation: 1234

Having problems running SQL script in SQL Developer

The script is:

ALTER TABLE DBR_STATUS ADD IS_READY NUMBER(1,0) DEFAULT 0;
COMMENT ON COLUMN DBR_STATUS.IS_READY IS 'Is engine ready?';

I get a Syntax error trying to run that. No details. That's just a small tooltip. What am I missing?

Upvotes: 0

Views: 549

Answers (2)

thatjeffsmith
thatjeffsmith

Reputation: 22467

Please, always include the VERSION of SQL Developer you are having issues with.

I agree with @MTO's answer.

To add additional info, this does not present itself in the current version of SQL Developer, which is version 18.1.

create table dbr_status (
 a   integer
                        );

alter table dbr_status add is_ready number(1,0) default 0;

comment on column dbr_status.is_ready is
 'Is engine ready?';

select *
  from dbr_status;

And no problems indicated by the parser, as it should be.

enter image description here

Please update your question with version number if you are NOT on v18. Otherwise, the answer is you can: A)Safely ignore it. B)Upgrade.

Upvotes: 2

MT0
MT0

Reputation: 168740

[TL;DR] It appears to be a bug in SQL Developer's syntax highlighting and does not prevent code execution. Just ignore it.


Running the code:

CREATE TABLE DBR_STATUS ( ID INT );
ALTER TABLE DBR_STATUS ADD IS_READY NUMBER(1,0) DEFAULT 0;
COMMENT ON COLUMN DBR_STATUS.IS_READY IS 'Is engine ready?';
SELECT * FROM DBR_STATUS;

You get a little red squiggly underline following the end of the comment (in this case on the first keyword of the next statement):

Syntax Error

If I run the code, it executes without issues:

Table DBR_STATUS created.
Table DBR_STATUS altered.
Comment on column dbr_status.is_ready 'IS ENGINE READY?' succeeded.
no rows selected

It appears to be a bug in SQL Developer and is something that you can just ignore.

Upvotes: 3

Related Questions