Binding variables in xml string to execute PL/SQL statement #506
Unanswered
urosdigital
asked this question in
Q&A
Replies: 1 comment
-
Bind variables cannot be placed inside strings -- which is what you are doing. You would have to do something like this instead: query ='''
begin
my_user.AQ_UTIL.ENQUEUE('...<subscriberInfo><msisdn>' || :1 || '</msisdn><iccId>' || :2 || '</iccId><imsi>' || :3 || '</imsi><serviceProviderId>' || :4 || '</serviceProviderId><paymentType>' || :5 || '</paymentType></subscriberInfo>', 'my_user.Q_A_TO_B', NULL);
end; As noted, the other option is to use Python to create the string and pass that in as a single bind variable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have PL/SQL statement which accepts xml string as parameter as shown below:
Exec my_user.AQ_UTIL.ENQUEUE('my_xml_string', 'my_user.Q_A_TO_B', NULL);
where my_xml_string is in form like this:
I tried to bind variables by position like this (https://python-oracledb.readthedocs.io/en/latest/user_guide/bind.html#binding-by-name-or-position)
a small function to test execution:
when this function is executed i always get the following error:
if i try to use bind_names instead, i also get the same error
the same error appears when using dictionary:
in the end if i do string interpolation and assign value to the query, there is no errors but i do not want to use string interpolation in my queries
I can not figure out where is the mistake in my code. Can someone help to overcome this issue?
Beta Was this translation helpful? Give feedback.
All reactions