ORA-00911: invalid character - Using XMLType - sql

I have been working with Oracle XML DB of version 11gR2. I have created a XML table with column as XMLType(Binary XMLType).
Question 1:
When I insert a XML document, all the single quotes in the attributes list gets converted to double quotes automatically. How can I get rid of this? Because I have to reprocess the entire XML document when I have to fetch it.
Question 2:
When I tried to retrieve I have used function getclobval(). This is working well with SQLPLUS and SQL Developer. However when I run this query through OCI, I am getting the error "ORA-00911: invalid character"
Can anyone help me on the above two questions?

Q1:
Have a look on Oracle support at bug 9871299: LOSS OF UNESCAPING WITH XMLTABLE
This bug was introduced in 11.2.0.1.

Related

Replacing text inside blob

I got quite large xml saved in BLOB and I need to edit value its value.
I'm trying following
UPDATE MY_TABLE
SET MY_BLOB=REPLACE(CONVERT(MY_BLOB USING UTF8), 'oldValue', 'newValue')
WHERE MY_ID = 'someID'
Still, I keep getting SQL Error: ORA-00907: missing right parenthesis
but srsly, where do I miss something?
CONVERT needs a least two input parameters and is not for BLOB
Documentation
Here is useful information about update a text in BLOB column.
You can consider converting blob to clob and then calling replace function on it. Some useful info: http://fazlansabar.blogspot.com/2012/03/replace-function-for-blob-fields-in.html

RODBC Error "Some part of your SQL statement is nested too deeply"

I have come across an error several times when working with R, that the RODBC package can't execute an SQL query string, but when I type the exact same string directly to a SQL Server query it works. Note that my strings contained umlauts.
I'm answering this question myself to help others avoid long internet searches if instead it can be simply reduced to this.
Almost always it was just an UNICODE error. Using umlauts or other non-unicode symbols in a R-string with the RODBC package produces this kind of error. So before trying to break it up into sub-queries as suggested by the error statement, check if your string contains only unicode characters.
If not, then the query is really to complex and needs to be split into sub-queries. For this, please refer to the other questions about this topic.

how to pull a column named "NUMBER" from Oracle through Ms Query in Excel

I know, I know...The column shouldn't be named "NUMBER", but it was here before I was, and I can't change it for now. At the moment, I only have read access to this database, and I was told it would be changed...soonish...
I've tried referencing it as Table."NUMBER" and that works when querying directly from Oracle, but for some reason, I still get the infamous ORA-01747: invalid user.table.column, table.column, or columns specification error when I reference it that way in MS Query. I also tried Table.""NUMBER"", "Table."NUMBER"", Table.'"NUMBER"', and 'Table."NUMBER"', but each of these gave me an error from MS Query saying it wasn't expecting the punctuation in the select column list.
Does this have something to do with the way MS Query handles double quotes? Is there any way to make sure that the double quotes around NUMBER make it to Oracle without MS Query throwing an error?
My query is really simple...except for this part.
Select Table."NUMBER"
From Table
Thanks in advance for any help.
try
SELECT table."NUMBER" AS a_number FROM table
or create a view referencing the table and rename the column as required
Aliases solve a lot of problems with names. I suspect that the issue you were having is not with running the query in Oracle but the result that comes back from Oracle. An alias allows the result set to be usable by Access.

SQL query syntax error using INSERT INTO

So, I know my code for the database connection and reader is functional, because it has worked for me many times before, however, something about this SQL query:
gives this error message:
when this data is inputted:
This is the database table that I am trying to add the data to:
The issue is that you are using "password" as a column name and that's a reserved word in Jet SQL. Either change the name or escape it in SQL code. You do the latter by wrapping it in square brackets [].

SQL Server character for enclosing database, table, field names

I'm writing a script to create a bunch of tables, and I read in the Microsoft documentation that I should use tick marks (aka grave) to enclose database, table, and field names, but when I run it in SQL Server Management Studio, I get a syntax error on the first tick:
CREATE TABLE `active`.`test` ( … )
^syntax error
So I tried running it thru a lint, and it told me that ` is an invalid character, and it suggested removing them, which totally messed up the script.
What gives?
Use square brackets...
CREATE TABLE [active].[test](...)
The documentation you have linked to is:
The SQL query strings for Windows Installer are restricted to the following formats.
This is not the syntax for SQL Server. I suggest looking at the Transact-SQL Reference instead.
You need to use [] instead of the backtick:
CREATE TABLE [active].[test]