-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bind out variable causes ORA-03146 when using "insert .... returning ..." #104
Comments
Thanks for the report. I can reproduce it and will get back to you on the fix once I have it. |
The problem is because the regular expression used for finding RETURNING bind variables assumed the existence of a space character. I am adjusting this and adding a test case to ensure that the problem remains solved. Stay tuned! |
and INTO keywords are not separated by spaces, but are separated by other whitespace characters (#104).
I've corrected the code and if you can build from source you can test directly yourself. The other option is to simply ensure a space character exists before the RETURNING keyword in your SQL. Thanks again for reporting this! |
Hi Anthony, Prefixing the RETURNING keyword with a space fixed the issue! Juan |
I can confirm that, after building it from source, it worked well with the RETURNING keyword right after a new line without requiring the extra space. Thank you very much for the very quick response! Juan |
It may be useful to know that the same error occurs if no space nor line break was provided (which counts as a programming error is guess). I accidentally omitted the space and was searching for quite a while before seeing this thread. 🤦♂️ |
Do you have an example that works in thick mode but fails in thin mode? If I need to further adjust the regex I can do so! |
I have also been working in thin mode and I just wanted to point out that the error message might have been a bit misleading given the fact that my query looked something like this:
Obviously, this multiline way of writing a single string makes it easier to see the columns with their respective variables, but also makes it hard to debug syntax errors like in the example above, where there should have been a space between the last two lines. |
Hmm, looks like thick mode (and therefore the server) allows for punctuation (like the closing parenthesis) before the returning statement. So I probably should adjust the regex to allow for that. That way it will work for you, too. :-) |
@M4X1K02, I've adjusted the regex to support your case, too. :-) |
I use conda for virtual environments and I don't know much about venv, so I can't confirm this atm, but I'll check after the next release. |
The fix for this bug has been included in python-oracledb 1.2.1 which was just released. |
I tried oracledb 1.2.0 and 1.1.1, both produce the same error.
Unhandled exception: Oracle ORA-03146.
Does your application call init_oracle_client()?
No, The application is intended to use the thin client.
If I include it, to use the THICK client, it WILL work. The issues is that bind out variables like the simple example in the documentation work in the thin client, but NOT the "Insert .... returning into :out_var" statement.
There is NO documentation that would indicate that the THICK client is required.
Include a runnable Python script that shows the problem.
This example is very similar to https://python-oracledb.readthedocs.io/en/latest/user_guide/bind.html#bind-direction
but it uses an "insert ... returning into :var" statement.
Include all SQL needed to create the database schema.
The text was updated successfully, but these errors were encountered: