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 131527 - Oracle JDBC
Summary: Oracle JDBC
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-29 18:31 UTC by jjjjjj
Modified: 2008-08-08 11:30 UTC (History)
0 users

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 jjjjjj 2008-03-29 18:31:50 UTC
Unable to create a table for Oracle using the Services\Databases window; (jdbc drivers) ORA-00904: invalid identifier -
in other works the SQL it wants to run to generate the table is not valid oracle syntax.
Comment 1 David Vancouvering 2008-03-31 05:35:09 UTC
Can you please describe the specific steps you took - usually this works fine.  What was the name of the table, and the
names and types of the columns?  What modifiers (unique, null, etc.) did you apply to the columns?
Comment 2 jjjjjj 2008-04-04 22:14:51 UTC
Ok, this is weird I'm running it against and Oracle XE database - I think this is Oracle specific; the script runs
perfect in sqlplus from the command line, e.g:

bash> sqlplus user/pass @scriptname.sql

---START---

-- ----------------------------------- --
-- NOW returns the current system date --
-- ----------------------------------- --
DROP FUNCTION NOW;
CREATE OR REPLACE FUNCTION NOW
RETURN DATE
IS
    ret DATE;
BEGIN
    SELECT SYSDATE INTO ret FROM DUAL;
    RETURN ret;
END;
/

-- ------------------------------------------ --
-- Table and sequence for the application log --
-- ------------------------------------------ --
DROP TABLE FND.log;
DROP SEQUENCE FND.seq_log;
CREATE TABLE FND.log (
    ID INTEGER NOT NULL,
    stamp DATE DEFAULT SYSDATE,
    description VARCHAR2(80) NOT NULL,
    PRIMARY KEY(ID)
);
CREATE SEQUENCE FND.seq_log
START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE;
CREATE OR REPLACE TRIGGER FND.trg_log
BEFORE 
INSERT ON FND.log
FOR EACH ROW
BEGIN
    DECLARE 
        lID INTEGER;
    BEGIN
        SELECT FND.seq_log.NEXTVAL INTO lID FROM DUAL;
        :NEW.ID := lID;
    END;
END;
/
COMMIT;
QUIT;

---END---

It creates the following results from the IDE:

Executed successfully in 1.359 s, 0 rows affected.
Line 9, column 1

Executed successfully in 0.382 s, 0 rows affected.
Line 10, column 1

Error code 6550, SQL state 65000: ORA-06550: line 2, column 37:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   ;
Line 14, column 1

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 16, column 5

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 17, column 1

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 17, column 1

Executed successfully in 0.02 s, 0 rows affected.
Line 24, column 1

Error code 955, SQL state 42000: ORA-00955: name is already used by an existing object
Line 25, column 1

Executed successfully in 0.027 s, 0 rows affected.
Line 31, column 1

Executed successfully in 0.338 s, 0 rows affected.
Line 33, column 1

Error code 6550, SQL state 65000: ORA-06550: line 2, column 53:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   ;
Line 40, column 5

Error code 17439, SQL state 99999: Invalid SQL type
Line 42, column 9

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 43, column 5

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 44, column 1

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 44, column 1

Error code 900, SQL state 42000: ORA-00900: invalid SQL statement
Line 47, column 1

Execution finished after 2.126 s, 11 error(s) occurred.







Comment 3 jjjjjj 2008-04-04 23:23:42 UTC
The original error is caused by setting a primary key when trying to create the table; it's due to the Oracle specific
syntax I think here - as you can see in the script... it also shows a sequence and trigger for Oracle; the combination
of which creates a serial field for the table.

Comment 4 David Vancouvering 2008-04-07 18:00:38 UTC
The problem is that you are trying to execute a trigger which has multiple statements that must be run as a single
statement.  By default NB executes each ';' delimited statement separately.

As of just last week, I checked in a fix that allows you to work around this by changing the delimiter character:

delimiter $$ // or whatever delimiter you want
CREATE OR REPLACE TRIGGER FND.trg_log
BEFORE 
INSERT ON FND.log
FOR EACH ROW
BEGIN
    DECLARE 
        lID INTEGER;
    BEGIN
        SELECT FND.seq_log.NEXTVAL INTO lID FROM DUAL;
        :NEW.ID := lID;
    END;
END$$
delimiter ;
Comment 5 David Vancouvering 2008-04-08 18:58:58 UTC
Marking as incomplete, waiting to hear back whether the delimiter approach works.
Comment 6 Andrei Badea 2008-08-08 11:30:56 UTC
No reply from reporter for a long time, so closing.