BRIDGE command in Oracle SQL Developer - sql

Occasionally I need to write queries accessing tables in both an MS Access database and an Oracle database. This can be done in MS Access, but Access limits the SQL I can use and has weird syntax.
The BRIDGE command in SQL Developer sounds perfect for this, but I'm having trouble getting it to work. When trying to execute this:
BRIDGE FallEnrollment2012 AS CentralServer(SELECT * FROM "Fall 2012 Enrollment 10-24-12")
SELECT * FROM FallEnrollment2012 WHERE ROWNUM <=10
I get this error message:
ORA-00900: invalid SQL statement
00900. 00000 - "invalid SQL statement"
*Cause:
*Action:
Between BRIDGE and FallEnrollment2012 a syntax error is indicated, but I can't figure out what the issue is. As far as I can tell from the examples I've looked at, it's correct as written. Can anyone tell me what I'm doing wrong?

This is a bug in SQL Developer 4.0 Beta1 & Beta2.
The workaround is to start SQL Developer , Tools > Migration > Scratch Editor .Then open the worksheet and run your BRIDGE command.
In this way the migration plugin is loaded which provides the BRIDGE functionality.
A fix is being worked on
Regards,
Dermot.

Related

SCADA reading from MariaDB: Error in Syntax

We have a SCADA System (Intouch). It had a Access .mdb database file on the client PC, which was defined as System DSN (Windows ODBC).
What I'm trying to do is to migrate the whole DB thing to MariaDB, running on remote server. I have already a running server, the connection from the SCADA PC to the server is up an running and it is added as system DSN in ODBC, using the MariaDB ODBC connector. I was also able to export all the data from Access to the Maria database, using Access's native export to ODBC database, so all my data is in Maria.
The Problem: The SCADA cannot read ot white anythig. In the scada's log i get SQL Syntax errors (forgot to mention, that the scada uses SQL). Thanks in advance!
Update:
It's old fashioned WindowMaker application, not Archestra, thus the SQL Functions are used. I've even changed the ODBC connector from Maria to mySQL
Today I've made some logs. Here the error:
"SELECT Checksum, (rest deletet by me.. is too long).... FROM Stp WHERE ProgNr=1and StpNr=0"
[37000] [MySQL][ODBC 8.0(a) Driver][mysqld-5.5.5-10.3.22-MariaDB]
You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near 'StpNr=0' at line 1 (1064)
From the review of your update it looks like its just a plain ol' syntax error.
What you provided:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1and StpNr=0
The logs complain of syntax by StpNr=0 but your problem is immediately before that where you haven't put a space between the AND and the ProgNr=1 command.
Correct syntax would be:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1 and StpNr=0
In my personal experience the WindowMaker SQL functions are extremely clunky to work with (especially with the 131 char limit on message tags). You can usually help yourself out by Logging your Query then trying it directly in your database.

VS2019 SQL Project incorrect syntax trying to create Security Policy

Security Policies in Azure SQL has been around for quite a few years now, and trying to create a security policy in my sql project (VS2019) is returning incorrect syntax near SECURITY.
Does it look like I'm doing anything obvious wrong?
Azure SQL Targeted:
but still incorrect syntax near SECURITY
What could I be doing wrong?
I figured this out for anyone else that runs into this. I had to set the schema DSP ruleset to V12 in the .sqlproj file
Change this line:
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureDatabaseSchemaProvider</DSP>
to
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>
It seems there is no way in the vs2019 gui yet to specify v12
I tested in Visual Studio 2017 and 2019, have the same error.
When I copy the SQL statement to the new query editor before execute it, the Error List will show the "Incorrect syntax" error:
But we still can run the query, there isn't any syntax error in query results:
Query executed successfully:
I think we can ignore the error in Error List, just reference the query execute result.
Hope this helps.

SQL Server 2014 - Incorrect syntax near the keyword 'tran'

I am trying to install a stored procedures. When I run the query I get Incorrect syntax near the keyword 'tran'
The 'tran' keyword is used in dump tran master with no_log
It would be helpful if anyone help me overcome this issue.
You're getting a syntax error because TRAN isn't a SQL keyword and isn't valid for the syntax of DUMP. See https://technet.microsoft.com/en-us/library/ms187315(v=sql.90).aspx. To use DUMP properly, it's either DUMP DATABASE or DUMP TRANSACTION
Note that per the above link, DUMP is flagged as deprecated and only exists for backwards compatibility. It will go away in the future. You should be using BACKUP (probably BACKUP LOG in this case) instead.
From some SQL Server 2005 documentation on DUMP, I found the following:
The DUMP statement is included for backward compatibility. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, use BACKUP.
I bet that DUMP has already been removed from SQL Server 2014.

Parsing queries in Oracle SQL Developer

Is there a way to parse code in SQL Developer (oracle) without actually touching tables/packages data like you can do with "parse" option in SQL Management studio?
There is no option to merely parse the SQL statement to validate the syntax.
You could choose the "Explain Plan" option (F10 in the Windows version of SQL Developer), that will validate the syntax as part of generating the query plan. If there is a syntax error, you'll get the error message when you attempt to generate the plan but you generally won't get the line and column of the error which makes debugging more challenging.
I was looking for this right now and couldn't find an option in Oracle SQL Developer.
I know a service called SQL Fiddle that can help in such situations where one needs to test/parse/validate an adhoc PL/SQL script. Using SQL Fiddle you can do this:
Select Oracle 11g R2 (as available right now) in the dropdown and type your script in the left text area. Press Build Schema button. If your script is valid then it'll show you Schema Ready message like this:

Unable to Import a database from Microsoft SQL Server Management Studio to phpmyadmin

Hey folks, the person I am buildling a website for decided to design their own database. They used Microsoft SQL Server Management Studio to build it and such. Now that they are done with the database they exported it to a text file (Tasks -> Generate Scripts). Now when I try to import the file into phpmyadmin I get the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[master] GO /****** Object: Database [Butterbakers] Script Date: 02/15/201' at line 1
The database code is here: http://zamn.pastebin.com/Y3u7MpZ9
phpmyadmin is for MySQL.
Microsoft SQL Server is a different DBMS.
Large parts of the SQL Syntax is DBMS/vendor specific.
The MySQL Workbench has a feature to "Create EER Model from existing Database".
This may be a try but you need a jdbc connection to the MS SQL Server and MySQL...
Converting DDL to a different DBMS is all but easy. And if you're done this doesn't guarantee that an probably already existing application is still working with the other DBMS.
Not switching DBMS and using the free MS SQL Express could be an option.
First decide for a DBMS and restart form zero is surely the cleanest and less painful solution.
With SQL Compare (http://www.red-gate.com/products/sql-development/sql-compare/) and SQL Data Compare (http://www.red-gate.com/products/sql-development/sql-data-compare/) , you can synchronize different DB.