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 192772 - When you issue a select with an order by clause on Oracle DB, the order by clause becomes part of the "insert into" stmt
Summary: When you issue a select with an order by clause on Oracle DB, the order by cl...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
: 191683 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-02 08:02 UTC by rcasha
Modified: 2010-12-08 06:35 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 rcasha 2010-12-02 08:02:04 UTC
Product Version = NetBeans IDE Dev (Build 201011280001)
Operating System = Linux version 2.6.35-23-generic-pae running on i386
Java; VM; Vendor = 1.6.0_23-ea
Runtime = Java HotSpot(TM) Client VM 19.0-b09

I entered the following statement in an SQL Command window and executed it:
select * from DB.STD_PARAMETER_VALUE
order by id

Then I clicked the Insert Record button, filled in the details and when I submitted it, got an error. I clicked "Show SQL" and saw the following:

INSERT INTO DB."STD_PARAMETER_VALUE
order by id" (ID, PARM_VALUE, COMPANY_CODE, APPLICATION_CODE, PARAMETER_CODE, USER_ID, WORKSTATION_ID) 
	VALUES (-24, 'false', 'MB', 'almira', 'can-delete-users', NULL, NULL)

The "order by" was interpreted as part of the tablename.
Comment 1 Jiri Rechtacek 2010-12-03 08:05:00 UTC
Thanks for your report, I'll evaluate it in code and let you know.
Comment 2 Jiri Rechtacek 2010-12-06 15:11:16 UTC
I cannot reproduce if I followed your steps on 
  Product Version         = NetBeans IDE Dev (Build 201012060001) (#5432c8ce9c0a)
  Operating System        = Linux version 2.6.35-23-generic running on amd64
  Java; VM; Vendor        = 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01; Sun Microsystems Inc.
  Runtime                 = Java(TM) SE Runtime Environment 1.6.0_20-b02
  Java Home               = /usr/local/share/java/jdk1.6.0_20/jre
  System Locale; Encoding = en (nb); UTF-8

Have I missed any detail? Are you able to reproduce again? Which DB? I tried with Java DB and MySQL. Thanks
Comment 3 rcasha 2010-12-07 08:31:58 UTC
I tested it with 201012050001. It's still there.

Database is Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
JDBC driver is 10.2.0.2.0

The exact steps were as follows:
Connect to the database from the "Services" tab.
Select a table and click "View Data"
Add an "order by" clause to the generated select statement, and click "Run SQL" again
In the results tab, click the "Insert Record(s)" button
Fill in all the not nullable columns
Click "Show SQL" to see erroneous select statement

Note that this only happens if I add an "order by" clause, but not a "where" clause.
Comment 4 Jiri Rechtacek 2010-12-07 11:28:37 UTC
Thanks. I can reproduce it with Oracle DB too. I'll investigate what's wrong and fix it. Thanks
Comment 5 Jiri Rechtacek 2010-12-07 13:48:21 UTC
core-main/rev/977e60a99e81
Comment 6 Jiri Rechtacek 2010-12-07 18:24:27 UTC
*** Bug 191683 has been marked as a duplicate of this bug. ***
Comment 7 Quality Engineering 2010-12-08 06:35:58 UTC
Integrated into 'main-golden', will be available in build *201012080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/977e60a99e81
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #192772: When you issue a select with an order by clause to Oracle DB, then click the "insert row" button, the order by clause becomes part of the "insert into" stmt