Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Pass dictionary and return from pl/sql

$
0
0

What is the proper way to pass a dictionary from python to pl/sql anonymous block?Pl/sql need to receive data from dictionary, loop over keys and return a list of keys and counter variable, but I dont understand how.

Code below returns

oracledb.exceptions.NotSupportedError: DPY-3002: Python value of type "dict_items" is not supported

with connection.cursor() as cur:    # sample dictionary    d_data = {'111': 'YES', '222': 'NO', '333': 'YES'}    cur.execute("""\        DECLARE        TYPE d_icusnums_type IS TABLE OF VARCHAR2(100) INDEX BY VARCHAR2(100);        d_icusnums d_icusnums_type;        BEGIN            FOR key_val IN :data LOOP                d_icusnums('key_val.key') := 'key_val.value';            END LOOP;        END;""", data=d_data.items())

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>