After a recent upgrade to Oracle 12cR1, Idea's database-editor syntax-highlighting has gotten out-of-date for my Oracle connections.
Queries making use of 12c syntax that work fine in SQLPlus(12.1.0.2.0) and SQLcl(4.2.0) highlight as incorrect syntax in my Idea editor. They also fail to run when executed from the editor.
I'd like to update intellij, but I haven't found where to upgrade the oracle dialect and my jdbc drivers appear to be up-to-date. I was hoping for advice on two fronts--where to upgrade intellj to successfully execute 12c-syntax SQL, and how to get Idea's Oracle-Dialect to have 12c-compatible syntax highlighting. An example that would cover both of these is subquery-factoring-clause function-declaration. These constructs fail to execute for me in the editor with an ORA-06553.
I'm on Ubuntu-16.04 LTS with Idea (v 2016.3.4)
I'm using Database-Plugin: Database Tools and SQL plugin (v 1.0)
I'm using the provided drivers: .IntelliJIdea2016.3/config/jdbc-drivers/
Driver-versions are xdb6-12.1.0.2.jar and ojdbc6-12.1.0.2.jar
I'm not currently using any additional files in my driver configuration
If this isn't supported yet, I can accept that. I'd just like to upgrade if currently possible.
Thanks
Here's an example for checking whether a string is on the (dvorak) home-row for typing. The statement works fine in SQLPlus and SQLcl, but is flagged as invalid in Idea and fails to execute (ORA-06553). This could of course be done more succinctly with SQL only, but hopefully illustrates the issue.
WITH
FUNCTION IS_IT_DVORAK_HOME_ROW(P_CHAR_STRING IN VARCHAR2 )
RETURN NUMBER
IS BEGIN
CASE WHEN REGEXP_LIKE(P_CHAR_STRING, '^[AOEUIDHTNS-aoeuidhtns_ ]{1,}$')
THEN RETURN 1;
ELSE RETURN 0;
END CASE;
END;
SELECT DECODE(IS_IT_DVORAK_HOME_ROW('This And That And These and Those Too'),1,'Home-Row!','Nope...') AS HOME_ROWNESS
FROM DUAL;
/
Related
We have two SQL Servers and on both of them FTS is enabled and should be configured the same way. Both run with the same server version. The SQL Server we have problems with runs in Azure.
I also have checked the wordbreaker language versions with the following statement. Both have the version 14.0.4763.1000 installed for German (1031).
EXEC sp_help_fulltext_system_components 'wordbreaker'
On one server, we do not get results properly, even though the word we are searching for exists in the table. With the following query we don't get any results:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehmen*"', LANGUAGE 1031)
But with the keyword "Einzelunternehm" instead of "Einzelunternehmen" we get the results we are looking for:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehm*"', LANGUAGE 1031)
We have absolutely no clue what the issue is. Does anybody have the same problem or have any idea what we have done wrong?
Thx
I am trying to run the following Firebird SQL query in LibreOffice, which has embedded Firebird:
SELECT RDB$GET_CONTEXT('SYSTEM', 'ENGINE_VERSION') AS "VERSION"
FROM "RDB$DATABASE";
I get the message Syntax error in SQL statement. Can anyone tell me what I am doing wrong? This works in FlameRobin, but not in LibreOffice.
The error "Syntax error in SQL statement" is a HSQLDB error. So, first, make sure your LibreOffice Base project is actually created as a Firebird Embedded project.
I was able to reproduce the error in LibreOffice Base 6.4.4.2 with a Firebird Embedded project. It looks like LibreOffice first tries to parse the query using HSQLDB (probably to be able to transform HSQLDB syntax to Firebird syntax), and only then forwards it to Firebird.
The cause of the error is the $ in RDB$GET_CONTEXT which is not a valid character in an unquoted object name in the HSQLDB SQL syntax, while it is valid in the Firebird SQL syntax. Normally, double quoting the specific object name would solve this, but RDB$GET_CONTEXT is not actually a function, but a syntax construct, so it can't be quoted in Firebird.
To be able to execute this query, you need to enable the 'Run SQL command directly' option in the SQL View, either under Edit > 'Run SQL command directly', or using the 'Run SQL command directly' button in the toolbar (database icon with >_).
Goland is great at auto-completing SQL statements if I use the sql.DB package functions.
For example, Goland will provide SQL autocompletion (including DDL data) in this setting:
result, err := someDB.Exec(`INSERT INTO <cursor here>`)
Can I configure Goland to show me SQL autocompletion in other contexts? For instance, I'm using github.com/jmoiron/sqlx and it has functions of the form:
err := someDB.Get(&user, `SELECT * FROM users WHERE email="%s"`, email)
In this second example, autocompletion wasn't triggered.
I can't find where/if this is configured in the Goland settings. Can I tell Goland which function parameters should be eligible for SQL autocompletion?
You can use Alt + Enter inside the query and then use Inject Language and start typing the SQL dialect that you want to insert.
In IntelliJ IDEA 11.0.1 I connected Data Source to Oracle database.
When I open an *.sql file and type
SELECT * FROM
I see in code completion list of available tables. Also table columns of selected table are available in WHERE part of statement
But when I type
INSERT INTO
No table is available in code completion.
The same for SQL console.
Looks like a known bug. It's already fixed in IDEA 12 EAP and will be also fixed in IDEA 11.1.4 (not released at the moment of writing this answer).
Context
We're changing our install scripts to use ant's "sql" task and jdbc rather than proprietary sql clients sqlplus (oracle) and osql (msft).
Updated: added more context. Our "base data" (seed data) consists of a collection of .sql files containing "vendor-neutral"(i.e. works both in oracle and mssql) sql statements.
The Problem
The scripts run fine, with one exception:
This sql fails in Oracle. Specifically, something (ant or jdbc driver) treats the dashes/hyphens as "beginning of a comment"--even though they are embedded in a string. Note that the same sql works fine with ant/sql and microsoft's jdbc driver.
INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----');
Related Bug
This ant bug appears to identify the problem. As it's still open (after 8 years), I'm not hoping for a fix soon. However, because the problem appears only in oracle, it may lie with the driver.
The oracle driver: jdbc thin driver, version 10.2.0.1.0
The Question
Does anyone have a workaround which works in both mssql and oracle? (e.g. changing the offending lines to define an escape character? I don't see an 'escape' on the 'insert' sql92 syntax)
thanks
After viewing the 'SQLExec' source and turning on verbose logging, I found a workaround:
Workaround
if the sql statement includes a string containing '--', place the delimiter (semi-colon) on the next line.
This Fails
INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----');
This Succeeds
Note that semi-colon is on a separate line
INSERT INTO email_client (email_client_id,generated_reply_text) VALUES(100002,'----- Original Message -----')
;
Details
Turning on verbose logging, I saw that when Ant came across the offending sql statement, it actually passed three sql statements in at once to the jdbc driver. The offending statement, the next statement (which also included an embedded '--'), and the subsequent statement (which did not include an embedded '--').
I gave the Ant code a quick glance and didn't see any obvious errors. Since I wasn't planning to patch Ant, I looked for a workaround.
Tweaking with it I found that if I simply moved the delimiter (semicolon) to the next line for the statements with embedded '--', the scripts executed successfully.
thanks everyone for weighing in
You could try this:
INSERT INTO email_client (email_client_id,generated_reply_text)
VALUES(100002,LPAD('-',5,'-') || ' Original Message ' || LPAD('-',5,'-'));