erlangbureau / jamdb_oracle

Oracle Database driver for Erlang
MIT License
106 stars 48 forks source link

ORA-6502 when trying to return clob from the stored procedure #119

Closed psylone closed 2 months ago

psylone commented 2 years ago

Hi guys and thanks for all your amazing work!

I have a big trouble when trying to return a large character data from the stored procedure. Here's example:

sql = """
DECLARE
  a clob := '#{String.duplicate("*", 4001)}';
BEGIN
  :1 := a;
END;
"""

MyApp.Repo.query(sql, [out: :clob])

This will work if I replace 4001 with 4000. Can you please help with this? Thought [out: :clob] should work but seems it doesn't and varchar is using in out instead.

Thanks!

vstavskyi commented 2 years ago

max data length fix

psylone commented 2 years ago

max data length fix

Thanks for the rapid action!

Tested, it seems to work. Are you plan to release a patched version on hex.pm?

Also do you interested to bring some sort of CI in the project?

vstavskyi commented 2 years ago

I am running mix test and rebar3 ct manually. But if you'll make a pull request with CI configuration, I'll definitely merge it. Publishing to hex will be at the usual time next month. If you have any driver patch, please pull it and it'll be included in the next publishing :)

NikitaNaumenko commented 2 years ago

Hello, thanks for your work, max length helps, but if data greater than 35k, it still doesn't work. Thanks!

NikitaNaumenko commented 2 years ago

@vstavskyi Actually I receive a large XML from stored procedure, its size can be huge, but even if it sizes less than 100Kb, I got error. FYI when I select the same XML from db it works fine

vstavskyi commented 2 years ago

@psylone Create elixir.yml https://github.com/erlangbureau/jamdb_oracle/actions

NikitaNaumenko commented 2 years ago

I fetched latest version from master, and now I get this error "'ORA-06502: PL/SQL: numeric or value error\\nORA-06512: at line 7\\n'"

vstavskyi commented 2 years ago

The problem with empty error message was fixed. Maybe not completly, but still.

vstavskyi commented 2 years ago

max data length fix

This fix caused problems revert

NikitaNaumenko commented 2 years ago

I'm not sure) because now I get "'ORA-06502: PL/SQL: numeric or value error: character string buffer too small\\nORA-06512: at line 7\\n'", before, it works perfect when there is less data

vstavskyi commented 2 years ago

new fix

NikitaNaumenko commented 2 years ago

Thanks, but still the same error {:error, %DBConnection.ConnectionError{ message: "'ORA-06502: PL/SQL: numeric or value error\\nORA-06512: at line 7\\n'", severity: :error, reason: :error }} Maybe it helps you, but when we use DBMS_OUTPUT.PUT_LINE(result) we got same error, if we just call procedure, it finishes successfully and we can get the result from log table (procedure write results of procedures to table)

vstavskyi commented 2 years ago

max length 33554432 or 32k has not changed