This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206394 - Statement seperator needs to be configurable in sql editor
Summary: Statement seperator needs to be configurable in sql editor
Status: RESOLVED WONTFIX
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
: 165125 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-14 16:04 UTC by paolosca
Modified: 2012-11-01 17:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description paolosca 2011-12-14 16:04:12 UTC
Product Version: NetBeans IDE 7.1 (Build 201112051121)
Java: 1.7.0_147-icedtea; OpenJDK Client VM 21.0-b17
System: Linux version 3.2.0-rc4-686-pae running on i386; UTF-8; en_US (nb)
User directory: /home/paolo/.netbeans/7.1
Cache directory: /run/netbeans

While testing the tutorial "Creating a Database Driven Application With PHP,,Lesson 1b: Creating Oracle Database Tables" I came across a weird problem trying to create the triggers.

Whenever I try to execute the following SQL code in the editor:

create or replace trigger wishers_insert
before insert on wishers
for each row
begin
  select wishers_id_seq.nextval into :new.id from dual;
end;
/

results in the following error:

Executed successfully in 0.138 s, 0 rows affected.
Line 1, column 1
Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 6, column 1
Execution finished after 0.138 s, 1 error(s) occurred.


Removing the semicolon (;) at the end of line 5 doesn't return error but the trigger icon in the DB tree appears with a red X. Whenever I attempt to insert a new record in the table the query fails with the following error:

Error code 4098, SQL state 42000: ORA-04098: trigger
'PHPUSER.WISHERS_INSERT' is invalid and failed re-validation
Line 1, column 1
Execution finished after 0 s, 1 error(s) occurred.


This happens using both ojdbc6.jar and ojdbc14.jar thin driver.

If I try to create the trigger using Oracle XE web based interface the trigger is created without errors (no need to remove the semicolon). The trigger works fine and inserting a new record in the table succeeds.

Could it be a compatibility issue with OpenJDK 1.7?

Thanks,

Paolo.
Comment 1 Jaroslav Havlin 2012-06-07 11:24:16 UTC
> Could it be a compatibility issue with OpenJDK 1.7?
The problem is probably in splitting text into statements. Semicolon is used as a statement delimiter, which is incorrect if semicolon is used inside statement (e.g. procedures, triggers).
Comment 2 matthias42 2012-08-20 08:35:05 UTC
*** Bug 165125 has been marked as a duplicate of this bug. ***
Comment 3 matthias42 2012-08-20 08:40:48 UTC
MySQL (and probably most DBMS) has the same problem - the command line client offers the "DELIMITER" command, which changes the statement terminator till the next "DELIMITER" command is reached.
Either something similar is needed for netbeans editor or the ability to change the delimiter for the whole file, but the latter poses the problem that this needs to be persisted in some way.
Comment 4 matthias42 2012-10-10 19:23:19 UTC
(In reply to comment #3)
> Either something similar is needed for netbeans editor or the ability to change
> the delimiter for the whole file, but the latter poses the problem that this
> needs to be persisted in some way.

I'm wrong this is already implemented in the db.core.

Please try to run this sequence:

======SNIP======
DELIMITER /
create or replace trigger wishers_insert
before insert on wishers
for each row
begin
  select wishers_id_seq.nextval into :new.id from dual;
end;
/
DELIMITER ;
======SNAP======

This should work. Please test - if this works the tutorial should be updated to include this.
Comment 5 matthias42 2012-11-01 17:37:52 UTC
I checked the tutorial and tried my suggested fix. It works. I submitted that information via the feedback formular.

I'll asume that fix will find it's way into the tutorial.