Forum OpenACS Q&A: oracle dml - returning into :1?

Collapse
Posted by Daniel Wickstrom on
I came across this query in ad-security.tcl where the insert has a
returning into statement on the end. I changed it as shown, but I'm
wondering what returning into statement is supposed to do?

# set dml "
# insert into sec_${kind}_properties(${kind}_id, module,
property_name, property_value, secure_p)
# values([ad_get_${kind}_id], '[DoubleApos $module]',
'[DoubleApos $name]', '', '[DoubleApos $secure]')
# returning property_value into :1
# "

set dml "
insert into sec_${kind}_properties(${kind}_id, module,
property_name, property_value, secure_p)
values([ad_get_${kind}_id], '[DoubleApos $module]',
'[DoubleApos $name]', '', '[DoubleApos $secure]')
"

Dan Wickstrom

Collapse
Posted by Ben Adida on
This seems like a half-ported query, probably due to some late night hacking on my part :)

Queries that have a returning into :1 are used for CLOBs or BLOBs. You usually insert an empty_clob(), and then use "returning into :1" combined with an ns_ora clobdml command that will return the LOB pointer into a Tcl variable that you can then stream data into. Ugly stuff. You switched it to varchar, which is where we want to go for CLOBs, so that's good